Skip to content

Commit

Permalink
Release 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dcf21 committed Aug 23, 2024
1 parent c1c2b10 commit 82ea99a
Show file tree
Hide file tree
Showing 41 changed files with 291 additions and 125 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.3)
project(ephemeris_compute)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -Wall -std=c99 -D SRCDIR='\"${CMAKE_SOURCE_DIR}/src/\"' -D DCFVERSION='\"x\"' -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0")

include_directories(src)
include_directories(src/argparse)
include_directories(src/coreUtils)
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Use Python 3.10 running on Debian Bullseye
FROM python:3.10-bullseye
# Use Python 3.12 running on Ubuntu 24.04
FROM ubuntu:24.04

# Install required libraries
RUN apt-get update
RUN apt-get install -y wget gzip libgsl-dev ; apt-get clean
RUN apt-get install -y apt-utils dialog file git vim python3 python3-dev \
build-essential make gcc wget gzip libgsl-dev \
pkg-config \
; apt-get clean

# Copy code into container
WORKDIR /
ADD . ephemeris-compute

# Fetch data
WORKDIR /ephemeris-compute
RUN /ephemeris-compute/prettymake clean
RUN /ephemeris-compute/setup.sh

# Check that binary quick-lookup files are generated
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile for EphemerisCompute
#
# -------------------------------------------------
# Copyright 2015-2020 Dominic Ford
# Copyright 2015-2024 Dominic Ford
#
# This file is part of EphemerisCompute.
#
Expand All @@ -21,8 +21,8 @@

CWD=$(shell pwd)

VERSION = 2.0
DATE = 09/06/2019
VERSION = 3.0
DATE = 16/08/2024
PATHLINK= /

WARNINGS = -Wall -Wno-format-truncation -Wno-unknown-pragmas
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Unix-like operating systems.
### License

This code is distributed under the Gnu General Public License. It is (C)
Dominic Ford 2010 - 2022.
Dominic Ford 2010 - 2024.

### Set up

Expand All @@ -47,14 +47,14 @@ provided to build a selection of example starcharts:

```
docker compose build
docker compose run ephmeris-compute-de430
docker compose run ephemeris-compute-de430
```

This produces a single demo ephemeris. To make other ephemerides, open a shell
within the Docker container as follows:

```
docker run -it ephmeris-compute-de430:v1 /bin/bash
docker run -it ephemeris-compute-de430:v3 /bin/bash
```

