Analysis#
- class vampires_dpp.analysis.MetricInfo(category, comment, unit='', scalar=False)#
Registry entry describing how a metric should be written into FITS headers.
- Parameters:
category (str)
comment (str)
unit (str)
scalar (bool)
- class vampires_dpp.analysis.Moffat(x0, y0, gammax, gammay, theta, alpha, amplitude, background, **kwargs)#
- static evaluate(x, y, x0, y0, gammax, gammay, theta, alpha, amplitude, background)#
Evaluate the model on some input variables.
- static fit_deriv(x, y, x0, y0, gammax, gammay, theta, alpha, amplitude, background)#
- param_names = ('x0', 'y0', 'gammax', 'gammay', 'theta', 'alpha', 'amplitude', 'background')#
Names of the parameters that describe models of this type.
The parameters in this tuple are in the same order they should be passed in when initializing a model of a specific type. Some types of models, such as polynomial models, have a different number of parameters depending on some other property of the model, such as the degree.
When defining a custom model class the value of this attribute is automatically set by the ~astropy.modeling.Parameter attributes defined in the class body.
- vampires_dpp.analysis.add_coadd_metrics_to_header(hdul, metrics)#
Write scalar coadd-time metrics into the FITS headers.
Overrides any time-averaged values written earlier by add_metrics_to_header. Expects each metric to have shape
(nfields, npsfs). Unit strings in the comments are retuned to the currentBUNITso labels match the cube state after specphot calibration.- Return type:
HDUList- Parameters:
hdul (HDUList)
- vampires_dpp.analysis.add_metrics_to_header(hdul, metrics)#
Write per-field metric values into the primary HDU header.
Keys follow hierarch DPP <CATEGORY> <KEY> <FIELD> [<PSF#>]. Per-PSF values are written when a metric is multi-PSF; a field-aggregate (mean over PSFs of the time-mean) is also written without the PSF suffix. Unknown metric keys are skipped with a debug log so the registry stays explicit.
- Return type:
HDUList- Parameters:
hdul (HDUList)
- vampires_dpp.analysis.analyze_coadded_hdul(hdul, window_centers, psfs=None, *, aper_rad=8, ann_rad=None, window_size=21, do_phot=True, do_strehl=False, do_psf_model=False, psf_model='moffat')#
Measure scalar non-centroid stats on each (field, PSF window) of a coadded HDUList.
PSF positions follow the recenter convention: each PSF sits at
frame_center(field_frame) + window_offsets[field_idx, psf_idx]wherewindow_offsetsare the per-PSF offsets from the field’s mean window center. Returns a dict where each value has shape(nfields, npsfs).- Return type:
dict[str,ndarray]- Parameters:
hdul (HDUList)
aper_rad (float)
window_size (int)
do_phot (bool)
do_strehl (bool)
do_psf_model (bool)
psf_model (Literal['moffat'])
- vampires_dpp.analysis.analyze_window(frame, frame_err, center, *, aper_rad=8, ann_rad=None, window_size=21, do_phot=True, do_strehl=False, psf=None, do_psf_model=False, psf_model='moffat')#
Run non-centroid statistics on a single 2D frame at a known center.
Returns scalar values per metric. Used for measuring coadded frames where there is no time axis and the PSF position is already known.
- Return type:
dict[str,float]- Parameters:
aper_rad (float)
window_size (int)
do_phot (bool)
do_strehl (bool)
do_psf_model (bool)
psf_model (Literal['moffat'])
- vampires_dpp.analysis.find_norm_peak(image, center, window_size=20, phot_rad=8, oversamp=4)#
usage: peak = find_peak(image, xc, yc, boxsize) finds the subpixel peak of an image
image: an image of a point source for which we would like to find the peak xc, yc: approximate coordinate of the point source boxsize: region in which most of the flux is contained (typically 20) oversamp: how many times to oversample the image in the FFT interpolation in order to find the peak
- Return type:
float- Returns:
peak of the oversampled image
Marcos van Dam, October 2022, translated from IDL code of the same name