EranOfek / AstroPack

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

`celestial.convert.j2000_toApparent` returns NaNs for default arguments #442

Closed EastEriq closed 2 months ago

EastEriq commented 2 months ago

and notably, which is my concern, without providing InterpHA or interpDec, or passing empty interpolants, that is without a pointing model.

>> [OutRA, OutDec, Alt, Refraction, Aux] = celestial.convert.j2000_toApparent(170,32)
OutRA =
   NaN
OutDec =
   NaN
Alt =
   NaN
Refraction =
   NaN
Aux = 
  struct with fields:

       RA_J2000: 170
      Dec_J2000: 32
         RA_App: NaN
         HA_App: NaN
        Dec_App: NaN
     RA_AppDist: NaN
     HA_AppDist: NaN
    Dec_AppDist: NaN
        Alt_App: NaN
         Az_App: NaN
            LST: 121.59
       HA_J2000: -48.405
        AirMass: NaN

In my opinion, the default should be that all the _App and _AppDist in that case should coincide with the given coordinates, and Az, Alt, AirMass shuld be computed accordingly.

In particular, I note that Aux.HA_AppDist = NaN; at line 156, ant this value is used at line 246 ff.., whithout having ever assigned to anything computed.

EastEriq commented 2 months ago

I may have a local INPOP problem though:

>> [E_B, E_dotB] = celestial.SolarSys.earthObserverPos(JD, 'CooSys','b',...
                                                            'RefFrame','eq',...
                                                            'GeoPos',Args.GeoPos,...
                                                            'EarthEphem','inpop',...
                                                            'INPOP',Args.INPOP,...
                                                            'TimeScale',Args.TimeScale)
E_B =
   NaN
   NaN
   NaN
E_dotB =
   NaN
   NaN
   NaN

whereas on a sane machine I get

E_B =

     -0.62896
     -0.73425
     -0.31806

E_dotB =

     0.013295
   -0.0097763
   -0.0042381

I'll try to reinstall INPOP. Nevertheless, RA_AppDist: NaN, HA_AppDist: NaN, Dec_AppDist: NaN are not right.

EastEriq commented 2 months ago

I reintalled INPOP on last11e which solved the E_B problem, but not the RA_AppDist: NaN which is a manifest bug. Note that with that mount.goToTarget2() does not work if AstroPack is kept at the bleeding edge of dev1. It works with v2.1, but probably with an incorrect distortion correction.

Note that this is connected to #437. Maybe my mistake in correcting that?

EastEriq commented 2 months ago

Yes, quite likely my fault. With #437 I corrected at the same time apparent_toJ2000 and j2000_toApparentcopy-pasting the same clause for lines 86-96 in the first into 246-258 in the latter, overlooking that the roles of _App and AppDist are exchanged. I'm committing a fix, please review it.

EastEriq commented 2 months ago

(probably fixed, @EranOfek please check)

EranOfek commented 2 months ago

looks ok