Skip to content

Commit

Permalink
Fix ERA GST constant mixup, add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Feb 7, 2024
1 parent 5fe45fa commit 531f6d4
Show file tree
Hide file tree
Showing 29 changed files with 721 additions and 917 deletions.
32 changes: 22 additions & 10 deletions README-headless.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ adjustment to convert from J2000 to ICRS coordinates.
transform_cat(CHANGE_EPOCH, NOVAS_B1950, &source, NOVAS_J2000, "FK5", &source);
// Then convert J2000 coordinates to ICRS (also in place). Here the dates don't matter...
transform_cat(CHANGE_J2000_TO_ICRS, 0.0, &source, 0.0, "ICR", &source);
transform_cat(CHANGE_J2000_TO_ICRS, 0.0, &source, 0.0, "ICRS", &source);
```

(Naturally, you can skip the transformation steps above if you have defined your source in ICRS coordinates from the
Expand Down Expand Up @@ -326,15 +326,15 @@ at the specified observing location (without refraction correction):
double zd, az;

// Convert CIRS to horizontal using the pole offsets.
cirs_to_hor(jd_tt - ut1_to_tt, ut1_to_tt, NOVAS_FULL_ACCURACY, dx, dy, &obs.on_surf, pos.ra, pos.dec,
&zd, &az);
cirs_to_hor(jd_tt - ut1_to_tt, ut1_to_tt, NOVAS_FULL_ACCURACY, dx, dy, &obs.on_surf,
pos.ra, pos.dec, &zd, &az);
```
In the example above we first calculated the apparent coordinates in the Celestial Intermediate Reference System
(CIRS). Then we used `cirs_to_hor()` function then convert first it to the Earth-fixed International Terrestrial
Reference system (ITRS) using the small (arcsec-level) measured variation of the pole (dx, dy) provided explicitly
since `cirs_to_hor()` does not use the values previously set via `cel_pole()`. Finally, `cirs_to_hor()` converts the
ITRScoordinates to the horizontal system at the observer location.
ITRS coordinates to the horizontal system at the observer location.
You can additionally apply an optical refraction correction for the astrometric (unrefracted) zenith angle, if you
want, e.g.:
Expand Down Expand Up @@ -462,7 +462,7 @@ on how they are appropriate for the old and new methodologies respectively.
invalid (unless the NOVAS C API already defined a different return value for specific cases. If so, the NOVAS C
error code is returned for compatibility).

