Skip to content

Adding New Instruments

Epzack edited this page Aug 25, 2021 · 6 revisions

These instructions describe the process of adding a new instrument to the photometry pipeline

Note: Only changes to specific_instruments.py are needed to add a new instrument

Adding an Instrument

1. Create a new instrument with inherited class "instrument"

    class new_instrument(instrument):

2. Initialize new instrument using the instruments name and number of cameras

    def __init__(self):
        instrument.__init__(self, 'new_instrument', camnum)

3. Define the following functions:

  • Note function ‘change_header_keywords’ is explained in step 4
    def has_cam_bias(self, idx):
        # Input: index of camera
        # Output: boolean saying if indexed camera needs bias calibration

    def has_cam_dark(self, idx):
        # Input: index of camera
        # Output: boolean saying if indexed camera needs dark calibration

    def change_header_keywords(self, h, cam):
        # Defined in step 4

    def slice(self, cam):
        # Input: camera name
        # Output: slicing of specified camera

    def is_cam_split(self, idx):
        # Input: index of camera
        # Output: boolean saying if indexed camera is a split filter camera

    def get_cam_sat(self, h, idx):
        # Input: header, index of camera
        # Output: saturation of indexed camera
        
    def get_cam_gain(self, h, idx):
        # Input: header, index of camera
        # Output: gain of indexed camera

    def get_exptime(self, h):
        # Input: header
        # Output: exposure time of frame

    def get_filter(self, h, cam):
        # Input: header, camera name (ex. 'C0', 'C3a' for split filter camera)
        # Output: filter name for file
        
    def possible_filters(self):
        # Input: nothing
        # Output: instruments' list of possible filters
        
    def get_centered_filter(self,h,idx):
        # Input: header, index of camera
        # Output: filter name at center of indexed camera

    def original_file_format(self):
        # Input: nothing
        # Output: file name format (ex. ‘lmi.????.fits’)

    def change_file_names(self, files):
        # Input: files to change name
        # Output: changed file names in same directory that match 
        # '????????T??????C{}{}.fits'.format(cam_i, ftype_post) format
        # (ex: '20190902T020047C0b.fits' Refers to 'b' -> bias frame taken with 'C0' -> Camera Zero at time 09/02/2019 02:00:47)

4. Add necessary headers for auto-processing in ‘change_header_keywords’

The following unique headers must be defined for the auto-processing of the pipeline (this list excludes mandatory fits headers: SIMPLE, BITPIX, NAXIS, NAXIS1, NAXIS2)

  • CAMERA (int)

    • Used to differentiate different cameras (ex: 0, 1, 2)
  • OBSTYPE (string)

    • Used to specify the type of frame (ex: 'OBJECT', 'BIAS', 'DARK', 'FLAT')
  • OBJNAME (string)

    • Target object name (ex: 'GRB160203A', 'BIAS', 'DARK', 'FLAT')
  • TARGNAME (string)

    • Same as OBJNAME
  • DATE-OBS (string)

    • UT date of observation (format: 'YYYY-MM-DDThh:mm:ss.ss' )
  • FILTER (string)

    • Composite filter name (Must be in FILTER_PARAMS{} in get_SEDs.py
  • EXPTIME (float)

    • Exposure time in seconds
  • GAIN (float)

    • Gain in units e-/ADU
  • PIXSCALE (float)

    • Pixel scale in arcsec/pixel (for 1x1 binning)
  • AIRMASS (float)

    • Relative air mass
  • SATURATE (float)

    • Saturation level in units ADU
  • CD*_* (float)

    • WSC coordinate matrix (CD1_1, CD2_2, CD1_2, CD2_1)
  • CRPIX1 (float)

    • Reference point along WSC axis 1
  • CRPIX2 (float)

    • Reference point along WSC axis 2
  • CTYPE1 (string)

    • Axis type for WSC axis 1
  • CTYPE2 (string)

    • Axis type for WSC axis 2
  • CRVAL1 (float)

    • [deg] RA for WCS Axis 1
  • CRVAL2 (float)

    • [deg] DEC for WCS Axis 2
  • PV*_* (float)

    • Distortion parameters (only if necessary)

5. Add instrument with instrument name and class name to instrument_dict at the bottom

instrument_dict = {'ratir': ratir(), 'lmi': lmi(), 'new_instrument': new_instrument()}

6. Test new instrument

  • Place a zipfile with the test image data in the test folder
  • Run test.instrument.py and input the new instruments name (the one used in instrument_dict), the name of the zipfile (ex: test.zip), and the new subfolder in 'test' that the reduced data should be sent to
  • Review the headers after the code terminates to make sure they are accurate
Clone this wiki locally