Skip to content

Commit

Permalink
Use target_offset from proseco
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed May 19, 2020
1 parent 037696a commit a79241b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
4 changes: 1 addition & 3 deletions sparkles/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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*.
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions sparkles/roll_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
12 changes: 4 additions & 8 deletions sparkles/tests/test_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -362,22 +361,19 @@ 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)
kw_or['obsid'] = 1
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(
Expand Down

0 comments on commit a79241b

Please sign in to comment.