- Many SuperNOVAS functions allow NULL arguments, both for optional input values as well as outputs that are not
- Many SuperNOVAS functions allow `NULL` arguments, both for optional input values as well as outputs that are not
required. See the [API Documentation](https://smithsonian.github.io/SuperNOVAS.home/apidoc/html/) for specifics).
This eliminates the need to declare dummy variables in your application code.

Expand All @@ -475,10 +475,9 @@ on how they are appropriate for the old and new methodologies respectively.
data content being pointed at. This supports better programming practices that generally aim to avoid unintended
data modifications.

- New `cirs_to_hor()` function similar to the existing `equ2hor()`. Whereas the latter converts from TOD to
to local horizontal (old methodology), the new function does the same from CIRS (new IAU standard methodology).
As such it can be used after `place()` is called with `NOVAS_CIRS` as the coordinate system.

- Source names and catalog names can both be up to 64 bytes (including termination), up from 51 and 4 respectively
NOVAS C, while keeping `struct` layouts the same thanks to alignment.

- Runtime configurability:

* The planet position calculator function used by `ephemeris` can be set at runtime via `set_planet_calc()`, and
Expand All @@ -495,7 +494,20 @@ on how they are appropriate for the old and new methodologies respectively.
approximation via `nutation_set_lp_calc()`. For example, the user may want to use the `iau2000b()` model instead
or some custom algorithm instead.

- Added several new convenience functions to wrap `place()` for simpler specific use: `place_star()`, `place_icrs()`,
- New intutitive XYZ coordinate coversion functions:
* for GCRS - CIRS - ITRS (IAU 2000 standard): `gcrs_to_cirs()`, `cirs_to_itrs()`, and `itrs_to_cirs()`,
`cirs_to_gcrs()`.
* for J2000 - TOD - ITRS (old methodology): `j2000_to_tod()`, `tod_to_itrs()`, and `itrs_to_tod()`,
`tod_to_j2000()`.

- New `cirs_to_hor()` function similar to the existing `equ2hor()`. Whereas the latter converts from TOD to
to local horizontal (old methodology), the new function does the same from CIRS (new IAU standard methodology).
As such it can be used after `place()` is called with `NOVAS_CIRS` as the coordinate system.

- New `refract_astro()` function that complements the existing `refract()` but takes an unrefracted zenith angle
as its argument.

- New convenience functions to wrap `place()` for simpler specific use: `place_star()`, `place_icrs()`,
`place_gcrs()`, `place_cirs()`, `place_tod()`.

- New time conversion utilities `tt2tdb()` and `get_ut1_to_tt()` make it simpler to convert between UT1, TT, and TDB
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ adjustment to convert from J2000 to ICRS coordinates.
transform_cat(CHANGE_EPOCH, NOVAS_B1950, &source, NOVAS_J2000, "FK5", &source);
// Then convert J2000 coordinates to ICRS (also in place). Here the dates don't matter...
transform_cat(CHANGE_J2000_TO_ICRS, 0.0, &source, 0.0, "ICR", &source);
transform_cat(CHANGE_J2000_TO_ICRS, 0.0, &source, 0.0, "ICRS", &source);
```

(Naturally, you can skip the transformation steps above if you have defined your source in ICRS coordinates from the
Expand Down Expand Up @@ -338,15 +338,15 @@ at the specified observing location (without refraction correction):
double zd, az;

// Convert CIRS to horizontal using the pole offsets.
cirs_to_hor(jd_tt - ut1_to_tt, ut1_to_tt, NOVAS_FULL_ACCURACY, dx, dy, &obs.on_surf, pos.ra, pos.dec,
&zd, &az);
cirs_to_hor(jd_tt - ut1_to_tt, ut1_to_tt, NOVAS_FULL_ACCURACY, dx, dy, &obs.on_surf,
pos.ra, pos.dec, &zd, &az);
```
In the example above we first calculated the apparent coordinates in the Celestial Intermediate Reference System
(CIRS). Then we used `cirs_to_hor()` function then convert first it to the Earth-fixed International Terrestrial
Reference system (ITRS) using the small (arcsec-level) measured variation of the pole (dx, dy) provided explicitly
since `cirs_to_hor()` does not use the values previously set via `cel_pole()`. Finally, `cirs_to_hor()` converts the
ITRScoordinates to the horizontal system at the observer location.
ITRS coordinates to the horizontal system at the observer location.
You can additionally apply an optical refraction correction for the astrometric (unrefracted) zenith angle, if you
want, e.g.:
Expand Down Expand Up @@ -474,7 +474,7 @@ on how they are appropriate for the old and new methodologies respectively.
invalid (unless the NOVAS C API already defined a different return value for specific cases. If so, the NOVAS C
error code is returned for compatibility).

- Many SuperNOVAS functions allow NULL arguments, both for optional input values as well as outputs that are not
- Many SuperNOVAS functions allow `NULL` arguments, both for optional input values as well as outputs that are not
required. See the [API Documentation](https://smithsonian.github.io/SuperNOVAS.home/apidoc/html/) for specifics).
This eliminates the need to declare dummy variables in your application code.

Expand All @@ -487,10 +487,9 @@ on how they are appropriate for the old and new methodologies respectively.
data content being pointed at. This supports better programming practices that generally aim to avoid unintended
data modifications.

- New `cirs_to_hor()` function similar to the existing `equ2hor()`. Whereas the latter converts from TOD to
to local horizontal (old methodology), the new function does the same from CIRS (new IAU standard methodology).
As such it can be used after `place()` is called with `NOVAS_CIRS` as the coordinate system.

- Source names and catalog names can both be up to 64 bytes (including termination), up from 51 and 4 respectively
NOVAS C, while keeping `struct` layouts the same thanks to alignment.

- Runtime configurability:

* The planet position calculator function used by `ephemeris` can be set at runtime via `set_planet_calc()`, and
Expand All @@ -507,7 +506,20 @@ on how they are appropriate for the old and new methodologies respectively.
approximation via `nutation_set_lp_calc()`. For example, the user may want to use the `iau2000b()` model instead
or some custom algorithm instead.

- Added several new convenience functions to wrap `place()` for simpler specific use: `place_star()`, `place_icrs()`,
- New intutitive XYZ coordinate coversion functions:
* for GCRS - CIRS - ITRS (IAU 2000 standard): `gcrs_to_cirs()`, `cirs_to_itrs()`, and `itrs_to_cirs()`,
`cirs_to_gcrs()`.
* for J2000 - TOD - ITRS (old methodology): `j2000_to_tod()`, `tod_to_itrs()`, and `itrs_to_tod()`,
`tod_to_j2000()`.

- New `cirs_to_hor()` function similar to the existing `equ2hor()`. Whereas the latter converts from TOD to
to local horizontal (old methodology), the new function does the same from CIRS (new IAU standard methodology).
As such it can be used after `place()` is called with `NOVAS_CIRS` as the coordinate system.

- New `refract_astro()` function that complements the existing `refract()` but takes an unrefracted zenith angle
as its argument.

- New convenience functions to wrap `place()` for simpler specific use: `place_star()`, `place_icrs()`,
`place_gcrs()`, `place_cirs()`, `place_tod()`.

- New time conversion utilities `tt2tdb()` and `get_ut1_to_tt()` make it simpler to convert between UT1, TT, and TDB
Expand Down
24 changes: 16 additions & 8 deletions include/novas.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,24 @@ enum novas_accuracy {
*/
enum novas_refraction_model {
NOVAS_NO_ATMOSPHERE = 0, ///< Do not apply atmospheric refraction correction
NOVAS_STANDARD_ATMOSPHERE, ///< Uses a standard atmospheric model, ignoring all weather values defined for the specific observing location
NOVAS_STANDARD_ATMOSPHERE, ///< Uses a standard atmospheric model, ignoring all weather values defined for the specific observing location
NOVAS_WEATHER_AT_LOCATION ///< Uses the weather parameters that are specified together with the observing location.
};

/**
* Constants that determine the type of rotation measure to use.
*/
enum novas_earth_rotation_measure {
EROT_GST = 0, ///< Use GST as the rotation measure, relative to the true equinox (before IAU 20006 standard)
EROT_ERA ///< Use Earth Rotation Angle (ERA) as the rotation measure, relative to the CIO (new IAU 2006 standard)
EROT_ERA = 0, ///< Use Earth Rotation Angle (ERA) as the rotation measure, relative to the CIO (new IAU 2006 standard)
EROT_GST ///< Use GST as the rotation measure, relative to the true equinox (before IAU 20006 standard)
};

/**
* Constants for ter2cel() and cel2ter()
*/
enum novas_celestial_class {
CELESTIAL_GCRS = 0, ///< Celestial coordinates are in GCRS
CELESTIAL_APPARENT ///< Celestial coordinates are apparent values (CIRS or TOD)
};

/**
Expand Down Expand Up @@ -604,10 +612,10 @@ short sidereal_time(double jd_high, double jd_low, double ut1_to_tt, enum novas_
double era(double jd_high, double jd_low);

short ter2cel(double jd_ut1_high, double jd_ut1_low, double ut1_to_tt, enum novas_earth_rotation_measure method, enum novas_accuracy accuracy,
enum novas_reference_system option, double xp, double yp, const double *vec1, double *vec2);
enum novas_celestial_class class, double xp, double yp, const double *vec1, double *vec2);

short cel2ter(double jd_ut1_high, double jd_ut1_low, double ut1_to_tt, enum novas_earth_rotation_measure method, enum novas_accuracy accuracy,
enum novas_reference_system option, double xp, double yp, const double *vec1, double *vec2);
enum novas_celestial_class class, double xp, double yp, const double *vec1, double *vec2);

int spin(double angle, const double *pos1, double *pos2);

Expand Down Expand Up @@ -733,9 +741,6 @@ int place_cirs(double jd_tt, const object *source, enum novas_accuracy accuracy,

double refract_astro(const on_surface *location, enum novas_refraction_model ref_option, double zd_calc);

int cirs_to_hor(double jd_ut1, double ut1_to_tt, enum novas_accuracy accuracy, double xp, double yp, const on_surface *location, double ra,
double dec, double *zd, double *az);

int light_time2(double jd_tdb, const object *ss_object, const double *pos_obs, double tlight0, enum novas_accuracy accuracy, double *pos,
double *vel, double *tlight);

Expand Down Expand Up @@ -769,6 +774,9 @@ int itrs_to_tod(double jd_ut1_high, double jd_ut1_low, double ut1_to_tt, enum no
int tod_to_j2000(double jd_tt, enum novas_accuracy accuracy, const double *in, double *out);


int cirs_to_hor(double jd_ut1, double ut1_to_tt, enum novas_accuracy accuracy, double xp, double yp, const on_surface *location, double ra,
double dec, double *zd, double *az);

#include "solarsystem.h"

#endif /* _NOVAS_ */
Loading

0 comments on commit 531f6d4

Please sign in to comment.