Skip to content

Commit

Permalink
Merge pull request #201 from sot/roll-update
Browse files Browse the repository at this point in the history
Update tests for ska_sun change to position_accurate
  • Loading branch information
jeanconn authored Dec 11, 2023
2 parents 72edbfa + ceb4086 commit 4d3c31d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 208 deletions.
210 changes: 42 additions & 168 deletions sparkles/tests/test_find_er_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,62 +93,20 @@ def test_find_er_catalog_minus_2_pitch_bins(proseco_agasc_1p7, ACA, ATTS):
# import pprint; pprint.pprint(att_opts[TEST_COLS].pformat_all(), width=100)
assert acar is att_opts["acar"][8]
assert att_opts[TEST_COLS].pformat_all() == [
(
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att"
" "
),
(
"------ ----- --------- ---------- --------- -------- ----------"
" -----------------"
),
(
" -0.01 -3.10 4.18 6.00 5.65 True 2 7.67"
" -25.22 29.3"
),
(
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47"
" -26.05 26.1"
),
(
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21"
" -26.82 22.8"
),
(
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49"
" -26.12 29.7"
),
(
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.23"
" -27.00 26.4"
),
(
" -1.17 3.00 0.75 6.87 4.03 False -- 5.91"
" -27.80 23.1"
),
(
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.32"
" -27.02 30.1"
),
(
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.01"
" -27.93 26.8"
),
(
" -2.34 3.00 8.53 13.90 12.67 True 0 6.64"
" -28.78 23.5"
),
(
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.16"
" -27.91 30.4"
),
(
" -3.50 -0.05 4.87 9.63 7.50 True -- 8.80"
" -28.86 27.2"
),
(
" -3.50 3.00 3.60 9.93 6.38 True -- 7.37"
" -29.75 23.8"
),
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att ",
"------ ----- --------- ---------- --------- -------- ---------- -----------------",
" -0.01 -3.10 4.18 6.00 5.65 True 2 7.66 -25.21 29.3",
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47 -26.05 26.1",
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21 -26.84 22.8",
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49 -26.10 29.7",
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.25 -26.99 26.4",
" -1.17 3.00 0.75 6.87 4.03 False -- 5.94 -27.81 23.1",
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.33 -26.99 30.1",
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.04 -27.92 26.8",
" -2.34 3.00 8.53 13.90 12.67 True 0 6.67 -28.78 23.5",
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.19 -27.87 30.5",
" -3.50 -0.05 5.60 10.63 8.39 True -- 8.84 -28.84 27.2",
" -3.50 3.00 2.83 8.93 5.47 False -- 7.42 -29.74 23.8",
]


Expand All @@ -157,62 +115,20 @@ def test_find_er_catalog_minus_2_count_all(proseco_agasc_1p7, ACA, ATTS):
# import pprint; pprint.pprint(att_opts[TEST_COLS].pformat_all(), width=100)
assert acar is att_opts["acar"][8]
assert att_opts[TEST_COLS].pformat_all() == [
(
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att"
" "
),
(
"------ ----- --------- ---------- --------- -------- ----------"
" -----------------"
),
(
" -0.01 -3.10 4.18 6.00 5.65 True -- 7.67"
" -25.22 29.3"
),
(
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47"
" -26.05 26.1"
),
(
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21"
" -26.82 22.8"
),
(
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49"
" -26.12 29.7"
),
(
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.23"
" -27.00 26.4"
),
(
" -1.17 3.00 0.75 6.87 4.03 False -- 5.91"
" -27.80 23.1"
),
(
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.32"
" -27.02 30.1"
),
(
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.01"
" -27.93 26.8"
),
(
" -2.34 3.00 8.53 13.90 12.67 True 0 6.64"
" -28.78 23.5"
),
(
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.16"
" -27.91 30.4"
),
(
" -3.50 -0.05 4.87 9.63 7.50 True -- 8.80"
" -28.86 27.2"
),
(
" -3.50 3.00 3.60 9.93 6.38 True -- 7.37"
" -29.75 23.8"
),
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att ",
"------ ----- --------- ---------- --------- -------- ---------- -----------------",
" -0.01 -3.10 4.18 6.00 5.65 True -- 7.66 -25.21 29.3",
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47 -26.05 26.1",
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21 -26.84 22.8",
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49 -26.10 29.7",
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.25 -26.99 26.4",
" -1.17 3.00 0.75 6.87 4.03 False -- 5.94 -27.81 23.1",
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.33 -26.99 30.1",
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.04 -27.92 26.8",
" -2.34 3.00 8.53 13.90 12.67 True 0 6.67 -28.78 23.5",
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.19 -27.87 30.5",
" -3.50 -0.05 5.60 10.63 8.39 True -- 8.84 -28.84 27.2",
" -3.50 3.00 2.83 8.93 5.47 False -- 7.42 -29.74 23.8",
]


