API docs¶
acis_obs¶
guidelines¶
- chandra_limits.guidelines.read_chandra_models_effective_dates(data_dir: str | Path | None = None) dict[source]¶
Read the effective dates for all the chandra_models releases.
The effective date is the date of the first weekly load products to use the release.
This reads the JSON file
{data_dir}/version_date_eff.jsonwith the chandra_models effective dates.If
data_diris not provided, the file is read from the CXC website.- Parameters:
- data_dirstr or Path, optional
Root directory for the guidelines data files. If not provided the file is read from the CXC website.
- Returns:
- dict
Dict of
{version: effective date}for each release in chandra_models.
- chandra_limits.guidelines.read_chandra_models_limit_history(data_dir: str | Path | None = None) dict[source]¶
Read the limit history dict from the JSON file containing the limit history.
This reads the JSON file
{data_dir}/limit_values.jsonwith the chandra_models limit history. This does not deal with manual changes, only the chandra_models updates. Manual changes are integrated in the limit history by the functionget_limit_changes().If
data_diris not provided, the file is read from the CXC website.See get_chandra_models_limit_history_from_repo() for details on the data structure.
- Parameters:
- data_dirstr or Path, optional
Root directory for the guidelines data files. If not provided the file is read from the CXC website.
- Returns:
- dict
Dictionary of limit changes in chandra_models by
msidandmodel_name.
- chandra_limits.guidelines.read_chandra_models_limit_history_by_msid(msid: str, data_dir: str | Path | None = None) Table[source]¶
Read the limit history for a specific MSID.
This reads the Table file
{data_dir}/limit_history/{msid}.datin the chandra_models limit history and returns the limit history for the specified MSID.If
data_diris not provided, the file is read from the CXC website.- Parameters:
- msidstr
MSID for which to read the limit history.
- data_dirstr or Path, optional
Root directory for the guidelines data files. If not provided the file is read from the CXC website.
- Returns:
- Table
Table of limit changes for the specified MSID.
- chandra_limits.guidelines.read_history_sources(msid: str, data_dir: str | Path | None = None) Table[source]¶
Read table of history sources for MSID.
- Parameters:
- msidstr
MSID for which to read the history sources.
- data_dirstr or Path, optional
Root directory for the guidelines data files. If not provided the file is read from the CXC website.
- Returns:
- Table
Table of history sources for the specified MSID.
- chandra_limits.guidelines.read_manual_inputs(msid: str, data_dir: str | Path | None = None) Table[source]¶
Read table of manual guideline history inputs for MSID.
- Parameters:
- msidstr
MSID for which to read the manual inputs.
- data_dirstr or Path, optional
Root directory for the guidelines data files. If not provided the file is read from the CXC website.
- Returns:
- Table
Table of manual guideline history inputs for the specified MSID.
thermal.base¶
- class chandra_limits.thermal.base.ACALimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking ACA limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- alt_names = {'planning.penalty.high': 'penalty_hi', 'planning.warning.high': 'planning_hi'}¶
- class chandra_limits.thermal.base.CEALimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking CEA limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- alt_names = {'odb.caution.high': 'yellow_hi', 'planning.warning.high': 'planning_hi'}¶
- class chandra_limits.thermal.base.LimitLine(msid, units, limit_info, which, margin, names, alt_names)[source]¶
Bases:
objectLimitLine object which characterizes a single limit line as a function of time. This class also contains information about the reason for the limit. This class will never be called independently, but will always be constructed by ThermalLimit.get_limit_line
- Parameters:
- msidstring
The MSID that this limit corresponds to.
- unitsstring
The units of the temperature for this limit, “degC” or “degF”.
- timesNumPy array
An array of seconds (defined as cxcsec) that the limit is defined at.
- valuesNumPy array
An array of floats which corresponds to the limit at the given times.
- reasonsNumPy array of strings
An array of strings giving the reason for the limit value at each given time.
- whichstring
Whether this is a “high” or “low” limit.
- marginfloat
The allowed margin over/under the limit before a violation is flagged.
- namesNumPy array of strings
The possible options for the limit reasons.
- alt_namesdict
Alternative, shorter names for the limit reasons.
- check_violations(model, start_time=None)[source]¶
Check violations of a limit against a specific thermal model run.
- Parameters:
- modelXijaModel object
The thermal model run which will be used to check violations of.
- start_timeCxoTime input, optional
The time after which to check for violations. If not specified, the time will be the beginning of the limit line.
- Returns:
- list of dicts
Each dictionary in the list contains the start time of the violation, the stop time of the violation, the duration of the violation, and the maximum or minimum temperature of the violation
- plot(use_colors=False, show_changes=True, fig_ax=None, figsize=(10, 10), no_label=False, **kwargs)[source]¶
Plot the limit line.
- Parameters:
- use_colorsboolean, optional
Whether or not to use different colors for the different limit lines. If not, a single color will be used. Default: False
- show_changesboolean, optional
Whether or not to show the changes in the limit line with a dashed gray line, if use_colors is True. No effect if use_colors is False. Default: True
- fig_axtuple of (Figure, Axes)
A Matplotlib Figure and Axes instance to use when plotting the line. If unspecified, a new Figure and Axes will be created and returned by the method. Default: None
- figsize2-tuple of ints
The (width, height) of the figure in inches. Only used if fig_ax is None. Default: (10,10)
- no_labelboolean, optional
If True, don’t automatically show a label for the line if use_colors = True. Default: False
- kwargs
All other keyword arguments are passed to plot_cxctime.
- Returns:
- A tuple containing the Matplotlib (Figure, Axes) used.
- property plotting_values¶
- class chandra_limits.thermal.base.ThermalLimit(msid, model_spec=None, margin=0.04999)[source]¶
Bases:
objectBase class for defining individual ThermalLimit objects for a given xija thermal model. These objects can be used to obtain thermal limit lines as a function of time for individual models.
This object will normally be subclassed.
- Parameters:
- msidstring
The MSID name corresponding to this thermal limit.
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- alt_names = {'odb.caution.high': 'yellow_hi', 'odb.warning.high': 'red_hi', 'planning.warning.high': 'planning_hi'}¶
- get_limit_line(states, which='high')[source]¶
Obtain a LimitLine object from a set of commanded states and an optional set of times at which the limit will be evaluated at.
- Parameters:
- stateskadi CommandTable or NumPy structured array
The commanded states to be used to help construct the limit line.
- whichstring, optional
Which limit to evaluate, the “high” or “low” limit. Default: “high”
thermal.acis¶
- class chandra_limits.thermal.acis.ACISFPLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking ACIS FP limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- alt_names = {'planning.data_quality.high.acis_0': 'acis_0', 'planning.data_quality.high.acis_1': 'acis_1', 'planning.data_quality.high.acis_2': 'acis_2', 'planning.data_quality.high.cold_ecs': 'cold_ecs', 'planning.data_quality.high.grating_0': 'grating_0', 'planning.data_quality.high.grating_1': 'grating_1', 'planning.warning.high': 'planning_hi', 'safety.caution.high': 'yellow_hi'}¶
- set_obs_info(obs_list, orlist=None, cfg_file=None, dat_file=None)[source]¶
Set the observation info to determine the limit line.
- Parameters:
- obs_listdict of lists
Dictionary of lists of obsids, startScience, and stopScience commands.
- orlist: string or Path object, optional
Path to an OR list file to obtain information about observations. If not specified, this information will be obtained from the obscat.
- cfg_filestring or Path object, optional
The ACIS tables CFG file to use. Default is “current.cfg”.
- dat_filestring or Path object, optional
The ACIS tables CFG file to use. Default is “current.dat”.
- class chandra_limits.thermal.acis.BEPPCBLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
DPABoardLimitClass for checking BEP PCB limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.DEALimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking 1DEAMZT limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.DPALimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking 1DPAMZT limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.DPAMYTLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking 1DPAMYT limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.FEP1ActelLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
DPABoardLimitClass for checking FEP1 Actel limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.FEP1MongLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
DPABoardLimitClass for checking FEP1 Mongoose limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999
- class chandra_limits.thermal.acis.PSMCLimit(model_spec=None, margin=0.04999)[source]¶
Bases:
ThermalLimitClass for checking 1PDEAAT limit violations
- Parameters:
- model_specstring or Path object, optional
The thermal model specification file to use when obtaining the limits. If not specified, the one from the chandra_models repository will be used.
- marginfloat, optional
Allowed extra margin for this model above/below a planning limit, in the temperature units of the model. Default: 0.04999