pynrc.reduce.calib.nircam_cal¶
- class pynrc.reduce.calib.nircam_cal(scaid, same_scan_direction=False, reverse_scan_direction=False, DMS=False, verbose=True)[source]¶
Bases:
pynrc.reduce.calib.nircam_dark
NIRCam Calibration class
Assumes that all cal files exist in the calibration directory in PYNRC_PATH.
- __init__(scaid, same_scan_direction=False, reverse_scan_direction=False, DMS=False, verbose=True)[source]¶
Methods
__init__
(scaid[, same_scan_direction, ...])calc_cds_noise
([cds_type, temperature, temp_key])Return CDS Noise components for each channel
Deconvolve the super dark and super bias images
get_cds_dict
([force])Calculate CDS noise for all files
get_column_variations
([force])Get column offset variations
get_dark_slope_image
([deg, force])Calculate dark slope image
get_effective_noise
([ideal_Poisson, force])Calculate effective noise curves for each readout pattern
get_ipc
([calc_ppc])Calculate IPC (and PPC) kernels
get_ktc_noise
(**kwargs)Calculate and store kTC (Reset) Noise
get_linear_coeffs
([deg, use_legendre, ...])Determine linearity coefficents
get_nonlinear_coeffs
([deg, use_legendre, ...])Determine non-linear coefficents
get_pixel_slope_averages
([force])Get average pixel ramp
get_power_spectrum
([include_oh, calc_cds, ...])- keyword include_oh
Zero-pad the data to insert line and frame overhead pixels?
get_ref_pixel_noise
([force])Generate Dictionary of Reference Pixel behavior info
get_super_bias_init
([deg, nsplit, force])get_super_bias_update
([force])get_super_dark_ramp
([force])Create or read super dark ramp and update super bias
get_super_flats
([split_low_high, smth_sig, ...])Get flat field information
plot_bias_darks
([save, return_figax, deconvolve])plot_cds_noise
([tkey, save, return_figax, xlim])plot_dark_distribution
([save, xlim, ...])Plot histogram of dark slope
plot_dark_overview
([save, xlim_hist, ...])Plot Overview of Dark Current Characteristics
plot_dark_ramps
([save, time_cut, return_figax])Plot average dark current ramps
plot_dark_ramps_ch
([save, time_cut, ...])Plot fits to each channel dark current ramp
plot_eff_noise
([ideal_Poisson, save, ...])Plot effective noise of slope fits
plot_eff_noise_patterns
([ideal_Poisson, ...])Plot effective noise of slope fits for variety of read patterns
plot_ipc_ppc
([k_ipc, k_ppc, save, return_figax])plot_power_spectrum
([save, cds, return_figax])plot_reset_overview
([save, binsize, ...])Overview Plots of Bias and kTC Noise
Attributes
allfiles
cds_act_dict
cds_ref_dict
Width of output channel
column_prob_bad
column_variations
dark_ramp_dict
Shape of dark ramps
datadir
eff_noise_dict
Fractional IPC value (alpha)
kernel_ipc
kernel_ppc
ktc_noise
lindir
linfiles
mask_act
mask_channels
mask_ref
Number of output channels
Number of output channels
outdir
pow_spec_dict
Fractional PPC value
ref_pixel_dict
super_bias
super_bias_deconv
super_dark
super_dark_deconv
super_dark_ramp
temperature_dict
time_arr
- calc_cds_noise(cds_type='spatial', temperature=None, temp_key='T_FPA1')¶
Return CDS Noise components for each channel
- Parameters
cds_type (str) – Return ‘spatial’, ‘temporal’, or ‘average’ noise values?
temperature (float or None) – Option to supply temperature at which to interpolate. If None is provided, then returns the median of all noise values.
temp_key (str) – Temperature key from self.temperature_dict to interpolate over. Generally, either ‘T_FPA1’ or ‘T_FPA2’ as those most closely represent the detector operating temperatures.
- property chsize¶
Width of output channel
- property dark_shape¶
Shape of dark ramps
- deconvolve_supers()¶
Deconvolve the super dark and super bias images
- get_cds_dict(force=False)¶
Calculate CDS noise for all files
Creates a dictionary of CDS noise components, including total noise, amplifier 1/f noise, correlated 1/f noise, white noise, and reference pixel ratios. Two different methods are used to calculate CDS per pixels: temporal and spatial.
Creates dictionary attributes self.cds_act_dict and self.cds_ref_dict.
- get_column_variations(force=False, **kwargs)¶
Get column offset variations
Create a series of column offset models. These are likely FETS in the ASIC preamp or ADC causing entire columns within a ramp to jump around.
- get_dark_slope_image(deg=1, force=False)¶
Calculate dark slope image
- get_effective_noise(ideal_Poisson=False, force=False)¶
Calculate effective noise curves for each readout pattern
- get_ipc(calc_ppc=False)¶
Calculate IPC (and PPC) kernels
- get_ktc_noise(**kwargs)¶
Calculate and store kTC (Reset) Noise
- Keyword Arguments
bias_sigma_arr (ndarray) – Image of the pixel uncertainties.
binsize (float) – Size of the histogram bins.
return_std (bool) – Also return the standard deviation of the distribution?
- get_linear_coeffs(deg=8, use_legendre=True, lxmap=[0, 100000.0], counts_cut=None, sat_calc=0.98, force=False, DMS=None, super_bias=None, **kwargs)¶
Determine linearity coefficents
These coefficients allow us to convert from an observed ramp (DN) to an idealized linear ramp (in e-). Values are stored in the dictionary self.linear_dict.
- Parameters
force (bool) – Force calculation of coefficients.
DMS (None or bool) – Option to specifiy if linearity files are DMS format. If set to None, then uses self.DMS.
super_bias (None or ndarray) – Option to specify an input super bias image. If not specified, then defaults to self.super_bias.
counts_cut (None or float) – Option to fit two sets of polynomial coefficients to lower and uppper values. ‘counts_cut’ specifies the division in values of electrons. Useful for pixels with different non-linear behavior at low flux levels. Recommended values of 15000 e-.
deg (int) – Degree of polynomial to fit. Default=8.
use_legendre (bool) – Fit with Legendre polynomial, an orthonormal basis set. Default=True.
lxmap (ndarray or None) – Legendre polynomials are normaly mapped to xvals of [-1,+1]. lxmap gives the option to supply the values for xval that should get mapped to [-1,+1]. If set to None, then assumes [xvals.min(),xvals.max()].
- get_nonlinear_coeffs(deg=8, use_legendre=True, lxmap=[0, 100000.0], counts_cut=15000, sat_calc=0.998, force=False, DMS=None, super_bias=None, **kwargs)¶
Determine non-linear coefficents
These coefficients allow us to go from an ideal linear ramp to some observed (simulated) non-linear ramp. Value are store in the self.nonlinear_dict dictionary.
- Parameters
force (bool) – Force calculation of coefficients.
DMS (None or bool) – Option to specifiy if linearity files are DMS format. If set to None, then uses self.DMS.
super_bias (None or ndarray) – Option to specify an input super bias image. If not specified, then defaults to self.super_bias.
counts_cut (None or float) – Option to fit two sets of polynomial coefficients to lower and uppper values. ‘counts_cut’ specifies the division in values of electrons. Useful for pixels with different non-linear behavior at low flux levels. Recommended values of 15000 e-.
deg (int) – Degree of polynomial to fit. Default=8.
use_legendre (bool) – Fit with Legendre polynomial, an orthonormal basis set. Default=True.
lxmap (ndarray or None) – Legendre polynomials are normaly mapped to xvals of [-1,+1]. lxmap gives the option to supply the values for xval that should get mapped to [-1,+1]. If set to None, then assumes [xvals.min(),xvals.max()].
- get_pixel_slope_averages(force=False)¶
Get average pixel ramp
- get_power_spectrum(include_oh=False, calc_cds=True, per_pixel=False, return_corr=False, return_ucorr=False, mn_func=<function mean>, force=False, save=True)¶
- Keyword Arguments
include_oh (bool) – Zero-pad the data to insert line and frame overhead pixels?
calc_cds (bool) – Power spectrum of CDS pairs or individual frames?
return_corr (bool) – Return power spectrum of channel correlated 1/f noise?
return_ucorr (bool) – Return power spectra of channel-dependent (uncorrelated) 1/f noise?
per_pixel (bool) – Calculate average power spectrum of each pixel along ramp (frame timescales)? If False, samples pixels within a frame (pixel read timescales).
- get_ref_pixel_noise(force=False, **kwargs)¶
Generate Dictionary of Reference Pixel behavior info
- get_super_dark_ramp(force=False, **kwargs)¶
Create or read super dark ramp and update super bias
- get_super_flats(split_low_high=True, smth_sig=10, force=False, **kwargs)¶
Get flat field information
Splits flat field into to lflats and pflats (low and high frequency).
- property ipc_alpha_frac¶
Fractional IPC value (alpha)
- property nchan¶
Number of output channels
- property nchans¶
Number of output channels
- plot_bias_darks(save=False, return_figax=False, deconvolve=False)¶
- plot_dark_distribution(save=False, xlim=None, return_figax=False)¶
Plot histogram of dark slope
- plot_dark_overview(save=False, xlim_hist=None, return_figax=False)¶
Plot Overview of Dark Current Characteristics
- plot_dark_ramps(save=True, time_cut=None, return_figax=False)¶
Plot average dark current ramps
- time_cutfloat
Some darks show distinct slopes before and after a characteristic time. Setting this keyword will fit separate slopes before and after the specified time. A time of 200 sec is used for SCA 485.
- plot_dark_ramps_ch(save=True, time_cut=None, return_figax=False)¶
Plot fits to each channel dark current ramp
- time_cutfloat
Some darks show distinct slopes before and after a characteristic time. Setting this keyword will fit separate slopes before and after the specified time. A time of 200 sec is used for SCA 485.
- plot_eff_noise(ideal_Poisson=False, save=False, return_figax=False)¶
Plot effective noise of slope fits
- plot_eff_noise_patterns(ideal_Poisson=False, save=False, ylim=None, return_figax=False)¶
Plot effective noise of slope fits for variety of read patterns
- plot_reset_overview(save=False, binsize=0.25, xlim_hist=None, return_figax=False)¶
Overview Plots of Bias and kTC Noise
- property ppc_frac¶
Fractional PPC value