# Base ImageObject Classes¶

A class which makes image objects for each input filename.

A class which makes image objects for each input filename.

class drizzlepac.imageObject.baseImageObject(filename)[source]

Bases: object

Base ImageObject which defines the primary set of methods.

buildERRmask(chip, dqarr, scale)[source]

Builds a weight mask from an input DQ array and an ERR array associated with the input image.

buildEXPmask(chip, dqarr)[source]

Builds a weight mask from an input DQ array and the exposure time per pixel for this chip.

buildIVMmask(chip, dqarr, scale)[source]

Builds a weight mask from an input DQ array and either an IVM array provided by the user or a self-generated IVM array derived from the flat-field reference file associated with the input image.

buildMask(chip, bits=0, write=False)[source]

Build masks as specified in the user parameters found in the configObj object.

We should overload this function in the instrument specific implementations so that we can add other stuff to the badpixel mask? Like vignetting areas and chip boundries in nicmos which are camera dependent? these are not defined in the DQ masks, but should be masked out to get the best results in multidrizzle.

clean()[source]

Deletes intermediate products generated for this imageObject.

close()[source]

Close the object nicely and release all the data arrays from memory YOU CANT GET IT BACK, the pointers and data are gone so use the getData method to get the data array returned for future use. You can use putData to reattach a new data array to the imageObject.

findExtNum(extname=None, extver=1)[source]

Find the extension number of the give extname and extver.

find_DQ_extension()[source]

Return the suffix for the data quality extension and the name of the file which that DQ extension should be read from.

getAllData(extname=None, exclude=None)[source]

This function is meant to make it easier to attach ALL the data extensions of the image object so that we can write out copies of the original image nicer.

If no extname is given, the it retrieves all data from the original file and attaches it. Otherwise, give the name of the extensions you want and all of those will be restored.

Ok, I added another option. If you want to get all the data extensions EXCEPT a particular one, leave extname=NONE and set exclude=EXTNAME. This is helpfull cause you might not know all the extnames the image has, this will find out and exclude the one you do not want overwritten.

getData(exten=None)[source]

Return just the data array from the specified extension fileutil is used instead of fits to account for non- FITS input images. openImage returns a fits object.

getExtensions(extname='SCI', section=None)[source]

Return the list of EXTVER values for extensions with name specified in extname.

getGain(exten)[source]
getHeader(exten=None)[source]

Return just the specified header extension fileutil is used instead of fits to account for non-FITS input images. openImage returns a fits object.

getInstrParameter(value, header, keyword)[source]

This method gets a instrument parameter from a pair of task parameters: a value, and a header keyword.

The default behavior is:
• if the value and header keyword are given, raise an exception.
• if the value is given, use it.
• if the value is blank and the header keyword is given, use the header keyword.
getKeywordList(kw)[source]

Return lists of all attribute values for all active chips in the imageObject.

getNumpyType(irafType)[source]

Return the corresponding numpy data type.

getOutputName(name)[source]

Return the name of the file or PyFITS object associated with that name, depending on the setting of self.inmemory.

getReadNoiseImage(chip)[source]

Notes

Method for returning the readnoise image of a detector (in electrons).

The method will return an array of the same shape as the image.

Units: electrons
getdarkcurrent()[source]

Notes

Return the dark current for the detector. This value will be contained within an instrument specific keyword. The value in the image header will be converted to units of electrons.

Units: electrons
getdarkimg(chip)[source]

Notes

Return an array representing the dark image for the detector.

The method will return an array of the same shape as the image.

Units: electrons
getexptimeimg(chip)[source]
Returns: exptimeimg : numpy array The method will return an array of the same shape as the image.

Notes

Return an array representing the exposure time per pixel for the detector. This method will be overloaded for IR detectors which have their own EXP arrays, namely, WFC3/IR and NICMOS images.

Units: None
getflat(chip)[source]

Method for retrieving a detector’s flat field.

Returns: flat: array This method will return an array the same shape as the image in units of electrons.
getskyimg(chip)[source]

Notes

Return an array representing the sky image for the detector. The value of the sky is what would actually be subtracted from the exposure by the skysub step.

Units: electrons
info()[source]

Return fits information on the _image.

putData(data=None, exten=None)[source]

Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto….this method is an attempt to make sure that when you add an array back to the .data section of the hdu it still matches the header information for that section ( ie. update the bitpix to reflect the datatype of the array you are adding). The other header stuff is up to you to verify.

Data should be the data array exten is where you want to stick it, either extension number or a string like ‘sci,1’

returnAllChips(extname=None, exclude=None)[source]

Returns a list containing all the chips which match the extname given minus those specified for exclusion (if any).

saveVirtualOutputs(outdict)[source]

Assign in-memory versions of generated products for this imageObject based on dictionary ‘outdict’.

set_mt_wcs(image)[source]

Reset the WCS for this image based on the WCS information from another imageObject.

set_units()[source]

Record the units for this image, both BUNITS from header and in_units as needed internally. This method will be defined specifically for each instrument.

set_wtscl(chip, wtscl_par)[source]

Sets the value of the wt_scl parameter as needed for drizzling.

updateContextImage(contextpar)[source]

Reset the name of the context image to None if parameter context is False.

updateData(exten, data)[source]

Write out updated data and header to the original input file for this object.

updateIVMName(ivmname)[source]

Update outputNames for image with user-supplied IVM filename.

updateOutputValues(output_wcs)[source]

Copy info from output WCSObject into outputnames for each chip for use in creating outputimage object.

class drizzlepac.imageObject.imageObject(filename, group=None, inmemory=False)[source]

This returns an imageObject that contains all the necessary information to run the image file through any multidrizzle function. It is essentially a PyFits object with extra attributes.

There will be generic keywords which are good for the entire image file, and some that might pertain only to the specific chip.

compute_wcslin(undistort=True)[source]

Compute the undistorted WCS based solely on the known distortion model information associated with the WCS.

setInstrumentParameters(instrpars)[source]

Define instrument-specific parameters for use in the code. By definition, this definition will need to be overridden by methods defined in each instrument’s sub-class.

set_units(chip)[source]

Define units for this image.

class drizzlepac.imageObject.WCSObject(filename, suffix='_drz')[source]
restore_wcs()[source]