WFI

class webbpsf.WFI[source]

Bases: RomanInstrument

WFI represents the Roman mission’s Wide Field Imager.

WARNING: This model has not yet been validated against other PSF

simulations, and uses several approximations (e.g. for mirror polishing errors, which are taken from HST).

Attributes Summary

detector

Detector selected for simulated PSF

filter

Currently selected filter name (e.g.

mode

The current WFI mode.

pupil

The path to the FITS file containing pupil information for the detector/filter combination sent from the WFI class.

pupil_mask

The corresponding mask for the current filter.

Methods Summary

lock_aberrations(aberration_path)

This function loads user provided aberrations from a file and locks this instrument to only use the provided aberrations (even if the filter or mode change).

lock_pupil(pupil_path)

Prevents dynamic updates of the path to the proper pupil file on any changes to the selected detector or filter.

lock_pupil_mask(pupil_mask)

Prevents dynamic updates of the pupil mask on any change to the selected filter.

unlock_aberrations()

Releases the lock on the detector aberration file location and loads the default file.

unlock_pupil()

Undoes the effects of lock_pupil() by resetting the class to its default state of updating the pupil whenever a detector or filter is changed.

unlock_pupil_mask()

Undoes the effects of lock_pupil_mask() and resets the class to its default state of updating the pupil mask whenever the filter is changed.

Attributes Documentation

detector

Detector selected for simulated PSF

Used in calculation of field-dependent aberrations. Must be selected from detectors in the detector_list attribute.

filter

Currently selected filter name (e.g. F200W)

mode

The current WFI mode. Cannot be directly set by the user.

pupil

Filename or fits.HDUList for the pupil mask.

pupil_mask

The corresponding mask for the current filter. Cannot be directly set by the user.

Methods Documentation

lock_aberrations(aberration_path)[source]

This function loads user provided aberrations from a file and locks this instrument to only use the provided aberrations (even if the filter or mode change).

To release the lock and load the default aberrations, use unlock_aberrations(). To load new user provided aberrations, call this function with the new path.

To load custom aberrations, please provide a csv file containing the detector names, field point positions and Zernike values. The file should contain the following column names/values (comments in parentheses should not be included):

  • sca (Detector number)

  • wavelength (µm)

  • field_point (field point number/ID for SCA and wavelength,

starts with 1) - local_x (mm, local detector coords) - local_y (mm, local detector coords) - global_x (mm, global instrument coords) - global_y (mm, global instrument coords) - axis_local_angle_x (XAN) - axis_local_angle_y (YAN) - wfe_rms_waves (nm) - wfe_pv_waves (waves) - Z1 (Zernike phase NOLL coefficients) - Z2 (Zernike phase NOLL coefficients) - Z3 (Zernike phase NOLL coefficients) - Z4 (Zernike phase NOLL coefficients)

.

Please refer to the default aberration files for examples. If you have the WebbPSF data installed and defined, you can get the path to that file by running the following:

>>> from webbpsf import roman
>>> wfi = roman.WFI()
>>> print(wfi._aberration_files["imaging"])

Warning: You should not edit the default files!

lock_pupil(pupil_path)[source]

Prevents dynamic updates of the path to the proper pupil file on any changes to the selected detector or filter. Instead, the path remains locked on whichever pupil_path was provided here.

WARNING: This is non-standard usage of the WFI class and may lead to unexpected behavior.

Parameters:
pupil_pathstring

The custom path to your pupil file.

lock_pupil_mask(pupil_mask)[source]

Prevents dynamic updates of the pupil mask on any change to the selected filter. Instead, the pupil mask remains locked on whichever pupil_mask was provided here.

WARNING: This is non-standard usage of the WFI class and may lead to unexpected behavior.

Parameters:
filterstring

See WFI.pupil_mask_list for a list of valid pupil masks.

unlock_aberrations()[source]

Releases the lock on the detector aberration file location and loads the default file.

unlock_pupil()[source]

Undoes the effects of lock_pupil() by resetting the class to its default state of updating the pupil whenever a detector or filter is changed. If necessary, it also sets the proper pupil for the current detector/filter combination.

unlock_pupil_mask()[source]

Undoes the effects of lock_pupil_mask() and resets the class to its default state of updating the pupil mask whenever the filter is changed.