chandra_aca.dark_model

Routines related to the Chandra ACA dark current models.

The canonical model for ACA dark current is a based on smoothed twice-broken power-law fits of dark current histograms from Jan-2007 though Aug-2017. This analysis was done entirely with dark current maps scaled to -14 C.

See: /proj/sot/ska/analysis/dark_current_model/dark_model.ipynb and other files in that directory.

Alternatively: http://nbviewer.ipython.org/url/asc.harvard.edu/mta/ASPECT/analysis/dark_current_model/dark_model.ipynb

The dark_temp_scale_img method in this file uses a more recent 2023 approach with per-pixel scaling.

https://nbviewer.org/url/asc.harvard.edu/mta/ASPECT/analysis/dark_current_model/dark_model-2023.ipynb

chandra_aca.dark_model.dark_temp_scale(t_ccd, t_ccd_ref=-19.0, scale_4c=None)[source]

Calculate dark current scale factor.

Return the multiplicative scale factor to convert a CCD dark map or dark current value from temperature t_ccd to temperature t_ccd_ref:

scale = scale_4c ** ((t_ccd_ref - t_ccd) / 4.0)

In other words, if you have a dark current value that corresponds to t_ccd and need the value at a different temperature t_ccd_ref then use the the following. Do not be misled by the misleading parameter names.

>>> from chandra_aca.dark_scale import dark_temp_scale
>>> scale = dark_temp_scale(t_ccd, t_ccd_ref, scale_4c)
>>> dark_curr_at_t_ccd_ref = scale * dark_curr_at_t_ccd

The default value for scale_4c is 1.0 / 0.7. It is written this way because the equation was previously expressed using 1 / scale_4c with a value of 0.7. This value is based on best global fit for dark current model in plot_predicted_warmpix.py. This represents the multiplicative change in dark current for each 4 degC increase:

>>> dark_temp_scale(t_ccd=-18, t_ccd_ref=-10, scale_4c=2.0)
4.0
Parameters:
t_ccd

actual temperature (degC)

t_ccd_ref

reference temperature (degC, default=-19.0)

scale_4c

increase in dark current per 4 degC increase (default=1.0 / 0.7)

Returns:
scale factor
chandra_aca.dark_model.dark_temp_scale_img(img, t_ccd, t_ccd_ref)[source]

Get dark current taken at t_ccd scaled to reference temperature t_ccd_ref

This scales the dark current based on an exponential scaling factor that depends on the dark current value of each pixel. This is a more accurate way to scale dark current images than using a global scaling factor as in dark_temp_scale().

See the reference notebook at: https://nbviewer.org/url/asc.harvard.edu/mta/ASPECT/analysis/dark_current_model/dark_model-2023.ipynb

Parameters:
imgfloat, ArrayLike

Dark current image or value in e-/sec

t_ccdfloat

CCD temperature (degC) of the input image

t_ccd_reffloat

CCD temperature (degC) of the scaled output image

Returns:
float, np.ndarray

Dark current image scaled to t_ccd_ref

chandra_aca.dark_model.get_dark_hist(date, t_ccd)[source]

Return the dark current histogram corresponding to date and t_ccd.

Parameters:
date

date in any DateTime format

t_ccd

CCD temperature (deg C)

Returns:
bin_centers, bins, darkhist
chandra_aca.dark_model.get_sbp_pars(dates)[source]

Return smooth broken powerlaw parameters set(s) at dates.

This is based on the sbp fits for the darkhist_zodi_m14 histograms in /proj/sot/ska/analysis/dark_current_model/dark_model.ipynb.

The actual bi-linear fits (as a function of year) to the g1, g2, g3, x_b, and ampl parameters are derived from fits and by-hand inspection of fit trending.

This is only accurate for dates > 2007.0.

Parameters:
dates

one or a list of date(s) in DateTime compatible format

Returns:
one or a list of parameter lists [g1, g2, g3, x_b, ampl]
chandra_aca.dark_model.get_warm_fracs(warm_threshold, date='2013:001:12:00:00', T_ccd=-19.0)[source]

Calculate fraction of pixels in modeled dark current distribution above warm threshold(s).

Parameters:
warm_threshold

scalar or list of threshold(s) in e-/sec

date

date to use for modeled dark current distribution/histogram

T_ccd

temperature (C) of modeled dark current distribution

Returns:
list or scalar of warm fractions (depends on warm_threshold type)
chandra_aca.dark_model.smooth_broken_pow(pars, x)[source]

Smoothed broken power-law.

Pars are same as bpl1d (NOT + gaussian sigma): 1: gamma1 2: gamma2 3: x_b (break point) 4: x_r (normalization reference point) 5: ampl1

chandra_aca.dark_model.smooth_twice_broken_pow(pars, x)[source]

Smoothed twice-broken power-law.

Pars are same as bpl1d (NOT + gaussian sigma): 1: gamma1 2: gamma2 3: gamma3 4: x_b (break point) 5: ampl1

chandra_aca.dark_model.synthetic_dark_image(date, t_ccd_ref=None)[source]

Generate a synthetic dark current image corresponding to the specified date and t_ccd.

Parameters:
date

(DateTime compatible)

t_ccd_ref

ACA CCD temperature

chandra_aca.dark_model.temp_scalefac(T_ccd)[source]

Calculate scale factor.

Return the multiplicative scale factor to convert a CCD dark map from the nominal -19C temperature to the temperature T. Based on best global fit for dark current model in plot_predicted_warmpix.py. Previous value was 0.62 instead of 0.70.

If attempting to reproduce previous analysis, be aware that this is now calling chandra_aca.dark_model.dark_temp_scale and the value will be determined using the module DARK_SCALE_4C value which may differ from previous values of 1.0/0.70 or 1.0/0.62.