Process Input (data validation)
This module supports the interpretation and initial verification of all the input files specified by the user. These functions:
reads in parameter values from MDRIZTAB reference file and merges those merges those values in with the rest of the parameters from the GUI/configObj, if use of MDRIZTAB was specified
insure that all input files are multi-extension FITS files and converts them if they are not
updates all input WCS’s to be consistent with IDCTAB, if specified
generates the
ImageObject
instances for each input fileresets the DQ bits if specified by the user
adds info about any user-provided IVM files to the ImageObjects
generates the output WCS based on user inputs
Process input to MultiDrizzle/PyDrizzle.
- Authors:
Warren Hack
- License:
The input can be one of:
a python list of files
a comma separated string of filenames (including wild card characters)
an association table
an @file (can have a second column with names of ivm files)
No mixture of instruments is allowed. No mixture of association tables, @files and regular fits files is allowed. Files can be in GEIS or MEF format (but not waiver fits).
Runs some sanity checks on the input files.
If necessary converts files to MEF format (this should not be left to makewcs
because updatewcs
may be False
).
Runs makewcs.
The function process_input
returns an association table, ivmlist, output name
The common interface interpreter for MultiDrizzle tasks, ‘processCommonInput()’, not only runs ‘process_input()’ but ‘createImageObject()’ and ‘defineOutput()’ as well to fully setup all inputs for use with the rest of the MultiDrizzle steps either as stand-alone tasks or internally to MultiDrizzle itself.
- drizzlepac.processInput.addIVMInputs(imageObjectList, ivmlist)[source]
Add IVM filenames provided by user to outputNames dictionary for each input imageObject.
- drizzlepac.processInput.applyContextPar(imageObjectList, contextpar)[source]
Apply the value of the parameter
context
to the input list, setting the name of the output context image to None ifcontext
is False
- drizzlepac.processInput.buildASNList(rootnames, asnname, check_for_duplicates=True)[source]
Return the list of filenames for a given set of rootnames
- drizzlepac.processInput.buildEmptyDRZ(input, output)[source]
Create an empty DRZ file.
This module creates an empty DRZ file in a valid FITS format so that the HST pipeline can handle the Multidrizzle zero expossure time exception where all data has been excluded from processing.
- Parameters:
- inputstr
filename of the initial input to process_input
- outputstr
filename of the default empty _drz.fits file to be generated
Notes
The existance of the DRZ file is also necessary to satisfy the interface expectations of the archive. Do NOT delete this file.
- drizzlepac.processInput.buildFileList(input, output=None, wcskey=None, updatewcs=True, **workinplace)[source]
Builds a file list which has undergone various instrument-specific checks for input to MultiDrizzle, including splitting STIS associations.
- drizzlepac.processInput.buildFileListOrig(input, output=None, wcskey=None, updatewcs=True, **workinplace)[source]
Builds a file list which has undergone various instrument-specific checks for input to MultiDrizzle, including splitting STIS associations. Compared to buildFileList, this version returns the list of the original file names as specified by the user (e.g., before GEIS->MEF, or WAIVER FITS->MEF conversion).
- drizzlepac.processInput.changeSuffixinASN(asnfile, suffix)[source]
Create a copy of the original asn file and change the name of all members to include the suffix.
- drizzlepac.processInput.checkDGEOFile(filenames)[source]
Verify that input file has been updated with NPOLFILE
This function checks for the presence of ‘NPOLFILE’ kw in the primary header when ‘DGEOFILE’ kw is present and valid (i.e. ‘DGEOFILE’ is not blank or ‘N/A’). It handles the case of science files downloaded from the archive before the new software was installed there. If ‘DGEOFILE’ is present and ‘NPOLFILE’ is missing, print a message and let the user choose whether to (q)uit and update the headers or (c)ontinue and run astrodrizzle without the non-polynomial correction. ‘NPOLFILE’ will be populated in the pipeline before astrodrizzle is run.
In the case of WFPC2 the old style dgeo files are used to create detector to image correction at runtime.
- Parameters:
- filenameslist of str
file names of all images to be checked
- drizzlepac.processInput.checkForDuplicateInputs(rootnames)[source]
Check input files specified in ASN table for duplicate versions with multiple valid suffixes (_flt and _flc, for example).
- drizzlepac.processInput.checkMultipleFiles(input)[source]
Evaluates the input to determine whether there is 1 or more than 1 valid input file.
- drizzlepac.processInput.createImageObjectList(files, instrpars, output=None, group=None, undistort=True, inmemory=False)[source]
Returns a list of imageObject instances, 1 for each input image in the list of input filenames.
- drizzlepac.processInput.getMdriztabPars(input)[source]
High-level function for getting the parameters from MDRIZTAB
Used primarily for TEAL interface.
- drizzlepac.processInput.manageInputCopies(filelist, **workinplace)[source]
Creates copies of all input images in a sub-directory.
The copies are made prior to any processing being done to the images at all, including updating the WCS keywords. If there are already copies present, they will NOT be overwritten, but instead will be used to over-write the current working copies.
- drizzlepac.processInput.processFilenames(input=None, output=None, infilesOnly=False)[source]
Process the input string which contains the input file information and return a filelist,output
- drizzlepac.processInput.process_input(input, output=None, updatewcs=True, prodonly=False, wcskey=None, **workinplace)[source]
Create the full input list of filenames after verifying and converting files as needed.
- drizzlepac.processInput.reportResourceUsage(imageObjectList, outwcs, num_cores, interactive=False)[source]
Provide some information to the user on the estimated resource usage (primarily memory) for this run.
- drizzlepac.processInput.resetDQBits(imageObjectList, cr_bits_value=4096)[source]
Reset the CR bit in each input image’s DQ array
- drizzlepac.processInput.runmakewcs(input)[source]
Runs make wcs and recomputes the WCS keywords
- Parameters:
- inputstr or list of str
a list of files
- Returns:
- outputlist of str
returns a list of names of the modified files (For GEIS files returns the translated names.)
- drizzlepac.processInput.setCommonInput(configObj, createOutwcs=True, overwrite_dict={})[source]
The common interface interpreter for MultiDrizzle tasks which not only runs ‘process_input()’ but ‘createImageObject()’ and ‘defineOutput()’ as well to fully setup all inputs for use with the rest of the MultiDrizzle steps either as stand-alone tasks or internally to MultiDrizzle itself.
- Parameters:
- configObjobject
configObj instance or simple dictionary of input parameters
- createOutwcsbool
whether of not to update the output WCS infomation
- overwrite_dict: dict
dictionary of user input paramters to overwrite in configObj (needed in particular for using mdriztab=True option)
Notes
- At a minimum, the configObj instance (dictionary) should contain:
configObj = {‘input’:None,’output’:None }
If provided, the configObj should contain the values of all the multidrizzle parameters as set by the user with TEAL. If no configObj is given, it will retrieve the default values automatically. In either case, the values from the input_dict will be merged in with the configObj before being used by the rest of the code.
Examples
You can set createOutwcs=False for the cases where you only want the images processed and no output wcs information in necessary; as in:
>>> imageObjectList,outwcs = processInput.processCommonInput(configObj)
- drizzlepac.processInput.update_member_names(oldasndict, pydr_input)[source]
Update names in a member dictionary.
Given an association dictionary with rootnames and a list of full file names, it will update the names in the member dictionary to contain ‘_*’ extension. For example a rootname of ‘u9600201m’ will be replaced by ‘u9600201m_c0h’ making sure that a MEf file is passed as an input and not the corresponding GEIS file.