MWATelescope / mwalib

Library to read Murchison Widefield Array (MWA) raw visibilities, voltages and metadata into a common structure
Mozilla Public License 2.0
10 stars 2 forks source link

Defining vcsorder for rfinputs >= 256 #58

Closed robotopia closed 1 year ago

robotopia commented 1 year ago

Because the legacy VCS format was only supported during a time when there were no more than 128 tiles (= 256 RF inputs) plugged in at any one time, the quantity called vcs_order which defined the ordering of the tiles in the legacy .dat files is, strictly speaking, not defined for RF input indices >= 256. One downside of not defining vcs_order for extra inputs is that without such a definition, one cannot convert from the MWAX format to the legacy format.

Assuming this is a desirable feature to have, I propose extending the definition of vcs_order for cases when the number of RF inputs >= 256. Since the number of RF inputs need not be a multiple of 256, simply extending the same pattern as exists for < 256 would not be desirable. Instead, I propose simply adding the extra tiles onto the end of the array sequentially. This would turn the existing definition

(input & 0xC0) | ((input & 0x30) >> 4) | ((input & 0x0F) << 2)

into

(input < 256 ? (input & 0xC0) | ((input & 0x30) >> 4) | ((input & 0x0F) << 2) : input)

which remains backwards compatible, and extends the definition of vcs_order to an arbitrary number of tiles.

robotopia commented 1 year ago

BTW, I'm putting this as an issue rather than a PR because it definitely needs to be discussed first! (@gsleap)