Git Product home page Git Product logo

orbitspp's Introduction

orbitspp

Update of the Bernstein & Khushalani orbit-fitting software for outer solar system bodies. Improvements include:

  • All object-oriented code in C++
  • Improve algorithms to avoid wayward solutions for very distant objects and high-e orbits.
  • Use of multiprocessing for large-scale use [not yet]
  • Switch to currently supported libraries: ** NASA/JPL cspice code for planetary ephemerides ** Eigen for linear algebra

Prerequisites

Installation

  • First, install the three external prereqs as per their instructions, being sure to use the compiler you will use for this code. I found the installation for CSPICE to be nonstandard and clunky. Before running the build script I had to set up the CXX and CC environment variables and setenv TKCOMPILER gcc-6 to use my gcc-6 compiler too. For the Mac, I had to alter several scripts replace ar, ranlib calls with libtool -static -o $LIBRARY.a *.o. Then I needed to change the output library name to libcspice.a to meet the usual conventions so the linker can find it.
  • The makefiles for my repos take their cues from environment variables. The csh version for my setup looks like:
setenv G6_DIR ~/G6
# These variables should point to the places you've installed the
# other packages.  The .h files for each (except EIGEN, which is
# header-only) should be in /include subdirectories of each of these.
setenv EIGEN_DIR $G6_DIR/include
setenv SPICE_DIR $G6_DIR/cspice
setenv CFITSIO_DIR $G6_DIR/cfitsio
setenv GBUTIL_DIR ~/CODE/gbutil
setenv GBFITS_DIR ~/CODE/gbfits
setenv ASTROMETRY_DIR ~/CODE/astrometry

# Give your compilation commands here
setenv CXX "g++-6 -fopenmp -march=haswell"
setenv CC "gcc-6 -fopenmp -march=haswell"
setenv CXXFLAGS "-O"

# Use whatever command you need to point to these packages libraries
# for runtime linking, e.g. maybe LD_LIBRARY_PATH here.
setenv DYLD_LIBRARY_PATH $CFITSIO_DIR/lib:$SPICE_DIR/lib

# These variables are needed during execution of the program.
# The orbit-fitting code uses them as default paths to important
# files.
# Note that this repo's /data directory contains the needed files
# for our TNO tasks.
# This one gives the locations of CTIO and other observatories:
setenv ORBIT_OBSERVATORIES $HOME/CODE/orbitspp/data/observatories.dat
# This one points to the master data file for SPICE:
setenv SPICE_KERNEL $HOME/CODE/orbitspp/data/de430.tm
# This is data on all the DES exposures
setenv DES_EXPOSURE_TABLE $HOME/CODE/orbitspp/data/alldes.exposure.positions.fits
  • With these set up, you should just be able to type make in the root directory of this repository. It will automatically execute the makefiles in the other three repos. make clean will likewise clean up the other ones too.
  • Executables will end up in the orbitspp/bin directory. Put that in your path as needed.
  • make tests will build some test programs and install them in orbitspp/testbin. I haven't yet documented the proper usage of these tests though.
  • The SPICE kernel file in data/de430.tm tells SPICE where to find its data files. The PATH_VALUES line should be changed to match the directory where you keep such things, e.g. the /data subdir of this repo. Either edit this file, or (preferentially, to keep it from getting rewritten every time you pull the repo) make another version with a new name and make sure that the SPICE_KERNEL environment variable points to it.

Usage

Apologies that documentation is currently minimal. Most of the executables will give you brief help if called with no arguments or with -h as an argument.

Once you've built the executables, some simple tests/demos can be done as follows:

% bin/MpcFit junk < testdata/pluto14yr.ast > junk.fit

will run the MpcFit program on the fictitious observations of Pluto stored in the specified .ast file. The stderr output will be various diagnostics of the fit, including the residual errors. Two new files named junk.aei and junk.abg will be created with ASCII renditions' of the results of the fit, in element space and in the BK sort-of-cartesian system. The elements in junk.aei should make sense for Pluto and be close (but not exactly match) the elements in the saved file testdata/pluto14yr.aei. The testdata/pluto14yr.ast is an example of the MPC-like format that can be used as input to this program to fit a single object's observations. There are also some example files for 1992 QB1 = Albion and for some fictitious Planet 9 observations.

With the junk.fit program that results from std output of MpcFit, one can predict future positions (or past) with a command such as

% bin/PrintEphemeris -startdate 2022.0 -enddate 2023.0 -stepdate 30 < junk.fit

The various bin/Bulk* executables are written to process larger amounts of data for multiple objects, using input and output in FITS tables. Their help messages give some details about formats.

Some gotchas

The code only knows about observatories whose MPC codes appear in the file data/observatories.dat. You'll need to add the relevant info about new sites to that file.

The CFITSIO software is a bit picky about data types, so beware of these details: in the input FITS files to the Bulk*cpp programs, the EXPNUM column should 4-byte integers (FITS type "J") and the ORBITID and OBJID columns should be 8-byte (FITS type "K"). The MJD and other coordinate columns should be double-precision ("D").

orbitspp's People

Contributors

gbernstein avatar bernardinelli avatar

Stargazers

Jorge Martínez-Palomera avatar  avatar Jake Kurlander avatar Oromion avatar  avatar Mario Juric avatar Hanno Rein avatar Mike Alexandersen avatar

Watchers

 avatar Mike Alexandersen avatar  avatar

orbitspp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.