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 29, 2024
1 parent 8fbb9d7 commit 4f12f90
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

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

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 4f12f90

Please sign in to comment.