simonsobs / sotodlib

Simons Observatory: Time-Ordered Data processing library.
MIT License
16 stars 19 forks source link

When running preprocessing in LoadContext, handle detectors and samples that are removed #1004

Open tskisner opened 1 month ago

tskisner commented 1 month ago

Toast observations include all detectors and samples, and use bitflags to handle cut detectors / samples. When we run the preprocessing pipeline inside the LoadContext operator, some detectors may be removed from the axismanager and a symmetric buffer of samples on either end of the data may also be removed.

The solution is to get the detector list from the det LabelAxis and use that to map to the full detector set in the toast observation. Then data can be copied one detector at a time. Currently entire 2D blocks of detectors/samples are copied at once, which results both in incorrect ordering of detector data and also a segfault when trying to access detector indices in the axismanager which are now out of range.

For the removed samples, we can assume (?!?) that the number of samples removed is symmetric and center the array of samples in the full array while flagging the missing samples on either end.

This is the last thing holding up #943 .