Expand All @@ -221,62 +137,20 @@ def test_find_er_catalog_minus_2_input_order(proseco_agasc_1p7, ACA, ATTS):
# import pprint; pprint.pprint(att_opts[TEST_COLS].pformat_all(), width=100)
assert acar is att_opts["acar"][8]
assert att_opts[TEST_COLS].pformat_all() == [
(
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att"
" "
),
(
"------ ----- --------- ---------- --------- -------- ----------"
" -----------------"
),
(
" -0.01 -3.10 4.18 6.00 5.65 True 2 7.67"
" -25.22 29.3"
),
(
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47"
" -26.05 26.1"
),
(
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21"
" -26.82 22.8"
),
(
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49"
" -26.12 29.7"
),
(
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.23"
" -27.00 26.4"
),
(
" -1.17 3.00 0.75 6.87 4.03 False -- 5.91"
" -27.80 23.1"
),
(
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.32"
" -27.02 30.1"
),
(
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.01"
" -27.93 26.8"
),
(
" -2.34 3.00 8.53 13.90 12.67 True 0 6.64"
" -28.78 23.5"
),
(
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.16"
" -27.91 30.4"
),
(
" -3.50 -0.05 4.87 9.63 7.50 True -- 8.80"
" -28.86 27.2"
),
(
" -3.50 3.00 3.60 9.93 6.38 True -- 7.37"
" -29.75 23.8"
),
"dpitch dyaw count_9th count_10th count_all count_ok n_critical att ",
"------ ----- --------- ---------- --------- -------- ---------- -----------------",
" -0.01 -3.10 4.18 6.00 5.65 True 2 7.66 -25.21 29.3",
" -0.01 -0.05 2.00 2.67 2.25 False -- 6.47 -26.05 26.1",
" -0.01 3.00 2.62 7.92 5.26 False -- 5.21 -26.84 22.8",
" -1.17 -3.10 2.00 9.33 5.92 False -- 8.49 -26.10 29.7",
" -1.17 -0.05 0.00 1.23 0.78 False -- 7.25 -26.99 26.4",
" -1.17 3.00 0.75 6.87 4.03 False -- 5.94 -27.81 23.1",
" -2.34 -3.10 1.89 7.77 5.21 False -- 9.33 -26.99 30.1",
" -2.34 -0.05 2.87 8.52 5.97 False -- 8.04 -27.92 26.8",
" -2.34 3.00 8.53 13.90 12.67 True 0 6.67 -28.78 23.5",
" -3.50 -3.10 2.12 10.01 6.66 False -- 10.19 -27.87 30.5",
" -3.50 -0.05 5.60 10.63 8.39 True -- 8.84 -28.84 27.2",
" -3.50 3.00 2.83 8.93 5.47 False -- 7.42 -29.74 23.8",
]


Expand Down
63 changes: 32 additions & 31 deletions sparkles/tests/test_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,17 @@ def test_roll_options_dec89_9(proseco_agasc_1p7):
exp[48000] = [
" roll P2 n_stars improvement roll_min roll_max add_ids drop_ids",
"------ ---- ------- ----------- -------- -------- --------- --------",
"287.25 3.61 0.55 0.00 287.25 287.25 -- --",
"281.00 7.24 6.98 9.53 276.75 285.25 608567744 --",
"287.50 7.25 5.43 7.68 276.42 298.08 -- --",
"286.97 3.61 0.55 0.00 286.97 286.97 -- --",
"280.97 7.23 6.98 9.53 276.72 285.22 608567744 --",
"287.47 7.25 5.43 7.68 276.14 297.81 -- --",
]

