EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
16 stars 4 forks source link

`celestial.coo.convert_coo` errors for empty arguments #441

Open EastEriq opened 2 months ago

EastEriq commented 2 months ago
>> celestial.coo.convert_coo([],[], 'J2000.0','g')
Index in position 2 exceeds array bounds.
Error in celestial.coo.convert_coo (line 182)
F0 = OutLong(:,1)<0; 

I get empty RA and Dec as a corner case in another script, and of course I can trap it there. For sanity, the check could be included in convert_coo itself, which in that case should return empty values.

EranOfek commented 2 months ago

corrected [dev1 28f20048]

On Thu, May 9, 2024 at 11:46 AM EastEriq @.***> wrote:

celestial.coo.convert_coo([],[], 'J2000.0','g') Index in position 2 exceeds array bounds. Error in celestial.coo.convert_coo (line 182) F0 = OutLong(:,1)<0;

I get empty RA and Dec as a corner case in another script, and of course I can trap it there. For sanity, the check could be included in convert_coo itself, which in that case should return empty values.

— Reply to this email directly, view it on GitHub https://github.com/EranOfek/AstroPack/issues/441, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJUQ4JFLO7JG3WKDHHUVTDZBMZXJAVCNFSM6AAAAABHONQ3Y6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DOMRQGUYTONY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

EastEriq commented 2 months ago

@EranOfek says that celestial.coo.convert_coo should not be used, but it is in

$ grep -r convert_coo
+obs/@unitCS/takeTwilightFlats.m:        [~,Lat] = celestial.coo.convert_coo(RA./RAD, Dec./RAD, 'J2000.0','g');
+obs/@unitCS/pointAndClickMove.m:    [RA,Dec] = celestial.coo.convert_coo(RA./RAD,Dec./RAD,'tdate','J2000.0');
+obs/@mount/setCoordinateJ.m:    [NewRA_t,NewDec_t] = celestial.coo.convert_coo(NewRA./RAD, NewDec./RAD, InputEquinox, 'tdate' , JD);
+obs/@mount/setCoordinateJ.m:        [RA_t,Dec_t] = celestial.coo.convert_coo(RA./RAD, Dec./RAD, InputEquinox, 'tdate' , JD);

Note that some of these functions might be now obsolete, as per https://github.com/PolishookDavid/LAST_OCS/issues/15 and a review is demanded