Skip to content

Commit

Permalink
More fixes, more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Feb 5, 2024
1 parent 4c2d0dc commit 16d1264
Show file tree
Hide file tree
Showing 54 changed files with 2,345 additions and 985 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
**/apidoc/**
**/test/data/**
**/*~
README-pruned.md

9 changes: 5 additions & 4 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PROJECT_NUMBER = v0.9
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "The Naval Obseervatory NOVAS library made more usable"
PROJECT_BRIEF = "The Naval Obseervatory NOVAS library, made better"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down Expand Up @@ -1013,7 +1013,6 @@ FILE_PATTERNS = *.c \
*.inc \
*.m \
*.markdown \
*.md \
*.mm \
*.dox \
*.doc \
Expand All @@ -1031,7 +1030,9 @@ FILE_PATTERNS = *.c \
*.vhdl \
*.ucf \
*.qsf \
*.ice
*.ice \
*.mm \
README-pruned.md

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
Expand Down Expand Up @@ -1164,7 +1165,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE = README.md
USE_MDFILE_AS_MAINPAGE = README-pruned.md

# The Fortran standard specifies that for fixed formatted Fortran code all
# characters from position 72 are to be considered as comment. A common
Expand Down
30 changes: 18 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
include config.mk




# ===============================================================================
# Specific build targets and recipes below...
# ===============================================================================
Expand All @@ -17,9 +15,6 @@ include config.mk
.PHONY: api
api: static shared cio_file dox

.PHONY: all
all: api solsys tools test coverage check

.PHONY: static
static: lib/novas.a

Expand All @@ -41,6 +36,21 @@ test: tools
coverage: test
make -C test coverage

.PHONY: all
all: api solsys tools test coverage check

.PHONY: clean
clean:
rm -f README-pruned.md
@make -C tools clean
@make -C test clean

.PHONY: distclean
distclean:
@make -C tools clean
@make -C test clean


# Static library: novas.a
lib/novas.a: $(OBJECTS) | lib
ar -rc $@ $^
Expand All @@ -58,14 +68,10 @@ cio_file: lib/novas.a
obj/jplint.o: $(SRC)/jplint.f
gfortran -c -o $@ $<

README-pruned.md: README.md
tail -n +`sed -n '/\# /{=;q;}' $<` $< > $@

clean:
@make -C tools clean
@make -C test clean

distclean:
@make -C tools clean
@make -C test clean
dox: README-pruned.md


