desihub / desimeter

DESI coordinates and transformations
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Better handle ADC settings in unusual configurations. #156

Closed schlafly closed 3 years ago

schlafly commented 3 years ago

This PR extends the coverage of the ray-traced tan2fp ZB fits to handle angle differences up to 360 degrees. These are seldom used in practice but are possible, and produce different distortion patterns. The PR is also slightly more careful about how ADC angles are translated into look ups into the fits.

Additionally, the ray tracing code was parallelized to speed it up.

Note: we had some discussions about the right way to compute angle differences for the ADCs, with me suggesting something like ((dangle + 180) % 360)-180. I'm now in fact just using dangle % 360; since the tables now go up to 360 degrees, this makes sense. Care has to be taken to make sure we're always using the rotation angle we want with these; average_angles_adc should be doing that. The only subtlety there is what to do with cases where adc1 == adc2, where the average angle is meaningless. I've checked for this case and returned adc1 then. In these cases dangle should be zero, so that's the right behavior. I'm not sure if I have to worry about the possibility of negative 0 wrapping to 360; that would do the wrong thing.

julienguy commented 3 years ago

Thanks for this.