Association files serve as FITS tables which relate a set of input files to the generation of calibrated or combined products.
A module which provides utilities for reading, writing, creating and updating association tables and shift files.
author: | |
---|---|
Warren Hack, Nadia Dencheva | |
version: | |
‘0.1 (2008-01-03)’ |
Notes
A dictionary like object representing a member of an association table. It looks like this:
'j8bt06nzq': {'abshift': False,
'dshift': True,
'refimage': 'j8bt06010_shifts_asn.fits[wcs]',
'rot': 359.99829,
'row': 1,
'scale': 1.000165,
'shift_frame': 'input',
'shift_units': 'pixels',
'xoff': 0.0,
'xshift': 0.4091132,
'yoff': 0.0,
'yshift': -0.56702018}
If abshift is True, shifts, rotation and scale refer to absolute shifts. If dshift is True, they are delta shifts.
Notes
A dictionary like object which represents an association table. An ASNTable object looks like this:
{'members':
{'j8bt06nyq': {'abshift': False,
'dshift': True,
'refimage': 'j8bt06010_shifts_asn.fits[wcs]',
'rot': 0.0,
'row': 0,
'scale': 1.0,
'shift_frame': 'input',
'shift_units': 'pixels',
'xoff': 0.0,
'xshift': 0.0,
'yoff': 0.0,
'yshift': 0.0},
'j8bt06nzq': {'abshift': False,
'dshift': True,
'refimage': 'j8bt06010_shifts_asn.fits[wcs]',
'rot': 359.99829,
'row': 1,
'scale': 1.000165,
'shift_frame': 'input',
'shift_units': 'pixels',
'xoff': 0.0,
'xshift': 0.4091132,
'yoff': 0.0,
'yshift': -0.56702018}},
'order': ['j8bt06nyq', 'j8bt06nzq'],
'output': 'j8bt06nyq'}
Examples
Creating an ASNTable object from 3 filenames and a shift file would be done using:
>>> asnt=ASNTable([fname1,fname2, fname3], shiftfile='shifts.txt')
The ASNTable object would have the ‘members’ and ‘order’ in the association table populated based on infiles and shiftfile.
This creates a blank association table from the ASNTable object:
>>> asnt.create()
Parameters : | |
---|---|
`inlist`: a list :
`output` a string :
`shiftfile`: a string :
|
Purpose : | |
---|---|
Write association table to a file. |
A shift file has the following format (name, Xsh, Ysh, Rot, Scale):
# frame: output
# refimage: tweak_wcs.fits[wcs]
# form: delta
# units: pixels
j8bt06nyq_flt.fits 0.0 0.0 0.0 1.0
j8bt06nzq_flt.fits 0.4091132 -0.5670202 359.9983 1.000165
This object creates a dict like object representing a shift file used by Pydrizzle and Mirashift.
Purpose : | |
---|---|
Create a dict like ShiftFile object from a shift file on disk or from variables in memory. If a file name is provided all other parameters are ignored. |
|
Parameters : | |
`filename`: string :
`form`: string :
`frame`: string :
`units`: string :
`order`: list :
`refimage`: string :
`**d`: dictionary :
|
|
Raises : | |
ValueError :
|
Examples
Read a shift file on disk using:
>>> sdict = ShiftFile('shifts.txt')
Pass values for the fields of the shift file and a dictionary with all files:
>>> d={'j8bt06nyq_flt.fits': [0.0, 0.0, 0.0, 1.0],
'j8bt06nzq_flt.fits': [0.4091132, -0.5670202, 359.9983, 1.000165]}
>>> sdict = ShiftFile(form='absolute', frame='output', units='pixels', order=['j8bt06nyq_flt.fits',
'j8bt06nzq_flt.fits'], refimage='tweak_wcs.fits[wcs]', **d)
The return value can then be used to provide the shift information to code in memory.
Reads a shift file from disk and populates a dictionary.
Verifies that reference file exists.
Writes a shift file object to a file on disk using the convention for shift file format.
Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle.
Algorithm : | |
---|---|
An association table is a FITS binary table with 2 required columns: ‘MEMNAME’, ‘MEMTYPE’. It checks ‘MEMPRSNT’ column and removes all files for which its value is ‘no’. |
|
Parameters : | |
`fname`: string :
`output`: string :
`prodonly`: bool :
|
|
Returns : | |
`asndict`: dict-object :
|
Examples
An association table can be read from a file using the following commands:
>>> from pytools import asnutil
>>> asntab = asnutil.readASNTable('j8bt06010_shifts_asn.fits', prodonly=False)
The asntab object can now be passed to other code to provide relationships between input and output images defined by the association table.