radiocosmology / draco

A pipeline for the analysis and simulation of drift scan radio data
MIT License
9 stars 7 forks source link

fix(ringmapmaker): fix bug finding shortest baseline in find_basis #251

Closed ssiegelx closed 1 year ago

ssiegelx commented 1 year ago

Previous version gives the correct result for CHIME, but can result in incorrect values for the grid spacing and indices for other telescopes due to a bug in how the shortest baseline is identified.

ssiegelx commented 1 year ago

I think there is a bug here: find_basis is calculating the argmin of the absolute value of the (nbase, 2) baseline array. This will give an index into the (nbase * 2,) flattened array, but it is being used to index the first dimension of the unflattened array.

This happens to give the correct basis for both the un-rotated and rotated versions of CHIME. However, it is giving incorrect results for certain CHORD baseline layouts that are on a simple un-rotated grid.

I think the intention here was to find the baseline with the shortest total length. I've updated the function and confirmed that is gives the expected result for un-rotated/rotated CHIME and CHORD.

jrs65 commented 1 year ago

Yeah, that's a bug. Good catch!