Skip to content

Fix gaps for nonsequential ifos

Problem

In the gitlab CI pipeline, spiir-O4-EW-development currently fails one of the optional tests. When using non-sequential IFOs, we get different results.

Cause

In !147 (merged) I used an ifo_set_type to track gaps. Somewhere along the line, I lost track of the fact I was recording a 'subset'. 'subset' may not be quite the right word here, but it's what I've used.

We have:

  • All possible IFOs (MAX_NIFO)
  • Enabled IFOs (IFOs connected to postcoh, typically HLV)
  • coh_ifos (Enabled IFOs that are not in gaps. Used for coherent search, thus, coh_ifos)

Issue is, coh_ifos is a bitset recording True/False for each IFO in Enabled IFOs, but ignoring All possible IFOs.

E.g. if HLV are enabled and HL are not in gaps, then coh_ifos = 0b011.

But if HVK are enabled and HV are not in gaps, then still coh_ifos = 0b011, because it doesn't store a bit for Livingston.

This format is convenient because we often iterate over the 'number of enabled ifos', using an index I've called enabled_ifo_id, and using arrays that only store that many (nifo) entries.

coh_ifos used this limited set of IFOs, but that messes up the function ifo_set__get_string, which assumes a bit is stored for each IFO. It's also the only way we store coh_ifos in postcohtable, so if it's wrong, our pipeline will be reading entirely the wrong fields over in finalsink.

Solution

There's a few options, but I think I prefer to keep the assumption that an ifo_set_type stores a bit for all available IFOs.

So ifo_set__get_string is unchanged, but I've added 2 explicit functions to consider 'subsets'. They each take 2 ifo_sets, the subset & its superset. They iterate through the ifos of the superset, checking if they're also in the subset.

ifo_set__to_uint -> ifo_set__to_uint_from_subset, and ifo_set__contains -> ifo_set__subset_contains.

I added some assertions, to check that the subset used doesn't record any flags outside the superset, and guarded them with #ifndef NDEBUG, which seems to be the compiler flag to disable assertions.

Another option is to change ifo_set_type to be more like a generic bitset, and/or to have it inherit from that, but I think I prefer to keep this type niche for now.

Tests

It builds, tests pending. Since CI/CD tests were failing, I'll see if this fixes them.

Merge request reports