Skip to content

Commit

Permalink
Print out the exposure times of observations which have violations
Browse files Browse the repository at this point in the history
  • Loading branch information
jzuhone committed Nov 13, 2023
1 parent d1150df commit 65454b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 8 additions & 1 deletion acis_thermal_check/apps/acisfp_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ def make_prediction_viols(self, temps, states, load_start):
obs_table = self.limit_object.acis_obs_info.as_table()
idxs = np.where(CxoTime(obs_table["start_science"]).secs > load_start)[0]
self.acis_and_ecs_obs = obs_table[idxs]

for v in viols["hi"]:
idx = np.where(self.acis_and_ecs_obs["obsid"] == v["obsid"])[0]
if idx.size == 0:
continue
row = self.acis_and_ecs_obs[idx[0]]
start_science = CxoTime(row["start_science"]).secs
stop_science = CxoTime(row["stop_science"]).secs
v["exp_time"] = (stop_science - start_science) * 1.0e-3
return viols, upper_limit, lower_limit

def write_temps(self, outdir, times, temps):
Expand Down
14 changes: 9 additions & 5 deletions acis_thermal_check/templates/index_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ States `<states.dat>`_
{{proc.msid}} {{viol_type}} Violations
---------------------------------------------------
{% if proc.msid == "FPTEMP" %}
===================== ===================== ================= ======================= ==================
Date start Date stop Duration (ks) Max Temperature / Limit Obsid
===================== ===================== ================= ======================= ==================
===================== ===================== ======================== ======================= ==================
Date start Date stop Duration / Exposure (ks) Max Temperature / Limit Obsid
===================== ===================== ======================== ======================= ==================
{% for viol in viols[key] %}
{{viol.datestart}} {{viol.datestop}} {{"{:3.2f}".format(viol.duration).rjust(8)}} {{"%.2f"|format(viol.extemp)}} / {{"%.2f"|format(viol.limit[0])}} {{viol.obsid}}
{% if viol.obsid == -1 %}
{{viol.datestart}} {{viol.datestop}} {{"{:3.2f}".format(viol.duration)}} / N/A {{"%.2f"|format(viol.extemp)}} / {{"%.2f"|format(viol.limit[0])}} N/A
{% else %}
{{viol.datestart}} {{viol.datestop}} {{"{:3.2f}".format(viol.duration)}} / {{"{:3.2f}".format(viol.exp_time)}} {{"%.2f"|format(viol.extemp)}} / {{"%.2f"|format(viol.limit[0])}} {{viol.obsid}}
{% endif %}
{% endfor %}
===================== ===================== ================= ======================= ==================
===================== ===================== ======================== ======================= ==================
{% else %}
===================== ===================== ================= ===============================
Date start Date stop Duration (ks) {{extreme}} Temperature / Limit
Expand Down
6 changes: 3 additions & 3 deletions acis_thermal_check/tests/acisfp/answers/MAY0922A_viol.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"-94.38"
],
"obsids": [
"-1",
"N/A",
"23827",
"23816",
"-1",
"N/A",
"23867",
"-1"
"N/A"
]
}

0 comments on commit 65454b1

Please sign in to comment.