Functions
- refstis.functions.RemoveIfThere(item)[source]
Remove a file only if it already exists
- Parameters:
item (str) – file to be removed
Examples
>>> RemoveIfThere('/path/to/file.txt')
- refstis.functions.apply_dark_correction(filename, expstart)[source]
Perform temperature scaling to input dark file
All science extensions in the input filename will be scaled to the reference temperatue of 18.0 c.
- Parameters:
filename (str) – full path to input FITS file
expstart (str) – start time in MJD of the dataset
- refstis.functions.bd_calstis(joinedfile, thebiasfile=None)[source]
Run CalSTIS on the joined file.
Header keywords will be set for ocrreject to work correctly and not flag regions outside the original aperture: APERTURE –> 50CCD APER_FOV –> ‘50x50’ DARKCORR –> ‘OMIT’ FLATCORR –> ‘OMIT’
- Parameters:
joinedfile (str) – join of multiple input darks
thebiasfile (str, bool) – the biasfile to be subtracted by basic2d
- refstis.functions.bd_crreject(joinedfile)[source]
Check if cosmic-ray rejection has been performed on input file
if cosmic-ray rejection has already been done on the input bias image, skip all calstis-related calibration steps
- refstis.functions.bias_subtract_data(filename, biasfile, outdir='')[source]
Perform bias subtraction on input dataset
basic2d from calstis will be run on the input dataset with the steps DQICORR, BLEVCORR, and BIASCORR set to perform.
- Parameters:
filename (str) – full path to input FITS file
biasfile (str) – full path to the bias FITS file to be subtracted
outdir (str, optional) – if specified, the directory to send the bias-subtracted output file
- Returns:
filename – full_path to the bias subtracted file
- Return type:
str
- refstis.functions.count_imsets(file_list)[source]
Count the total number of imsets in a file list.
The total number of imsets is counted by dividing the total number of extensions (NEXTEND) by 3 (SCI, ERR, DQ).
- Parameters:
file_list (list) – list of all files to be counted
- Returns:
total – number of imsets
- Return type:
int
- refstis.functions.get_keyword(file_list, keyword, ext=0)[source]
Return the value from a header keyword over a list of files.
if the value is not consistent accross the input files, an assertion error will be raised
- refstis.functions.make_path_safe(filename)[source]
Make a full path to file safe for use in FITS headers.
For full paths that are less than 67 characters, the filename is simply returned. When the full path is equal to or greater than 67, then the path is inserted into the environment as ‘refdir’ and the filename is returned as ‘refdir$filename’. This will prevent the filename from being split accross multiple FITS keywords, and is a convention understood by many tasks/pipelines.
- Parameters:
filename (str) – Full path + name to the file.
- Returns:
filename – Safe filename that can fit in a single FITS keyword.
- Return type:
str
Examples
>>> make_path_safe('/short/path/reference_file.fits') /short/path/reference_file.fits
>>> make_path_safe('/really/really/really/really/really/really/really/really/reference_file.fits') refdir$reference_file.fits
- refstis.functions.make_residual(mean_bias, kern=(3, 15))[source]
Create residual image
Median filter the median with a 15 x 3 box and subtract from the mean to produce the residual image.
- refstis.functions.msjoin(imset_list, out_name='joined_out.fits')[source]
Replicate msjoin functionality in pure python
- refstis.functions.normalize_crj(filename)[source]
Normalize the input filename by exptime / gain and flush hdu