acdc.predict_dark_level

Given COS science datasets, compare the background regions in the science exposures to a low/quiescent and high/active superdark.

Command line-arguments:
-d or –datatdir

The path to science corrtags

--hv

If datadir contains corrtags of multiple HVs, you can use –hv to use just one specific HV value.

--segment

If datadir contains corrtags of multiple segments, you can use –segment to use just one specific segment.

--lo

The name of the low activity superdark.

--hi

The name of the high activity superdark.

-o or –outdir

The name of the output directory where products will be written.

--binned

Using this argument indicates that the supplied superdarks are already binned and should not be binned any further.

Functions

bin_science

Given a corrtag with lists of events as a function of X, Y, and PHA, bin the data into an image using the same bin sizes as the superdark.

c_stat

TODO document

check_existing

check_superdarks

Ensure all input superdarks were binned with identical bin sizes.

fun_opt

TODO- fill in

get_binning_pars

Return spatial and PHA binning information for a superdark.

linear_combination

Scale and combine superdarks.

measure_gsag

predict_dark

Model the superdark for each input science corrtag.

bin_science(corrtag, b, fact=1, exclude_airglow=False)[source]

Given a corrtag with lists of events as a function of X, Y, and PHA, bin the data into an image using the same bin sizes as the superdark.

Parameters:
  • corrtag (str) – Corrtag to bin.

  • b (dict) – Dictionary that describes the binning information in both the spatial and PHA dimensions. (Only spatial is used)

Returns:
  • binned (array) – Binned science image.

  • nevents (array) – Number of events in each binned pixel.

c_stat(combined_dark, binned_sci, excluded_rows)[source]

TODO document

Parameters:
  • combined_ark (array) – Scaled and combined model superdark.

  • binned_sci (array) – Binned science image.

  • excluded_rows (array) – List of rows to exclude. Corresponds to the PSA and WCA regions.

Returns:

csum (float) – TODO

check_superdarks(binned_superdarks)[source]

Ensure all input superdarks were binned with identical bin sizes.

Parameters:

binned_superdarks (list or array-like) – List of binned superdarks.

fun_opt(coeffs, darks, binned_sci, excluded_rows)[source]

TODO- fill in

Parameters:
  • coeffs (list) – The output coefficients.

  • darks (list) – A list of all superdarks to model, typicall [quiescent_dark, active_dark].

  • binned_sci (array) – Binned science image.

  • excluded_rows (array) – List of rows to exclude from modeling. Correspond to the PSA and WCA regions.

Returns:

cval (list) – Coefficients? TODO

get_binning_pars(af)[source]

Return spatial and PHA binning information for a superdark.

Parameters:

af (AsdfFile) – ASDF file to extract binning information from.

Returns:

binning (dict) – Dictionary that describes the binning information in both the spatial and PHA dimensions.

linear_combination(darks, coeffs)[source]

Scale and combine superdarks.

Scale multiple superdarks (typically 1 quiescent and 1 active superdark), then add them together to create a scaled model superdark for a particular science exposure.

Parameters:
  • darks (list) – List of superdark images to scale and combine.

  • coeffs (list) – List of scale factors to apply to each superdark.

Returns:

combined (array) – Scaled and combined model superdark.

predict_dark(corrtags, superdarks, segment=None, hv=None, outdir='.', binned=False, overwrite=False, exclude_airglow=False, x_bin=12, y_bin=20)[source]

Model the superdark for each input science corrtag.

Use the active and quiescent superdarks of the appropriate segment+HV combination to determine the best predicted superdark model for each science corrtag.

Parameters:
  • corrtags (list or array-like) – Predict the model superdark for these corrtags.

  • superdarks (list or array-like) – Superdarks to use for modeling.

  • segment (str) – (Optional) Process corrtags of this segment only.

  • hv (str) – (Optional) Process corrtags of this HV only.

  • outdir (str) – (Optional) Output directory to write products and plots. Default is current working directory.

  • binned (Bool) – (Optional) If True, indicates input superdarks are already binned. If False, input superdarks will be binned on the fly.

  • overwrite (Bool) – If True, overwrite any pre-existing products.