How to ... Use Orbfit5.0 to Generate Ephemerides for Asteroids and Comets

How to ... Use Orbfit5.0 to Generate Ephemerides for Asteroids and Comets

A tutorial on how to get orbfit running to generate an ephemeris

OrbFit comes with four main programs Orbfit, Fitobs, Catpro and Bineph. In this tutorial we’re focusing on OrbFit’s title track, Orbfit, which can reportedly run in a non-interactive, batch-mode to perform a various operations on the orbits of asteroids and comets. However, in my experience so far orbfit neither works in non-interactive or batch-mode straight out of the box, but I’ve managed to generate a workflow that gets us part-way there.

A Workspace with Input Files

To start using Orbfit, you’ll need to generate/download some files containing the input data required. The 2 types1 of input files required are:

  1. An observation file stored in a specified obsdir directory (extensions include .rwo, .obs, .rad)
  2. An orbital elements file2.

As well as the input files, you will need to write an options file (with extension .oop) which tells OrbFit where the input files3 can be found and what exactly you want OrbFit to do.

Let’s go ahead and create a workspace with an options file and some input files. Make a directory somewhere called orbfit-workspace and change into it:

$ mkdir ~/Desktop/orbfit-workspace
$ cd ~/Desktop/orbfit-workspace

Now download the Lowell Observatory astorb flavour of orbital elements from here and uncompress.

wget ftp://ftp.lowell.edu/pub/elgb/astorb.dat.gz
gunzip astorb.dat.gz

Finally grab my template options file and dummy observation files from this gist (click on the ‘Download ZIP’ button). Now you should have 3 files in your workspace:

$ ls
astorb.dat
dummy.obs
orbfit-template-run-options.oop

Getting OrbFit to Run in Non-Interactive Mode

The orbfit.x executable seems to want to run in interactive-mode. If you run the command orbfit.x, it then prompts you for the Run Name which is the name of your options file without the extension, i.e. orbfit-template-run-options. To get round this interactiveness you can run the command like so:

$ echo "orbfit-template-run-options" | orbfit.x

which gets orbit to run straight away:

$ orbfit.x
 Run name =
orbfit-template-run-options
 Run name = orbfit-template-run-options
 JPL planetary ephemerides DE413
 number of perturbers =            0
 binary ephemerides file= CPV
 perturbing asteroids used: none
 ngr_opt =  F
 No .rwo file, reading .obs and/or .rad files.
 input_obs:            1  obs in ./dummy.obs
 Using .rwo file, but checking .obs,.rad for update.
 input_obs:            1  obs from  ./dummy.rwo
 input_obs:           1  obs from  ./dummy.obs
 There are no updates in .obs or .rad files.
Scanning file "astorb.dat" (format: BA2)
        Semimajor axis     =  3.1166357900000001E+00 au
        Eccentricity       =   0.115222750000000
        Inclination        =  12.5288100000000 deg
        Long. of node      = 148.0323380000000 deg
        Arg. of pericenter = 357.0506910000000 deg
        Mean anomaly       =  39.3705710000000 deg
Scanning file "astorb.dat" (format: BA2)
        Semimajor axis     =  3.1166357900000001E+00 au
        Eccentricity       =   0.115222750000000
        Inclination        =  12.5288100000000 deg
        Long. of node      = 148.0323380000000 deg
        Arg. of pericenter = 357.0506910000000 deg
        Mean anomaly       =  39.3705710000000 deg
 ORBFIT: propagation of orbital elements
  write_elems: ndim.ne.nd        32767           6
  write_elems: ndim.ne.nd        32767           6
 ORBFIT: generating ephemerides

and you will find an ephemeris file has been created called orbfit-template-run-options.oep containing the following:

Ephemeris for object 1999 YQ10
     Origin of orbital elements: read from file "astorb.dat" at record 49980


                                     Equatorial coordinates                                                    App. motion     
    Date      Hour      MJD            RAJ2000            DEC  Mag   Delta     R     SolEl  Phase Glat      RA/dt      DEC/dt  
             (UTC)     (UTC)        h  m  s        d  '  "            (au)    (au)   (deg)  (deg) (deg)   arcsec/s    arcsec/s 
 =========== ====== ============  =============  ============ ===== ======= ======= ====== ====== =====  ==========  ==========
 12 Jun 2017  0.000 57916.000000    7 40 56.720  +19  2 19.41 21.51  3.2776  2.4865 -32.87  12.81 19.21  1.7256E-02 -2.6170E-03

Ephemeris for object 1999 YQ10
     Origin of orbital elements: read from file "astorb.dat" at record 49980


                                     Equatorial coordinates                                                    App. motion     
    Date      Hour      MJD            RAJ2000            DEC  Mag   Delta     R     SolEl  Phase Glat      RA/dt      DEC/dt  
             (UTC)     (UTC)        h  m  s        d  '  "            (au)    (au)   (deg)  (deg) (deg)   arcsec/s    arcsec/s 
 =========== ====== ============  =============  ============ ===== ======= ======= ====== ====== =====  ==========  ==========
 12 Jun 2017  0.000 57916.000000    7 40 56.720  +19  2 19.41 21.51  3.2776  2.4865 -32.87  12.81 19.21  1.7256E-02 -2.6170E-03

Note the duplication of results due to the fact that the options file lists ‘1999 YQ10’ as both object 1 and 2.


  1. There is another type of input file requried, the jpleph binary ephemerides file, but this should have been generated at the install stage. This JPL ephemerides file provides the dynamic model of the Solar System used for for orbit propagation.  ↩

  2. can contain either a set of six numbers defining the orbit of one object at some epoch, or a list of the orbital elements for many asteroids and/or comets (e.g. astorb.dat)  ↩

  3. note there are hardwired default input–filenames and options so in many cases you will just be tweaking whatever values you need to for your specific use–case.  ↩