Roman PSF module
Classes and functions that are specific to the Nancy Grace Roman Space Telescope live in the sub-module piff.roman. They include the following:
- class piff.roman.RomanOpticsPSF(model, interp, outliers=None, chisq_thresh=0.1, min_iter=2, max_iter=30)[source]
A PSF wrapper for Roman optical fits with configurable aberration interpolation.
- property fit_center
Whether to fit the center of the star in reflux.
This is generally set in the model specifications. If all component models includes a shift, then this is False. Otherwise it is True.
- property include_model_centroid
Whether a model that we want to center can have a non-zero centroid during iterations.
- initialize_params(stars, logger=None, default_init=None)[source]
Initialize the psf solver to begin an iterative solution.
- Parameters:
stars – The initial list of Star instances that will be used to constrain the PSF.
logger – A logger object for logging progress. [default: None]
default_init – The default initilization method if the user doesn’t specify one. [default: None]
- Returns:
the initialized stars, nremoved
- interpolateStar(star, inplace=False)[source]
Update the star to have the current interpolated fit parameters according to the current PSF model.
- Parameters:
star – Star instance to update.
inplace – Whether to update the parameters in place, in which case the returned star is the same object as the input star. [default: False]
- Returns:
Star instance with its fit parameters updated.
- interpolateStarList(stars, inplace=False)[source]
Update the stars to have the current interpolated fit parameters according to the current PSF model.
- Parameters:
stars – List of Star instances to update.
inplace – Whether to update the parameters in place, in which case the returned stars are the same objects as the input stars. [default: False]
- Returns:
List of Star instances with their fit parameters updated.
- classmethod parseKwargs(config, base, logger)[source]
Parse the psf field of a configuration dict and return the kwargs to use for initializing an instance of the class.
The base class implementation just returns the kwargs as they are, but derived classes might want to override this if they need to do something more sophisticated with them.
- Parameters:
config – The psf field of the configuration dict, config[‘psf’]
base – The base configuration dict.
logger – A logger object for logging debug info. [default: None]
- Returns:
a kwargs dict to pass to the initializer
- set_context(wcs, pointing=None, bandpass=None)[source]
Attach shared runtime context to this PSF instance.
It is permissible for pointing to be None if the WCS is not Celestial. Also, bandpass may be None if the psf to be fit is not chromatic. If pointing or bandpass is None, the existing value is left unchanged.
- Parameters:
wcs – A dict of WCS solutions indexed by chipnum.
pointing – A galsim.CelestialCoord object giving the telescope pointing. [default: None]
bandpass – A galsim.Bandpass giving the observing bandpass. [default: None]
- set_num(num)[source]
If there are multiple components involved in the fit, set the number to use for this model.
- single_iteration(stars, logger, convert_funcs, draw_method)[source]
Perform a single iteration of the solver.
Note that some object might fail at some point in the fitting, so some objects can be flagged as bad during this step, prior to the outlier rejection step. This information is reported in the return tuple as nremoved.
- Parameters:
stars – The list of stars to use for constraining the PSF.
logger – A logger object for logging progress.
convert_funcs – An optional list of function to apply to the profiles being fit before drawing it onto the image. If not None, it should be the same length as stars.
draw_method – The method to use with the GalSim drawImage command. If None, use the default method for the PSF model being fit.
- Returns:
an updated list of all_stars, nremoved
- class piff.roman.RomanOpticalModel(chromatic=True, filter_name=None, max_zernike=22, aberration_interp='constant', nominal_interp='bilinear', aberration_prior_sigma=0.05, nproc=1, logger=None)[source]
Model a Roman PSF using GalSim’s built-in Roman optical model.
filter_nameaccepts Roman F names (F062, F087, F106, F129, F146, F158, F184, F213) or GalSim names (R062, Z087, Y106, J129, W146, H158, F184, K213). If omitted, the name is inferred from the bandpass. Roman names are converted to GalSim names internally.The expensive GalSim Roman PSF construction is approximated across each SCA by evaluating PSFs at a small set of fixed sample points and interpolating between them at each star position.
nominal_interp='bilinear'uses the four SCA corners;'five_point'adds the SCA center and uses a five-term basis[1, x, y, x*y, (x^2+y^2)]in normalized coordinates.The
aberration_interpoption controls how the fitted extra aberrations vary across an SCA.'global'and'constant'both use one fitted aberration vector per SCA in the model, with'global'only changing how the outer interpolator shares those vectors across SCAs.'linear'fits a planar extra-aberration field on each SCA, modeled asa + b x + c yin normalized SCA coordinates.- draw(star, copy_image=True)[source]
Draw the model on the given image.
- Parameters:
star – A Star instance with the fitted parameters to use for drawing and a data field that acts as a template image for the drawn model.
copy_image – If False, will use the same image object. If True, will copy the image and then overwrite it. [default: True]
- Returns:
a new Star instance with the data field having an image of the drawn model.
- fit(star, logger=None, convert_func=None, draw_method=None)[source]
Fit the Model to the star’s data to yield iterative improvement on its PSF parameters, their uncertainties, and flux (and center, if free). The returned star.fit.alpha will be inverse covariance of solution if it is estimated, else is None.
- Parameters:
star – A Star instance
convert_func – An optional function to apply to the profile being fit before drawing it onto the image. This is used by composite PSFs to isolate the effect of just this model component. [default: None]
- Returns:
New Star instance with updated fit information
- initialize(star, logger=None, default_init=None)[source]
Initialize a star to work with the current model.
- Parameters:
star – A Star instance with the raw data.
logger – A logger object for logging debug info. [default: None]
default_init – The default initilization method if the user doesn’t specify one. [default: None]
- Returns:
Star instance with the appropriate initial fit values
- class piff.roman.RomanSCAInterp(per_sca=True, logger=None)[source]
Interpolate Roman aberration vectors as constants per SCA.
- interpolate(star, logger=None, inplace=False)[source]
Perform the interpolation to find the interpolated parameter vector at some position.
- Parameters:
star – A Star instance to which one wants to interpolate
logger – A logger object for logging debug info. [default: None]
inplace – Whether to update the parameters in place, in which case the returned star is the same object as the input star. [default: False]
- Returns:
a Star instance holding the interpolated parameters
- property property_names
List of properties used by this interpolant.