ratt-ru / QuartiCal

CubiCal, but with greater power.
MIT License
8 stars 4 forks source link

Ternary flagging #125

Closed JSKenyon closed 3 years ago

JSKenyon commented 3 years ago

Internal flags in QuartiCal are now represented by a np.int8 array rather than a np.bool array. This has zero impact on memory footprint (numpy atomicity is already at the byte level). I have also removed the correlation axis from the internal flag representation as we take the union of the flags over the correlation axis anyway. This results in the flags being a factor of 32 smaller than the data (in the four correlation case). In addition, internal flags now have three valid states:

This change is necessary to cope with several use cases which place strain on using the weights to implement flagging. These use cases are:

Prior to this PR, operations like uv selection would simply set the relevant weights to zero but this is not reversible. Consequently, uv selection would interact weirdly with the cases above. This should no longer be a problem as uv selection is now implemented as a temporary flagging operation which doesn't preclude subsequent operations on the weights.

For the canny amongst you, this is a limited form of bitflagging. This will NEVER be exposed to users and my intention is to keep it to strictly three states, which I believe will be sufficient.

This change also makes the solvers faster on heavily flagged data.