Small class with facilities to put together the two footprint edges.
USAGE
fp = Footprint(edge_1,edge_2)
parameters
----------
edge_1: Edge object corresponding to the left or bottom footprint edge.
edge_2: Edge object corresponding to the right or top footprint edge.
id Integer reference number for the footprint.
(x1, x2, y1, y2), the origin of these coordinates is the lower left of the input image.
edges Tuple of Edge objects (edge_1,edge_2) defining footprint edges.
width Average width of the footprint.
FootprintTrace offers functionality to create a FITS binary table with information about each footprint in the image suitable to be read by the CutFootprints class methods.
USAGE
fpt = FootprintTrace(footprints)
parameters
-----------
footprints: List of footprint objects
as_bintable()
Creates the TRACEFP FITS BINTABLE from the FootprintTrace object.
The columns description are:
'id' : integer reference number for the footprint. 'region' : (x1,x2,y1,y2), window of pixel co-ords enclosing this footprint. The origin of these coordinates could be the lower left of the original image. 'range1' : (x1,x2,y1,y2), range where edge_1 is valid. The origin of these coordinates is the lower left of the original image. 'function1': Fit function name (default: polynomial) fitting edge_1. 'coeff1' : Arrray of coefficients, high to low order, such that pol(x) = c1*x**2 + c2*x + c3 (for order 2). 'order1' : Order or polynomial (default: 2). 'range2' : ditto for edge_2. 'function2': ditto for edge_2 'coeff2' : ditto for edge_2 'order2' : ditto for edge_2 'cutrange1' : (x1,x2,y1,y2), range where edge_1 is valid. The origin of these coordinates is the lower left of the cutout region. 'cutfunction1': Fit function name (default: polynomial). 'cutcoeff1' : Arrray of coefficients, high to low order, such that pol(x) = c1*x**2 + c2*x + c3 (for order 2) 'cutorder1' : Order or polynomial (default: 2). 'cutrange2' : ditto for edge_2 'cutfunction2': ditto for edge_2 'cutcoeff2' : ditto for edge_2 'cutorder2' : ditto for edge_2
CutFootprint provides functionality to to build a list of footprint sections from the input TRACEFP table in the Astrodata object.
USAGE
cut = CutFootprints(ad)
parameter
---------
ad: The AstroData object containing a *TRACEFP* table extension.
cut_out(rec,science,dq,var)
Cut a region enclosing a footprint. Each cut is defined by region and the footprint in it is defined by the edges fitting functions. The science section is zero out between the rectangle borders and the footprint edge. The DQ section is bitwise ORed with 1. The results are sci_data, dq_section and var_section ndarrays.
USAGE
CutFootprints.cut_out(rec,science,dq,varcut)
parameters
----------
rec: *TRACEFP* record
science: SCI entire frame.
dq: DQ entire frame. Value is None if not available.
var: VAR entire frame. Value is None if not available.
cut_regions()
Loop through the records of the TRACEFP table creating one CutFootprint object per iteration setting the science data, dq and var data sections. Then it appends each object to a list of cuts.
init_as_astrodata()
Initializes parameters to be used by as_astrodata method. Creates a WCS object (pywcs) from the SCI header and form the output AD object with the PHU and MDF from the input AD. We are adding the TRACEFP extension as well for later use on the spectral reduction process.
as_astrodata()
With each cut object in the cut_list having the SCI, DQ, VAR image data, form an hdu and append it to the output AstroData object. Update keywords EXTNAME= ‘SCI’, EXTVER=<slit#>, CCDSEC, DISPAXIS, CUTSECT, CUTORDER in the header and reset WCS information if there was a WCS in the input AD header.