### Producing an ephemeris
Expand Down Expand Up @@ -124,6 +124,12 @@ This section lists the names which are recognised by the `--objects` command-lin
* `CJ95O010`. Comets may be referred to by their Minor Planet Center designations
* `C<n>`: Comer number `n`. `n` is the line number within the file [Soft00Cmt.txt](http://www.minorplanetcenter.net/iau/Ephemerides/Comets/Soft00Cmt.txt), downloaded from the Minor Planet Center.

### Change history

**Version 3.0** (23 Aug 2024) - Added corrections for light travel time and annual aberration. Improvements to numerical stability when calculating hyperbolic orbits.

**Version 2.0** (16 Oct 2022) - Initial public release.

## Author

This code was developed by Dominic Ford <https://dcford.org.uk>. It is distributed under the Gnu General Public License V3.
Expand Down
2 changes: 1 addition & 1 deletion constellations/constellation_names.dat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# constellation_names.dat
#
# -------------------------------------------------
# Copyright 2015-2019 Dominic Ford
# Copyright 2015-2024 Dominic Ford
#
# This file is part of EphemerisCompute.
#
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: '3'
services:
ephmeris-compute-de430:
ephemeris-compute-de430:
build: .
image: ephmeris-compute-de430:v1
image: ephemeris-compute-de430:v3
command: ./bin/ephem.bin
2 changes: 1 addition & 1 deletion src/asteroids.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Dominic Ford
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/asciiDouble.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// asciiDouble.c
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/asciiDouble.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// asciiDouble.h
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/errorReport.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// errorReport.c
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/errorReport.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// errorReport.h
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/makeRasters.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// makeRasters.c
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/makeRasters.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// makeRasters.h
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreUtils/strConstants.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// strConstants.h
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
83 changes: 61 additions & 22 deletions src/ephemCalc/constellations.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// constellations.c
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down Expand Up @@ -58,7 +58,8 @@ typedef struct {
} constel_desc;

//! constel_desc constel_data - Storage for the 88 constellations which make up the night sky
static constel_desc constel_data[90];
#define MAX_CONSTELLATIONS 90
static constel_desc constel_data[MAX_CONSTELLATIONS];

//! Nconstel - A counter for the number of constellations we have loaded so far
static int Nconstel = 0;
Expand Down Expand Up @@ -94,7 +95,8 @@ static double dWind(double RA, double Dec, double RA0, double Dec0, double RA1,
double xC1 = xB1;
double yC0 = yB0 * cos(-a) + zB0 * sin(-a);
double yC1 = yB1 * cos(-a) + zB1 * sin(-a);
//double zC0 = yB0*sin( a) + zB0*cos(- a); double zC1 = yB1*sin( a) + zB1*cos(- a);
// double zC0 = yB0*sin( a) + zB0*cos(- a);
// double zC1 = yB1*sin( a) + zB1*cos(- a);

double dW;

Expand All @@ -108,15 +110,25 @@ static double dWind(double RA, double Dec, double RA0, double Dec0, double RA1,

void constellations_init() {
FILE *file;
int i;
char line[FNAME_LENGTH], *scan, constellation[6] = "@@@";

Nconstel = 0;

// Scan through catalogue of bound
file = fopen(SRCDIR "../constellations/bound_20.dat", "r");
if (file == NULL) ephem_fatal(__FILE__, __LINE__, "Could not open constellation boundary data");
char line[FNAME_LENGTH], *scan;
char constellation[6] = "@@@"; // Name of constellation we're currently reading in

Nconstel = 0; // Constellation counter. NB: This is 1 when we're reading in constel_data[0]

// Scan through catalogue of constellation boundaries
{
char in_path[FNAME_LENGTH];
snprintf(in_path, FNAME_LENGTH, "%s", SRCDIR "../constellations/bound_20.dat");
file = fopen(in_path, "r");
if (file == NULL) {
char buffer[LSTR_LENGTH];
snprintf(buffer, LSTR_LENGTH, "Could not open constellation boundary data from <%s>.", in_path);
ephem_fatal(__FILE__, __LINE__, buffer);
exit(1);
}
}

// Loop over lines of constellation boundary data
while ((!feof(file)) && (!ferror(file))) {
double ra, dec;
file_readline(file, line);
Expand All @@ -129,15 +141,25 @@ void constellations_init() {
dec = get_float(scan, NULL);
if (line[11] == '-') dec = -dec;

// If constellation name has changed since previous entry, we have a new constellation.
if (strncmp(line + 23, constellation, 4) != 0) {
Nconstel++;
Nconstel++; // Advance constellation counter

// Check for data structure overflow
if (Nconstel >= MAX_CONSTELLATIONS) {
ephem_fatal(__FILE__, __LINE__, "Too many constellations; bound_20.dat is probably corrupted.");
}

// Initialise new constellation data structure
// Note -1 because Nconstel is 1 when reading first record, etc
constel_data[Nconstel - 1].ShortNameSet = 1;
constel_data[Nconstel - 1].LongNameSet = 0;
constel_data[Nconstel - 1].Npoints = 0;
strncpy(constel_data[Nconstel - 1].ShortName, line + 23, 4);
constel_data[Nconstel - 1].ShortName[5] = '\0';
strncpy(constellation, line + 23, 4);
constellation[5] = '\0';

// shortName is 4-letter constellation abbrev
// Note, "SER1" has four letter abbrevs. Most are filed as "AND " with trailing space.
snprintf(constel_data[Nconstel - 1].ShortName, 5, "%s", line + 23);
snprintf(constellation, 5, "%s", line + 23); // Most are filed as "AND " with trailing space
}

constel_data[Nconstel - 1].point[constel_data[Nconstel - 1].Npoints].RA = ra / 12. * M_PI;
Expand All @@ -148,32 +170,49 @@ void constellations_init() {
fclose(file);

// Scan through list of full names
file = fopen(SRCDIR "../constellations/constellation_names.dat", "r");
if (file == NULL) ephem_fatal(__FILE__, __LINE__, "Could not open constellation name data");
{
char in_path[FNAME_LENGTH];
snprintf(in_path, FNAME_LENGTH, "%s", SRCDIR "../constellations/constellation_names.dat");
file = fopen(in_path, "r");
if (file == NULL) {
char buffer[LSTR_LENGTH];
snprintf(buffer, LSTR_LENGTH, "Could not open constellation name data from <%s>.", in_path);
ephem_fatal(__FILE__, __LINE__, buffer);
exit(1);
}
}

while ((!feof(file)) && (!ferror(file))) {
char ShortName[6], LongName[64];
int i, done;

// Read short/long name pair
// Lines take the form:
// short_name long_name
file_readline(file, line);
if ((line[0] == '#') || (strlen(line) < 4)) continue; // Comment line

// Read short name
scan = line + 0;
while ((scan[0] > '\0') && (scan[0] <= ' ')) scan++;
for (i = 0; scan[0] > ' '; i++, scan++) ShortName[i] = *scan;

// Pad short name to ensure it's 4 characters long to match abbreviation above
while (i < 4) ShortName[i++] = ' ';
ShortName[i] = '\0';

// Read long name
while ((scan[0] > '\0') && (scan[0] <= ' ')) scan++;
for (i = 0; scan[0] > ' '; i++, scan++) {
if ((*scan < 'a') && (i > 0)) LongName[i++] = '@';
if ((*scan < 'a') && (i > 0)) LongName[i++] = ' ';
LongName[i] = *scan;
}
LongName[i] = '\0';

// Search for entry in constel_data
// Search for entry in constel_data with matching abbreviated name
for (done = i = 0; i < Nconstel; i++) {
if (!constel_data[i].ShortNameSet) ephem_fatal(__FILE__, __LINE__, "ShortName of constellation not set");
if (strcmp(ShortName, constel_data[i].ShortName) == 0) {
// If we've found constellation with matching abbreviation, insert it's long name into record
strcpy(constel_data[i].LongName, LongName);
constel_data[i].LongNameSet = 1;
done = 1;
Expand All @@ -186,7 +225,7 @@ void constellations_init() {
}
}

for (i = 0; i < Nconstel; i++)
for (int i = 0; i < Nconstel; i++)
if (!constel_data[i].LongNameSet) {
sprintf(temp_err_string, "Could not find long name for constellation'%s'", constel_data[i].ShortName);
ephem_fatal(__FILE__, __LINE__, temp_err_string);
Expand Down
2 changes: 1 addition & 1 deletion src/ephemCalc/constellations.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// constellations.h
//
// -------------------------------------------------
// Copyright 2015-2022 Dominic Ford
// Copyright 2015-2024 Dominic Ford
//
// This file is part of EphemerisCompute.
//
Expand Down
Loading

0 comments on commit 82ea99a

Please sign in to comment.