Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add too-cold check for fid lights at acquisition #199

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sparkles/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from astropy.table import Column, Table
from chandra_aca.star_probs import guide_count
from chandra_aca.transform import mag_to_count_rate, snr_mag_for_t_ccd, yagzag_to_pixels
from cxotime import CxoTime
from jinja2 import Template
from proseco.catalog import ACATable
from proseco.core import MetaAttribute
Expand Down Expand Up @@ -1173,6 +1174,7 @@ def check_catalog(self):
self.check_dither()
self.check_fid_count()
self.check_include_exclude()
self.check_t_ccd_acq()

def check_guide_overlap(self):
"""
Expand Down Expand Up @@ -1351,6 +1353,27 @@ def check_include_exclude(self):

self.add_message("info", msg)

def check_t_ccd_acq(self):
"""
Check that the fid lights are in the current search boxes by a check on t_ccd_acq.
These tolerances apply to observations after the 2022:294 safe mode.
"""
if self.is_ER or CxoTime(self.date).date < "2022:294":
return

t_ccd_acq = self.fids.t_ccd_acq

if t_ccd_acq <= -14.0:
self.add_message(
"critical",
f"Fid lights outside boxes (t_ccd_acq {t_ccd_acq:.1f} <= -14.0)",
)
elif t_ccd_acq <= -13.5:
self.add_message(
"caution",
f"Fid lights near box edge (t_ccd_acq {t_ccd_acq:.1f} <= -13.5)",
)

def check_guide_count(self):
"""
Check for sufficient guide star fractional count.
Expand Down
46 changes: 46 additions & 0 deletions sparkles/tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,52 @@ def test_n_guide_check_not_enough_stars():
]


@pytest.mark.parametrize(
"obsid, t_ccd_acq, date, expected_messages",
[
(5000, -5, "2023:001", []),
(5000, -19, "2019:001", []),
(
5000,
-13.62312,
"2023:001",
[
{
"text": "Fid lights near box edge (t_ccd_acq -13.6 <= -13.5)",
"category": "caution",
}
],
),
(
5000,
-14.1,
"2023:001",
[
{
"text": "Fid lights outside boxes (t_ccd_acq -14.1 <= -14.0)",
"category": "critical",
}
],
),
(40000, -15, "2023:001", []),
],
)
def test_too_cold(obsid, t_ccd_acq, date, expected_messages):
"""Test check_t_ccd_acq"""

stars = StarsTable.empty()
stars.add_fake_constellation(n_stars=5, mag=8.5)
aca = get_aca_catalog(
**mod_std_info(n_fid=3, n_guide=5, obsid=obsid, t_ccd_acq=t_ccd_acq, date=date),
stars=stars,
dark=DARK40,
raise_exc=True
)
acar = ACAReviewTable(aca)
acar.check_t_ccd_acq()
assert acar.messages == expected_messages

jeanconn marked this conversation as resolved.
Show resolved Hide resolved

def test_guide_is_candidate():
"""Test the check that guide star meets candidate star requirements

Expand Down