Skip to content

Commit

Permalink
1.0-rc2 (#6)
Browse files Browse the repository at this point in the history
* Various pre release API changes

* README updates

* More tests

* More name changes, add error tests.

* Test coverage at 99.4%

* Binary exchange compatible cat_entry. And, keep tweaking...

* Some more fixes and molding...

* A small oops in the prior commit

* Still recovering from last oops

* And yet more hagover from oops

* ...and still...

* nd still finding more fallout

* ouch, that hurt...

* A few more tweaks and README edits.

* ecl2equ(), and more NAN returns if error

* More NAN returns in case of errors.

* Upload coverage to coveralls.io

* Add coveralls badge for main branch

* Coveralls badge mod.

* Coveralls clickable badge

* Spell-check etc.
  • Loading branch information
attipaci committed Feb 21, 2024
1 parent 14ead38 commit aac86cc
Show file tree
Hide file tree
Showing 22 changed files with 1,996 additions and 498 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ jobs:
- name: Generate coverage data
run: make coverage

- name: Upload coverage to Codecov
- name: Upload coverage to Codecov.io
uses: codecov/codecov-action@v4

continue-on-error: true
with:
fail_ci_if_error: false
flags: unittests
name: codecov
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true


- name: Upload coverage to Coveralls.io
continue-on-error: true
uses: coverallsapp/github-action@v2

97 changes: 62 additions & 35 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,60 @@

## [Unreleased]

Changes expected for the next release...
Changes planned/expected for the next release...


### Added

- Add debug mode, which can be activated via `novas_debug(1)`. When debug mode is enabled, all errors are printed to
the console with a trace (the trace does not contain line numbers but provides information on the functions and
- Add debug mode, which can be activated via `novas_debug(1)`. When debug mode is enabled, all errors will be printed
to the console with a trace (the trace does not contain line numbers but provides information on the functions and
locations within them where the error occurred.


## [1.0.0] - 2024-03-01

This is the initial release of the SuperNOVAS library.

### Fixed

- Fixed the [sidereal_time bug](https://aa.usno.navy.mil/software/novas_faq), whereby the `sidereal_time()`
- Fixes the [sidereal_time bug](https://aa.usno.navy.mil/software/novas_faq), whereby the `sidereal_time()`
function had an incorrect unit cast. This is a known issue of NOVAS C 3.1.

- Fixed the [ephem_close bug](https://aa.usno.navy.mil/software/novas_faq), whereby `ephem_close()` in
- Fixes the [ephem_close bug](https://aa.usno.navy.mil/software/novas_faq), whereby `ephem_close()` in
`ephem_manager.c` did not reset the `EPHFILE` pointer to NULL. This is a known issue of NOVAS C 3.1.

- Fixed antedating velocities and distances for light travel time in `ephemeris()`. When getting positions and
- Fixes antedating velocities and distances for light travel time in `ephemeris()`. When getting positions and
velocities for Solar-system sources, it is important to use the values from the time light originated from the
observed body rather than at the time that light arrives to the observer. This correction was done properly for
positions, but not for velocities or distances, resulting in incorrect observed radial velocities or apparent
distances being reported for spectroscopic observations or for angular-physical size conversions.

- Fixed bug in `ira_equinox()` which may return the result for the wrong type of equinox (mean vs. true) if the the
- Fixes bug in `ira_equinox()` which may return the result for the wrong type of equinox (mean vs. true) if the the
`equinox` argument was changing from 1 to 0, and back to 1 again with the date being held the same. This affected
routines downstream also, such as `sidereal_time()`.

- Fixed accuracy switching bug in `cio_basis()`, `cio_location()`, `ecl2equ`, `equ2ecl_vec()`, `ecl2equ_vec()`,
- Fixes accuracy switching bug in `cio_basis()`, `cio_location()`, `ecl2equ`, `equ2ecl_vec()`, `ecl2equ_vec()`,
`geo_posvel()`, `place()`, and `sidereal_time()`. All these functions returned a cached value for the other
accuracy if the other input parameters are the same as a prior call, except the accuracy.

- Fixed multiple bugs in using cached values in `cio_basis()` with alternating CIO location reference systems.
- Fixes multiple bugs related to using cached values in `cio_basis()` with alternating CIO location reference
systems.

- Fixed bug in `equ2ecl_vec()` and `ecl2equ_vec()` whereby a query with `coord_sys = 2` (GCRS) has overwritten the
- Fixes bug in `equ2ecl_vec()` and `ecl2equ_vec()` whereby a query with `coord_sys = 2` (GCRS) has overwritten the
cached mean obliquity value for `coord_sys = 0` (mean equinox of date). As a result, a subsequent call with
`coord_sys = 0` and the same date as before would return the results GCRS coordinates instead of the
requested mean equinox of date coordinates.

- The use of `fmod()` in NOVAS C 3.1 led to the wrong results when the numerator was negative and the result was
not turned into a proper remainder. This affected the calculation of the mean anomaly in `solsys3.c` (line 261)
and the fundamental arguments calculted in `fund_args()` and `ee_ct()` for dates prior to J2000. Less
and the fundamental arguments calculated in `fund_args()` and `ee_ct()` for dates prior to J2000. Less
critically, it also was the reason `cal_date()` did not work for negative JD values.

- Fixes `aberration()` returning NAN vectors if the `ve` argument is 0. It now returns the unmodified input
vector appropriately instead.

- Fixes potential string overflows and eliminates associated compiler warnings.


### Added

Expand Down Expand Up @@ -78,7 +84,7 @@ This is the initial release of the SuperNOVAS library.
approximation via `set_nutation_lp_provider()`. For example, the user may want to use the `iau2000b()` model
instead or some custom algorithm instead.

- New intutitive XYZ coordinate coversion functions:
- New intutitive XYZ coordinate conversion functions:
* for GCRS - CIRS - ITRS (IAU 2000 standard): `gcrs_to_cirs()`, `cirs_to_itrs()`, and `itrs_to_cirs()`,
`cirs_to_gcrs()`.
* for GCRS - J2000 - TOD - ITRS (old methodology): `gcrs_to_j2000()`, `j2000_to_tod()`, `tod_to_itrs()`, and
Expand All @@ -89,6 +95,8 @@ This is the initial release of the SuperNOVAS library.
version of the existing `equ2hor()` for converting from TOD to to local horizontal (old methodology), the
`cirs_to_itrs()` followed by `itrs_to_hor()` does the same from CIRS (new IAU standard methodology), and had no
equivalent in NOVAS C 3.1.

- New `ecl2equ()` for converting ecliptic coordinates to equatorial, complementing existing `equ2ecl()`.

- New `gal2equ()` for converting galactic coordinates to ICRS equatorial, complementing existing `equ2gal()`.

Expand All @@ -98,7 +106,7 @@ This is the initial release of the SuperNOVAS library.
- New convenience functions to wrap `place()` for simpler specific use: `place_star()`, `place_icrs()`,
`place_gcrs()`, `place_cirs()`, and `place_tod()`.

- New `radec_star()` and `radec_planet()` methods as the common point for all existing methods sych as `astro_star()`
- New `radec_star()` and `radec_planet()` methods as the common point for all existing methods such as `astro_star()`
`local_star()`, `topo_planet()` etc.

- New time conversion utilities `tt2tdb()` and `get_ut1_to_tt()` make it simpler to convert between UT1, TT, and TDB
Expand All @@ -107,8 +115,9 @@ This is the initial release of the SuperNOVAS library.
- Co-existing `solarsystem()` variants. It is possible to use the different `solarsystem()` implementations
provided by `solsys1.c`, `solsys2.c`, `solsys3.c` and/or `solsys-ephem.c` side-by-side, as they define their
functionalities with distinct, non-conflicting names, e.g. `earth_sun_calc()` vs `planet_jplint()` vs
`planet_ephem_manager()` vs `planet_ephem_provider()`. See the section on [Building and installation](#installation)
further above on including a selection of these in your library build.)
`planet_ephem_manager()` vs `planet_ephem_provider()`. See the section on
[Building and installation](#installation) further above on including a selection of these in your library
build.)

- New `novas_case_sensitive(int)` method to enable (or disable) case-sensitive processing of object names. (By
default NOVAS object names were converted to upper-case, making them effectively case-insensitive.)
Expand All @@ -131,32 +140,50 @@ This is the initial release of the SuperNOVAS library.
- All erroneous returns now set `errno` so that users can track the source of the error in the standard C way and
use functions such as `perror()` ans `strerror()` to print human-readable error messages.

- Output values supplied via pointers are set to clearly invalid values in case of erroneous returns, such as
`NAN` so that even if the caller forgets to check the error code, it becomes obvious that the values returned are
should not be used as if they were valid
- Many output values supplied via pointers are set to clearly invalid values in case of erroneous returns, such as
`NAN` so that even if the caller forgets to check the error code, it becomes obvious that the values returned
should not be used as if they were valid. (No more sneaky silent errors.)

- 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.
This eliminates the need to declare dummy variables in your application code for quantities you do not require.

- All SuperNOVAS functions that take an input vector to produce an output vector allow the output vector argument
be the same as the input vector argument. For example, `frame_time(pos, J2000_TO_ICRS, pos)` using the same
`pos` vector both as the input and the output. In this case the `pos` vector is modified in place by the call.
This can greatly simplify usage, and eliminate extraneous declarations, when intermediates are not required.
This can greatly simplify usage, and can eliminate extraneous declarations, when intermediates are not required.

- SuperNOVAS prototypes declare function pointer arguments as `const` whenever the function does not modify the
data content being pointed at. This supports better programming practices that generally aim to avoid unintended
data modifications.

- 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.
- SuperNOVAS declares function pointer arguments as `const` whenever the function does not modify the data content
being referenced. This supports better programming practices that generally aim to avoid unintended data
modifications.

- Catalog names can be up to 6 bytes (including termination), up from 4 in NOVAS C, while keeping `struct` layouts
the same as NOVAS C thanks to alignment, thus allowing cross-compatible binary exchage of `cat_entry` records
with NOVAS C 3.1.

- Object ID numbers are `long` instead of `short` to accommodate NAIF IDs, which require minimum 32-bit integers.

- `cel2ter()` and `tel2cel()` can now process 'option'/'class' = 1 (`NOVAS_REFERENCE_CLASS`) regardless of the
methodology (`EROT_ERA` or `EROT_GST`) used to input or output coordinates in GCRS.

- `make_object()` ignored the specified number argument for sidereal sources (set to 0), but we set it to the
specified value assuming the caller provided it for a reason. (It does not change the separate `starnumber` value
that is included in the `star` argument however)

- `sun_eph()` in `solsysl3.c` evaluates the series in reverse order compared to NOVAS C 3.1, accumulating the least
significant terms first, and thus resulting in higher precision result in the end.

- Changed `vector2radec()` to return NAN values if the input is a null-vector (i.e. all components are zero).

- Changed the standard atmospheric model for (optical) refraction calculation to include a simple model for the
annual average temperature at the site (based on latitude and elevation). This results is a slightly more educated
guess of the actual refraction than the global fixed temperature of 10 °C assumed by NOVAC C 3.1 regardless of
observing location.


### Deprecated

- `novascon.h` / `novascon.c`: These definitions of constants was troublesome fow two reasons: (1) They were
- `novascon.h` / `novascon.c`: These definitions of constants was troublesome for two reasons: (1) They were
primarily meant for use internally within the library itself. As the library clearly defines in what units input
and output quantities are expressed, the user code can apply its own appropriate conversions that need not match
the internal system used by the library. Hence exposing these constants to users was half baked. (2) The naming of
Expand All @@ -167,21 +194,21 @@ This is the initial release of the SuperNOVAS library.

- `equ2hor()`: It's name does not make it clear that this function is suitable only for converting TOD (old
methodology) to horizontal but not CIRS to horizontal (IAU 2000 standard). You should use the equivalent but more
specific `tod_to_itrs()`, or else the newly added `cirs_to_itrs()`, followed by `itrs_to_hor()` instead.
specific `tod_to_itrs()` or the newly added `cirs_to_itrs()`, followed by `itrs_to_hor()` instead.

- `cel2ter()` / `ter2cel()`: These function can be somewhat confusing to use. You are likely better off with
`tod_to_itrs()` and `cirs_to_itrs()` instead.
`tod_to_itrs()` and `cirs_to_itrs()` instead, and possibly followed by further conversions if desired.

- `app_star()`, `app_planet()`, `topo_star()` and `topo_planet()`: These use the old (pre IAU 2000) methodology,
which isn't clear from their naming. Use `place()` or `place_star()` with `NOVAS_TOD` or `NOVAS_CIRS` as the system
instead, as appropriate.

- `readeph()`: prone to memtoy leaks, and not flexible with its origin (e.g. barycenter vs heliocenter). Instead, use
a similar `novas_ephem_provider` implementation and `set_ephem_provider()` instead for a more flexible and less
troublesome equivalent, which also does not need to be baked into the library but can be configured at runtime.
- `readeph()`: prone to memory leaks, and not flexible with its origin (necessarily at the barycenter). Instead, use
a similar `novas_ephem_provider` implementation and `set_ephem_provider()` for a more flexible and less
troublesome equivalent, which also does not need to be baked into the library and can be configured at runtime.

- `tdb2tt()`. Use `tt2tdb()` instead. It's both more intuitive (returning the time difference as a double) and faster
to calculate, not to mention that it implements the more standard approach.
- `tdb2tt()`. Use `tt2tdb()` instead. It's both more intuitive to use (returning the time difference as a double) and
faster to calculate, not to mention that it implements the more standard approach.



10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ upstream every once in a while, and merging them into your development branch. D
tests to `test/src/test.c` as appropriate, and if you add new source files, you may need to adjust `test/Makefile`
so that `gcov` coverage is generated for your new source files.
You should aim for 100% diff coverage. When pushing changes to your fork, you can get a coverage report by checking
the Github Actions result of your commit (click the Codecov link), and you can analyze what line(s) of code need to
have tests added. Try to create tests that are simple but meaningful (i.e. check for valid results, rather than just
confirm existing behavior), and try to cover as many realistic scenarios as appropriate. Write lots of tests if you
need to.
the Github Actions result of your commit (click the Coveralls link), and you can analyze what line(s) of code need
to have tests added. Try to create tests that are simple but meaningful (i.e. check for valid results, rather than
just confirm existing behavior), and try to cover as many realistic scenarios as appropriate. Write lots of tests
if you need to.

4. __Pull Request__. Once you feel your work can be integrated, create a pull request from your fork/branch. You can
do that easily from the github page of your fork/branch directly. In the pull request, provide a concise description
of what you added or changed. Your pull request will be reviwed. You may get some feedback at this point, and maybe
of what you added or changed. Your pull request will be reviewed. You may get some feedback at this point, and maybe
there will be discussions about possible improvements or regressions etc. It's a good thing too, and your changes will
likely end up with added polish as a result. You can be all the more proud of it in the end!

Expand Down
Loading

0 comments on commit aac86cc

Please sign in to comment.