Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions imap_processing/lo/l1c/lo_l1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,17 +1060,18 @@ def set_background_rates(
)

# find to the rows for the current pointing
# TODO: This assumes that the backgrounds will never change mid-pointing.
# Is that a safe assumption?
pointing_bg_df = background_df[
(background_df["GoodTime_start"] >= pointing_start_met)
& (background_df["GoodTime_end"] <= pointing_end_met)
(background_df["GoodTime_start"] <= pointing_start_met)
& (background_df["GoodTime_end"] >= pointing_end_met)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to change this to GoodTime start here? My thought is that right now you're requiring the full pointing period to be covered, so if you choose just the leading edge the we can just say we will use anything straddling that time period. Alternatively swap them and say (goodtimestart < pointing end AND goodtimeend > pointing start) which should cover the joint cases a little more robustly I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I am following this. I think that my hesitation with the suggestion to do:

(background_df["GoodTime_start"] < pointing_end_met)
& (background_df["GoodTime_end"] > pointing_start_met)

would be that it would make it likely that multiple sets of backgrounds would get selected. For example if pointing start/end times are every 10: [10, 20, 30, 40] and you want different backgrounds for each. If you aren't super precise with your start/end times, the goodtimes start/ends might look like:

[[9, 21], [19, 31], [29, 41]]

But then the logic would match multiple goodtime entries to each pointing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree with you. This whole way of doing it is brittle IMO. We should be doing it per pointing number or something like that if it has to be constant per pset and not dealing with SHCOARSE at all.

]

# convert the bin start and end resolution from 6 degrees to .1 degrees
# convert the bin start and end resolution from 6 degrees to 0.1 degrees
pointing_bg_df["bin_start"] = pointing_bg_df["bin_start"] * 60
# The last bin end in the file is 0, which means 60 degrees. This is
# converted to 0.1 degree resolution of 3600
pointing_bg_df["bin_end"] = pointing_bg_df["bin_end"] * 60
pointing_bg_df.loc[pointing_bg_df["bin_end"] == 0, "bin_end"] = 3600
# The bin_end index is inclusive, so add one and convert to 0.1
# degree resolution
pointing_bg_df["bin_end"] = (pointing_bg_df["bin_end"] + 1) * 60
# for each row in the bg ancillary file for this pointing
for _, row in pointing_bg_df.iterrows():
bin_start = int(row["bin_start"])
Expand Down
Loading