WFC3IRHandler

class one_pass_fitting.data_handlers.WFC3IRHandler(image, catalog)

Bases: ImageHandler

ImageHandler subclass for HST WFC3/IR

Methods Summary

calc_encircled_corr()

calculate_apcorr([radius, sky_in, sky_out, ...])

Calculate the aperture correction for photometric measurements.

calculate_area_corr()

For each position in catalog, return the correction factor for pixel area

convert_mags()

Converts flux values in the catalog to ABMag and STMag.

correct_catalog([aperture, pixel_area, ...])

Applies various corrections to catalogs, and calculates physical mags.

ee_func()

make_area_array()

Creates pixel area array from 2D polynomial

update_sky_coords()

Updates the RA and Dec columns in self.catalog to be consistent with self.wcs

Methods Documentation

calc_encircled_corr()
calculate_apcorr(radius: float | None = None, sky_in=None, sky_out=None, sky_stat='mode')

Calculate the aperture correction for photometric measurements.

This method calculates the scalar offset between the PSF fit fluxes and aperture photometry measurements at the provided aperture/annulus radii. This is necessary to calibrate the PSF fluxes. It is recommended that radius be equal to an aperture where the PSF and thus encircled energy are known to be stable, e.g. 0.4” for WFC3

Parameters:

radiusfloat, optional

The radius of the circular aperture used for photometry.

sky_infloat or None, optional

The inner radius of the annulus for sky background estimation. If None, it is set to 2 * radius.

sky_outfloat or None, optional

The outer radius of the annulus for sky background estimation. If None, it is set to 3 * radius.

sky_statstr, optional

The statistic to use for sky background estimation, one of “mean”, “median” or “mode”.

Returns:

None

Notes:

  • This method calculates the aperture correction by comparing the instrumental magnitudes to

calibrated magnitudes of stars in the catalog. - The computed aperture correction is stored in the object’s ap_corr attribute.

Example:

# Create an ImageHandler object and calculate the aperture correction img_hand = ImageHandler(image, catalog) img_hand.calculate_apcorr(radius=1.0, sky_stat=”mode”) # The aperture correction is now available as img_phot.ap_corr.

calculate_area_corr()

For each position in catalog, return the correction factor for pixel area

convert_mags()

Converts flux values in the catalog to ABMag and STMag.

This method applies scaling factors and zeropoints to convert the fluxes measured in the image to ABMag and STMag units. It handles various starting units for HST and JWST data and performs necessary calculations to obtain the final magnitudes.

Notes

  • For HST data with units in ELECTRONS, the method corrects for exposure time and applies inverse sensitivity factors to convert flux to STMag, then converts to ABMag

  • For HST data with units in ELECTRONS/s, the method applies inverse sensitivity factors to convert flux to STMag, then converts to ABMag

  • For JWST data with units in MJy/sr, the method calculates first ABMag using pixel area (in steradians) to convert to Jy, then to ABMag, and then to STMag.

  • For unit conversion definitions see here https://www.stsci.edu/hst/instrumentation/acs/data-analysis/zeropoints#section-c5a9e052-dcf3-4b57-b783-5c66578b479c

Warning

This method modifies the ‘ST’ and ‘AB’ columns in the catalog in-place.

correct_catalog(aperture=False, pixel_area=False, encircled=False, **kwargs)

Applies various corrections to catalogs, and calculates physical mags.

Depending on the PSF model used when generating the catalogs, certain corrections need to be applied in order to 1) remove systematic offsets between fits from different images, and 2) photometrically calibrate them. For instance the if the PSF model is normalized at a radius of 5.5 pixels, then the fit fluxes do not account for the light outside of 5.5 pixels. This then requires an aperture correction to calibrate out. Furthermore, if combining catalogs from different regions of a detector, then the flux may be off by a factor of the pixel area. Lastly, for HST and JWST, the units of the image (and thus the measured flux from the PSF fit) are not physical flux units, and must be scaled by the appropriate factors. This function does these corrections.

The first (optional) correction is the aperture correction. This measures the aperture photometric flux for good sources in the image at a larger radius, and computes the correction factor between it and the PSF fit flux. This is needed when using Jay Anderson’s STDPSF models, as the tapering of these models to be 0 at some radius causes some flux to be left out. IF USING WEBBPSF MODELS THIS IS NOT NEEDED, SO aperture SHOULD REMAIN False. See calculate_apcorr for more info.

The next (optional) correction is the pixel area correction. This is necessary as the flatfielding step of the HST pipeline corrects images to make surface brightness flat across the image, which make point source fluxes show a spatial systematic. Puzzlingly, this is not needed when using WebbPSF models either? So keep pixel_area False for JWST catalogs if using Webb PSF Models. See calculate_area_corr for more info.

The third (optional) correction is the encircled energy correction. This is typically needed if doing the aperture correction above, as above a certain radius, it is difficult to measure the aperture correction (depending on crowding). This means the flux from the aperture correction radius out to infinity is left out from the flux. This correction relies upon pre-tabulated encircled energy tables, usually provided by the instrument team, and accounts for all the remaining flux outside of the aperture correction radius. Since these models are often unreliable at small radii, we must measure the aperture correction in the image out to some radius, and then apply this correction to account for all the light. encircled SHOULD ALSO BE False IF USING WEBBPSF MODELS. See calc_encircled_corr for details.

The last correction is the correction to ST and AB mag systems. This is pretty much just applying zeropoints and unit conversion. Vegamag will come soon. See convert_mags for details.

Parameters:

aperturebool, optional

Perform the intermediate aperture correction? Default False

pixel_areabool, optional

Perform the pixel area correction? Default False

encircledbool, optional

Perform the intermediate aperture to infinite aperture correction? Default False

**kwargsoptional

Keyword arguments to be passed to aperture correction. See calculate_apcorr for details

Returns:

None

ee_func()
make_area_array()

Creates pixel area array from 2D polynomial

update_sky_coords()

Updates the RA and Dec columns in self.catalog to be consistent with self.wcs