Skip to content

Commit

Permalink
fix 3/6 failures
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Feb 27, 2024
1 parent 7b05c18 commit 8cd84bf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions astropy/utils/iers/iers.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,18 +591,25 @@ def _combine_a_b_columns(cls, iers_a):
# after 'I', we can use searchsorted for 100 times speed up over
# finding the first index where the flag equals 'P'.
if hasattr(table["UT1Flag_A"], "mask"):
s1 = ~table["UT1Flag_A"].mask
mask = table["UT1Flag_A"].mask
s1 = ~mask
# a hacky way to get the position of first non-masked value
offset1 = np.searchsorted(s1, True)
else:
s1 = slice(None)
offset1 = 0

Check warning on line 600 in astropy/utils/iers/iers.py

View check run for this annotation

Codecov / codecov/patch

astropy/utils/iers/iers.py#L599-L600

Added lines #L599 - L600 were not covered by tests

if hasattr(table["PolPMFlag_A"], "mask"):
s2 = ~table["PolPMFlag_A"].mask
mask = table["PolPMFlag_A"].mask
s2 = ~mask
offset2 = np.searchsorted(s1, True)
else:
s2 = slice(None)
offset2 = 0

Check warning on line 608 in astropy/utils/iers/iers.py

View check run for this annotation

Codecov / codecov/patch

astropy/utils/iers/iers.py#L607-L608

Added lines #L607 - L608 were not covered by tests

p_index = min(
np.searchsorted(table["UT1Flag_A"][s1], "P"),
np.searchsorted(table["PolPMFlag_A"][s2], "P"),
offset1 + np.searchsorted(table["UT1Flag_A"][s1], "P"),
offset2 + np.searchsorted(table["PolPMFlag_A"][s2], "P"),
)
table.meta["predictive_index"] = p_index
table.meta["predictive_mjd"] = table["MJD"][p_index].value
Expand Down

0 comments on commit 8cd84bf

Please sign in to comment.