From a79241b70e7d821b4e715e3e0ad2d67d069c142e Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Fri, 15 May 2020 18:58:16 -0400 Subject: [PATCH] Use target_offset from proseco --- sparkles/core.py | 4 +--- sparkles/roll_optimize.py | 5 ++--- sparkles/tests/test_review.py | 12 ++++-------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/sparkles/core.py b/sparkles/core.py index 146ec65..b713f3f 100644 --- a/sparkles/core.py +++ b/sparkles/core.py @@ -402,8 +402,6 @@ class ACAReviewTable(ACATable, RollOptimizeMixin): roll_options = MetaAttribute() roll_info = MetaAttribute() messages = MetaAttribute() - target_offset_y = MetaAttribute(default=0.0) - target_offset_z = MetaAttribute(default=0.0) def __init__(self, *args, **kwargs): """Init review methods and attrs in ``aca`` object *in-place*. @@ -548,7 +546,7 @@ def review_status(self): @property def att_targ(self): if not hasattr(self, '_att_targ'): - self._att_targ = self._calc_targ_from_aca(self.att, 0, 0) + self._att_targ = self._calc_targ_from_aca(self.att, *self.target_offset) return self._att_targ @property diff --git a/sparkles/roll_optimize.py b/sparkles/roll_optimize.py index dcfce59..22aacd7 100644 --- a/sparkles/roll_optimize.py +++ b/sparkles/roll_optimize.py @@ -166,8 +166,7 @@ def get_ids_list(roll_offsets): att_targ_rolled = Quat([att_targ.ra, att_targ.dec, att_targ.roll + roll_offset]) # Transform back to ACA pointing for computing star positions. - att_rolled = self._calc_aca_from_targ( - att_targ_rolled, self.target_offset_y, self.target_offset_z) + att_rolled = self._calc_aca_from_targ(att_targ_rolled, *self.target_offset) # Get yag/zag row/col for candidates yag, zag = radec_to_yagzag(cands['ra'], cands['dec'], att_rolled) @@ -183,7 +182,7 @@ def get_ids_list(roll_offsets): pitch = Ska.Sun.pitch(att.ra, att.dec, self.date) roll_nom = Ska.Sun.nominal_roll(att.ra, att.dec, self.date) att_nom = Quat([att.ra, att.dec, roll_nom]) - att_nom_targ = self._calc_targ_from_aca(att_nom, self.target_offset_y, self.target_offset_z) + att_nom_targ = self._calc_targ_from_aca(att_nom, *self.target_offset) roll_nom = att_nom_targ.roll if roll_dev is None: diff --git a/sparkles/tests/test_review.py b/sparkles/tests/test_review.py index 84d4dc4..1db9c02 100644 --- a/sparkles/tests/test_review.py +++ b/sparkles/tests/test_review.py @@ -217,7 +217,6 @@ def test_uniform_roll_options(): assert len(acar.roll_options) == 3 - def test_catch_exception_from_function(): exc = run_aca_review(raise_exc=False, load_name='non-existent load name fail fail') assert 'FileNotFoundError: no matching pickle file' in exc @@ -362,11 +361,12 @@ def test_get_roll_intervals(): # This uses the catalog at KWARGS_48464, but would really be better as a fully # synthetic test - obs_kwargs = KWARGS_48464 + obs_kwargs = KWARGS_48464.copy() + # Use these values to override the get_roll_intervals ranges to get more interesting + # outputs. + obs_kwargs['target_offset'] = (20 / 60., 30 / 60) # deg aca_er = get_aca_catalog(**obs_kwargs) acar_er = aca_er.get_review_table() - acar_er.target_offset_y = 20 / 60. - acar_er.target_offset_z = 30 / 60. kw_or = obs_kwargs.copy() # Set this one to have an OR obsid (and not 0 which is special) @@ -374,10 +374,6 @@ def test_get_roll_intervals(): aca_or = get_aca_catalog(**kw_or) acar_or = aca_or.get_review_table() - # Use these values to override the get_roll_intervals ranges to get more interesting - # outputs. y_off and z_off are really 0 everywhere for now from ORViewer though. - acar_or.target_offset_y = 20 / 60. - acar_or.target_offset_z = 30 / 60. roll_dev = 5 er_roll_intervs, er_info = acar_er.get_roll_intervals(