exp[18000] = [
" roll P2 n_stars improvement roll_min roll_max add_ids drop_ids",
"------ ---- ------- ----------- -------- -------- --------- --------",
"276.94 3.61 7.54 0.00 276.94 276.94 -- --",
"277.07 7.25 8.00 1.89 266.11 287.77 -- --",
"270.57 7.16 8.00 1.84 266.19 274.94 608567744 --",
"276.71 3.61 7.54 0.00 276.71 276.71 -- --",
"277.09 7.25 8.00 1.89 265.88 287.54 -- --",
"270.59 7.15 8.00 1.84 266.21 274.96 608567744 --",
]

for obsid in (48000, 18000):
Expand Down Expand Up @@ -555,65 +555,66 @@ def compare_intervs(intervs, exp_intervs):
# For the OR we expect this
or_exp_intervs = [
{
"roll": 281.56864473302164,
"roll_min": 281.56864473302164,
"roll_max": 281.5759766065589,
"add_ids": {84943288},
"drop_ids": {84937736},
"roll": 281.53501733258395,
"roll_max": 281.57597660655892,
"roll_min": 281.53501733258395,
},
{
"roll": 289.0759766065589,
"roll_min": 283.8259766065589,
"roll_max": 291.56864473302164,
"add_ids": set(),
"drop_ids": set(),
"roll": 289.07597660655892,
"roll_max": 291.53501733258395,
"roll_min": 283.82597660655892,
},
{
"roll": 289.0759766065589,
"roll_min": 287.8259766065589,
"roll_max": 290.3259766065589,
"add_ids": {84941648},
"drop_ids": set(),
"roll": 289.07597660655892,
"roll_max": 290.32597660655892,
"roll_min": 287.82597660655892,
},
{
"roll": 289.8259766065589,
"roll_min": 289.3259766065589,
"roll_max": 290.3259766065589,
"add_ids": {85328120, 84941648},
"drop_ids": set(),
"roll": 289.82597660655892,
"roll_max": 290.32597660655892,
"roll_min": 289.32597660655892,
},
{
"roll": 291.56864473302164,
"roll_min": 289.3259766065589,
"roll_max": 291.56864473302164,
"add_ids": {85328120},
"drop_ids": set(),
"roll": 291.53501733258395,
"roll_max": 291.53501733258395,
"roll_min": 289.32597660655892,
},
]

compare_intervs(or_roll_intervs, or_exp_intervs)

# For the ER we expect these
er_exp_intervs = [
{
"roll": 290.8033828990559,
"roll_min": 285.1783828990559,
"roll_max": 291.67104636183814,
"add_ids": set(),
"drop_ids": set(),
"roll": 290.80338289905592,
"roll_max": 291.63739755173594,
"roll_min": 285.17838289905592,
},
{
"roll": 291.67104636183814,
"roll_min": 289.6783828990559,
"roll_max": 291.67104636183814,
"add_ids": {84943288},
"drop_ids": set(),
"roll": 291.63739755173594,
"roll_max": 291.63739755173594,
"roll_min": 289.67838289905592,
},
{
"roll": 291.67104636183814,
"roll_min": 290.9283828990559,
"roll_max": 291.67104636183814,
"add_ids": {85328120, 84943288},
"drop_ids": set(),
"roll": 291.63739755173594,
"roll_max": 291.63739755173594,
"roll_min": 290.92838289905592,
},
]
compare_intervs(er_roll_intervs, er_exp_intervs)
Expand All @@ -629,7 +630,7 @@ def test_roll_options_for_not_allowed_pitch():
roll = nominal_roll(ra, dec, date)
att0 = Quat([ra, dec, roll])

att = apply_sun_pitch_yaw(att0, pitch=40)
att = apply_sun_pitch_yaw(att0, pitch=40, time=date)
aca = get_aca_catalog(**mod_std_info(att=att, date=date))
acar = aca.get_review_table()
acar.get_roll_options()
Expand Down
Loading

0 comments on commit 4d3c31d

Please sign in to comment.