soxspipe.recipes.soxs_mflat

generate a single normalised master flat-field frame

Author

David Young & Marco Landoni

Date Created

September 16, 2020

Module Contents

Classes

soxs_mflat

generate a single normalised master flat-field frame

Functions

API

soxspipe.recipes.soxs_mflat.nearest_neighbour(singleValue, listOfValues)[source][source]
soxspipe.recipes.soxs_mflat.print_memory_usage(pprint=False, message='')[source][source]
class soxspipe.recipes.soxs_mflat.soxs_mflat(log, settings=False, inputFrames=[], verbose=False, overwrite=False, command=False, debug=False, turnOffMP=False)[source][source]

Bases: soxspipe.recipes.base_recipe.base_recipe

generate a single normalised master flat-field frame

Key Arguments

  • log – logger

  • settings – the settings dictionary

  • inputFrames – input fits frames. Can be a directory, a set-of-files (SOF) file or a list of fits frame paths.

  • verbose – verbose. True or False. Default False

  • overwrite – overwrite the product file if it already exists. Default False

  • command – the command called to run the recipe

  • debug – generate debug plots. Default False

  • turnOffMP – turn off multiprocessing. True or False. Default False. If True, multiprocessing will be turned off and the recipe will run in serial. This is useful for debugging.

Usage

from soxspipe.recipes import soxs_mflat
recipe = soxs_mflat(
    log=log,
    settings=settings,
    inputFrames=fileList
)
mflatFrame = recipe.produce_product()

Initialization

calibrate_frame_set()[source][source]

given all of the input data calibrate the frames by subtracting bias and/or dark

Return:

  • calibratedFlats – the calibrated frames

clean_up(forceFail=False)[source]
clip_and_stack(frames, recipe, ignore_input_masks=False, post_stack_clipping=True)[source]
detrend(inputFrame, master_bias=False, dark=False, master_flat=False, order_table=False)[source]
find_uvb_overlap_order_and_scale(dcalibratedFlats, qcalibratedFlats)[source][source]

find uvb order where both lamps produce a similar flux. This is the order at which the 2 lamp flats will be scaled and stitched together

Key Arguments:

  • qcalibratedFlats – the QTH lamp calibration flats.

  • dcalibratedFlats – D2 lamp calibration flats

Return:

  • order – the order number where the lamp fluxes are similar

Usage:

overlapOrder = self.find_uvb_overlap_order_and_scale(dcalibratedFlats=dcalibratedFlats, qcalibratedFlats=qcalibratedFlats)
flag_poor_data()[source]
get_recipe_settings()[source]
mask_low_sens_pixels(frame, orderTablePath, returnMedianOrderFlux=False, writeQC=True)[source][source]

add low-sensitivity pixels to bad-pixel mask

Key Arguments:

  • frame – the frame to work on

  • orderTablePath – path to the order table

  • returnMedianOrderFlux – return a table of the median order fluxes. Default False.

  • writeQC – add the QCs to the QC table?

Return:

  • frame – with BPM updated with low-sensitivity pixels

  • medianOrderFluxDF – data-frame of the median order fluxes (if returnMedianOrderFlux is True)

normalise_flats(inputFlats, orderTablePath, firstPassMasterFlat=False, lamp='')[source][source]

determine the median exposure for each flat frame and normalise the flux to that level

Key Arguments:

  • inputFlats – the input flat field frames

  • orderTablePath – path to the order table

  • firstPassMasterFlat – the first pass of the master flat. Default False

  • lamp – a lamp tag for QL plots

Return:

  • normalisedFrames – the normalised flat-field frames (CCDData array)

prepare_frames(save=False)[source]
produce_product()[source][source]

generate the master flat frames updated order location table (with egde detection)

Return:

  • productPath – the path to the master flat frame

qc_median_flux_level(frame, frameType='MBIAS', frameName='master bias', medianFlux=False)[source]
qc_ron(frameType=False, frameName=False, masterFrame=False, rawRon=False, masterRon=False)[source]
report_output(rformat='stdout')[source]
stitch_uv_mflats(medianOrderFluxDF, orderTablePath)[source][source]

return a master UV-VIS flat frame after slicing and stitch the UV-VIS D-Lamp and QTH-Lamp flat frames

Key Arguments:

  • medianOrderFluxDF – data frame containing median order fluxes for D and QTH frames

  • orderTablePath – the original order table paths from order-centre tracing

Return:

  • stitchedFlat – the stitch D and QTH-Lamp master flat frame

Usage:

mflat = self.stitch_uv_mflats(medianOrderFluxDF)
subtract_mean_flux_level(rawFrame)[source]
update_fits_keywords(frame, rawFrames=False)[source]
verify_input_frames()[source][source]

verify the input frames match those required by the soxs_mflat recipe

If the fits files conform to required input for the recipe everything will pass silently, otherwise an exception will be raised.

xsh2soxs(frame)[source]