# ===============================================================================
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@
![Static Analysis](https://github.com/Smithsonian/SuperNOVAS/actions/workflows/check.yml/badge.svg)
![API documentation](https://github.com/Smithsonian/SuperNOVAS/actions/workflows/dox.yml/badge.svg)


<img ><br clear="all">

<picture>
<!-- User prefers dark mode: -->
<source srcset="resources/CfA-logo-dark.png" alt="CfA logo" media="(prefers-color-scheme: dark)"/>

<!-- User prefers light mode: -->
<source srcset="resources/CfA-logo.png" alt="CfA logo" media="(prefers-color-scheme: light)"/>

<!-- default: -->
<img src="resources/CfA-logo.png" alt="CfA logo" width="400" height="66" align="right"/>
</picture>
<br clear="all">
Expand Down Expand Up @@ -196,12 +188,16 @@ code:
resulting in incorrect observed radial velocities being reported for spectroscopic observations.

- Fixes bug in `ira_equinox()` which may return the result for the wrong type of equinox if the the `equinox`
argument was changing from 1 to 0, and back to 1 again with the date being held the same.
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()`.

- Fixes accuracy bug in `ecl2equ_vec()`, `equ2ecl_vec()`, `geo_posvel()`, `place()`, and `sidereal_time()`, which
could return a cached value for the other accuracy if the other input parameters are the same as a prior call,
except the accuracy.

- The use of `fmod()` in NOVAS C 3.1 led to the wrong results when the numerator was negative, since `fmod()` is
not the mathematical definition of a modulus. This affected `solsys3.c` for dates prior to J2000. Fixed by using
`remainder()` instead of `fmod()` (throughout the library).

-----------------------------------------------------------------------------

Expand Down
12 changes: 7 additions & 5 deletions build.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

# ===============================================================================
# Generic build targets and recipes.
# You can include this in your Makefile
# ===============================================================================
# ============================================================================
# Generic build targets and recipes for SuperNOVAS.
#
# You can include this in your Makefile also.
# ============================================================================


# Regular object files
Expand All @@ -18,7 +19,8 @@ dep obj lib bin apidoc:
clean-local:
rm -rf obj dep

# Remove all locally built files, effectively restoring the repo to its pristine state
# Remove all locally built files, effectively restoring the repo to its
# pristine state
.PHONY: distclean-local
distclean-local: clean-local
rm -rf bin lib apidoc
Expand Down
70 changes: 46 additions & 24 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# ===============================================================================
# Generic configuration options for
# You can include this in your Makefile
# ===============================================================================
# ============================================================================
# Generic configuration options for building the SuperNOVAS libraries (both
# static and shared).
#
# You can include this snipplet in your Makefile also.
# ============================================================================

PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

Expand All @@ -15,42 +17,52 @@ CFLAGS = -Os -Wall -Wextra -I$(INC)
# For maximum compatibility with NOVAS C 3.1, uncomment the line below
#CFLAGS += -DCOMPAT=1

# You can set the default CIO locator file to use depending on where you installed it.
# By default, the library will assume '/usr/share/novas/cio_ra.bin', or simply 'cio_ra.bin'
# if the COMPAT flag is set to a nonzero value (above). Some other good locations
# for this file may be in '/usr/local/share/novas', or '/opt/share/novas' for system-wide
# availability, or in '$(HOME)/.local/share/novas' for user-specific installation.
# You can set the default CIO locator file to use depending on where you
# installed it. By default, the library will assume
# '/usr/share/novas/cio_ra.bin', or else 'cio_ra.bin' if the COMPAT flag is
# set to a nonzero value (above). Some other good locations for this file may
# be in '/usr/local/share/novas', or '/opt/share/novas' for system-wide
# availability, or in '$(HOME)/.local/share/novas' for user-specific
# installation.
#
#CFLAGS += -DDEFAULT_CIO_LOCATOR_FILE="/user/share/novas/cio_ra.bin"

# Whether to build into the library specific versions of solarsystem()
# Whether to build into the library planet_eph_manager() routines provided in
# solsys1.c
BUILTIN_SOLSYS1 = 1

# Whether to build into the library planet_jplint() routines provided in
# solsys2.c.
#BUILTIN_SOLSYS2 = 1

# Whether to build into the library earth_sun_calc() routines provided in
# solsys3.c
BUILTIN_SOLSYS3 = 1

# Compile library with a default solarsystem() implementation, which will be used
# only if the application does not define another implementation via calls to the
# to set_solarsystem() type functions.
# Whether to build into the library planet_ephem_reader() routines provided in
# solsys3.c
BUILTIN_SOLSYS_EPHEM = 1

# Compile library with a default solarsystem() implementation. If you want to
# use your library with your own solarsystem() implementation, you should
# not set this option. In that case you must always provide a solarsystem()
# implementation when linking your application against this library.
DEFAULT_SOLSYS = 3

# Compile library with a default readeph() implementation, which will be used
# only if the application does not define another implementation via calls to the
# to set_ephem_reader() function.
# only if the application does not define another implementation via calls to
# the to set_ephem_reader() function.
DEFAULT_READEPH = readeph0

# Compiler and linker options etc.
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g
endif

# cppcheck options
CHECKOPTS = --enable=performance,warning,portability,style --language=c --error-exitcode=1
CHECKOPTS = --enable=performance,warning,portability,style --language=c \
--error-exitcode=1

# ===============================================================================
# ============================================================================
# END of user config section.
#
# Below are some generated constants based on the one that were set above
# ===============================================================================
# ============================================================================

ifeq ($(DEFAULT_SOLSYS), 1)
BUILTIN_SOLSYS1 = 1
Expand Down Expand Up @@ -84,12 +96,22 @@ ifeq ($(BUILTIN_SOLSYS3), 1)
CFLAGS += -DBUILTIN_SOLSYS3=1
endif

ifeq ($(BUILTIN_SOLSYS_EPHEM), 1)
SOURCES += $(SRC)/solsys-ephem.c
endif

ifdef (DEFAULT_READEPH)
SOURCES += $(SRC)/$(DEFAULT_READEPH).c
CFLAGS += -DDEFAULT_READEPH=1
endif


# Compiler and linker options etc.
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g
endif

# Generate a list of object (obj/*.o) files from the input sources
OBJECTS := $(subst $(SRC),obj,$(SOURCES))
OBJECTS := $(subst .c,.o,$(OBJECTS))


32 changes: 21 additions & 11 deletions include/novas.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ enum novas_observer_place {
*/
enum novas_reference_system {
NOVAS_GCRS = 0, ///< Geocentric Celestial Reference system. Essentially the same as ICRS, but with velocities referenced to Earth's orbiting frame.
NOVAS_TOD, ///< True equinox Of Date: dynamical system of the true equator, with its origin at the true equinox (pre IAU 2006 system).
NOVAS_CIRS, ///< Celestial Intermediate Reference System: dynamical system of the true equator, with its origin at the CIO (preferred since IAU 2006)
NOVAS_TOD, ///< True equinox Of Date: dynamical system of the true equator, with its origin at the true equinox (pre IAU 2006 system).
NOVAS_CIRS, ///< Celestial Intermediate Reference System: dynamical system of the true equator, with its origin at the CIO (preferred since IAU 2006)
NOVAS_ICRS ///< International Celestiual Reference system. The equatorial system fixed to the frame of distant quasars.
};

Expand Down Expand Up @@ -358,8 +358,12 @@ enum novas_cio_location_type {
* @sa WOBBLE_ITRS_TO_TIRS
*/
enum novas_wobble_direction {
WOBBLE_ITRS_TO_TIRS = 0, ///< use for wobble() to change from ITRS to TIRS.
WOBBLE_TIRS_TO_ITRS ///< to use for wobble() to change from TIRS to ITRS. (You can use any non-zero value as well.)
WOBBLE_ITRS_TO_PEF = 0, ///< use for wobble() to change from ITRS (actual rotating Earth) to Pseudo Earth Fixed (PEF).
/**
* use for wobble() to change from Pseudo Earth Fixed (PEF) to ITRS (actual rotating Earth).
* (You can use any non-zero value as well.)
*/
WOBBLE_PEF_TO_ITRS
};

/**
Expand Down Expand Up @@ -726,24 +730,30 @@ int make_on_surface(double latitude, double longitude, double height, double tem
int make_in_space(const double *sc_pos, const double *sc_vel, in_space *obs_space);

// Added API in SuperNOVAS
int calc_pos(const object *source, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
enum novas_accuracy accuracy, sky_pos *pos);

int calc_frame_pos(const object *source, const astro_frame *frame, enum novas_accuracy accuracy, sky_pos *pos);
int place_in_frame(const object *source, const astro_frame *frame, enum novas_accuracy accuracy, sky_pos *pos);

int calc_star_pos(const cat_entry *star, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
int place_star(const cat_entry *star, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
enum novas_accuracy accuracy, sky_pos *pos);

int calc_icrs_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
int place_icrs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);

int place_gcrs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);

int place_cirs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);

int calc_gcrs_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
int place_tod(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);

int calc_dynamical_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);

int cio_set_locator_file(const char *filename);

int nutation_set_lp(novas_nutate_func f);

#include "solarsystem.h"






#endif /* _NOVAS_ */
Loading

0 comments on commit 16d1264

Please sign in to comment.