crrej_from_raw¶
- stistools.crrej_from_raw.create_new_crr(crr_par)¶
Convert a dict to a 1-row Astropy Table with the correct column dtypes.
- Parameters:
- crr_par: dict
Dictionary of CRREJECTAB contents
- Returns:
- Astropy Table of CRREJECTAB contents
- stistools.crrej_from_raw.crrej_from_raw(input, wavecal='', outroot='', savetmp=False, verbose=False, timestamps=False, trailer='', print_version=False, print_revision=False, crrejtab='', scalense=None, initgues=None, skysub=None, crsigmas=None, crradius=None, crthresh=None, badinpdq=None, crmask=None)¶
Calibrate STIS data (calstis) with modified cosmic ray rejection parameters.
A temporary CRREJTAB is created, with values derived from user-supplied inputs and defaults derived from the file's ext=0 CRREJTAB keyword. This default file may be overridden by specifying a different crrejtab.
This routine should be used instead of stistools.ocrreject.ocrreject() when the order of operation is of concern.
Note: This routine does not replace
ocrreject's functionality for combining multiple CCD datasets together into one CRJ file (i.e. the "all" parameter).- Parameters:
- input: str
Name of the input file.
- wavecal: str, default=''
Name of the input wavecal file, or '' (the default). This is only needed if the name is not the "normal" name (rootname_wav.fits).
- outroot: str, default=''
Root name for the output files, or '' (the default). This can be a directory name, in which case the string must end in '/'.
- savetmp: bool, default=False
True if calstis should not delete temporary files.
- verbose: bool, default=False
If True, calstis will print more info.
- timestamps: bool, default=False
If True, calstis will print the date and time at various points during processing.
- trailer: str, default=''
If specified, the standard output and standard error will be written to this file instead of to the terminal. Note, however, that if print_version or print_revision is specified, the value will be printed to the terminal, and any name given for the trailer will be ignored.
- print_version: bool, default=False
If True, calstis will print the version number (a string) and then return 0.
- print_revision: bool, default=False
If True, calstis will print the full version string and then return 0.
- crrejtab: str, default=''
This argument may be used to override the CRREJTAB value in the primary header of the input files. This file determines the default CR-rejection parameters below.
- scalense: str, default=''
Multiplicative scale factor applied to noise. If specified, this overrides SCALENSE in the CRREJTAB.
- initgues: str, default=''
Initial guess method. If specified, this overrides INITGUES in the CRREJTAB. The allowed values are 'minimum' and 'median' and ''.
- skysub: str, default=''
Sky value subtracted. If specified, this overrides SKYSUB in the CRREJTAB. The allowed values are 'none', 'mode' and ''.
- crsigmas: str, default=''
Statistical rejection criteria. If specified, this overrides CRSIGMAS in the CRREJTAB. The value should be a comma-separated string of one or more integer or float values. For each such value, calstis will perform one cosmic-ray-rejection cycle, with the sigma taken from the numerical value that was specified.
- crradius: float or None, default=None
If not None, this overrides CRRADIUS in the CRREJTAB. This is the rejection propagation radius in pixels (e.g. 1.5). After finding an outlier (a cosmic ray hit), adjacent pixels can also be flagged and excluded. Neighboring pixels will be rejected if their values are discrepant by more than crthresh * sigmas * noise, where noise is based on the noise model (i.e. Poisson noise and readout noise).
- crthresh: float or None, default=None
If not None, this overrides CRTHRESH in the CRREJTAB. This is the rejection propagation threshold (e.g. 0.8). If crthresh = 0 then all adjacent pixels (see crradius) will be rejected.
- badinpdq: int or None, default=None
If specified, this overrides BADINPDQ in the CRREJTAB. This is a data quality flag (or bitwise OR of flags) to allow rejection of pixels in the input images when forming the "guess" image (the image with which to compare the input images when looking for outliers).
- crmask: bool or None, default=None
If specified, this overrides CRMASK in the CRREJTAB. crmask = True means that the cosmic rays that are detected should be flagged in the DQ (data quality) extensions of the input files.
- Returns:
- status: int
0 is OK. 1 is returned if cs0.e (the calstis host executable) returned a non-zero status. If verbose is True, the value returned by cs0.e will be printed. 2 is returned if the specified input file or files were not found.
- stistools.crrej_from_raw.determine_crrejtab(input, crrejtab=None)¶
Parse the input file's ext=0 header for the CRREJTAB. A user-specified CRREJTAB may be provided instead.
update the input file's HISTORY
update the input file's CRREJTAB keyword to point to a new temporary file
temporarily store the old CRREJTAB value (if valid) in a new PREV_CRR keyword
read the CRREJTAB FITS table
- Parameters:
- input: str
Name of the RAW FITS file to update.
- crrejtab: str or None, default=None
User-supplied CRREJTAB to be used instead of the file specified in the ext=0 header.
- Returns:
- Astropy Table of CRREJTAB contents