Read Input

Module to read user input from files and create standardized input for orbitize

orbitize.read_input.read_file(filename)[source]

Reads data from any file for use in orbitize readable by astropy.io.ascii.read(), including csv format. See the astropy docs.

There are two ways to provide input data to orbitize.

The first way is to provide astrometric measurements, shown with the following example.

Example of an orbitize-readable .csv input file:

epoch,object,raoff,raoff_err,decoff,decoff_err,sep,sep_err,pa,pa_err,rv,rv_err
1234,1,0.010,0.005,0.50,0.05,,,,,,
1235,1,,,,,1.0,0.005,89.0,0.1,,
1236,1,,,,,1.0,0.005,89.3,0.3,,
1237,0,,,,,,,,,10,0.1

Each row must have epoch (in MJD=JD-2400000.5) and object. Objects are numbered with integers, where the primary/central object is 0. If you have, for example, one RV measurement of a star and three astrometric measurements of an orbiting planet, you should put 0 in the object column for the RV point, and 1 in the columns for the astrometric measurements.

Each line must also have at least one of the following sets of valid measurements:

  • RA and DEC offsets [mas], or

  • sep [mas] and PA [degrees East of NCP], or

  • RV measurement [km/s]

Note

Columns with no data can be omitted (e.g. if only separation and PA are given, the raoff, deoff, and rv columns can be excluded).

If more than one valid set is given (e.g. RV measurement and astrometric measurement taken at the same epoch), read_file() will generate a separate output row for each valid set.

Warning

For now, orbitize only accepts astrometric measurements for one secondary body. In a future release, it will also handle astrometric measurements for multiple secondaries, RV measurements of the primary and secondar(ies), and astrometric measurements of the primary. Stay tuned!

Alternatively, you can also supply a data file with the columns already corresponding to the orbitize format (see the example in description of what this method returns). This may be useful if you are wanting to use the output of the write_orbitize_input method.

Note

When providing data with columns in the orbitize format, there should be no empty cells. As in the example below, when quant2 is not applicable, the cell should contain nan.

Parameters

filename (str) – Input file name

Returns

Table containing orbitize-readable input for given object. For the example input above:

 epoch  object  quant1 quant1_err  quant2 quant2_err quant_type
float64  int   float64  float64   float64  float64      str5
------- ------ ------- ---------- ------- ---------- ----------
1234.0      1    0.01      0.005     0.5       0.05      radec
1235.0      1     1.0      0.005    89.0        0.1      seppa
1236.0      1     1.0      0.005    89.3        0.3      seppa
1237.0      0    10.0        0.1     nan        nan         rv

where quant_type is one of “radec”, “seppa”, or “rv”.

If quant_type is “radec” or “seppa”, the units of quant are mas and degrees, if quant_type is “rv”, the units of quant are km/s

Return type

astropy.Table

Written: Henry Ngo, 2018

orbitize.read_input.read_formatted_file(filename)[source]

Version 1.0.2 replaces this function with read_file. Currently exists as a wrapper for read_file and will be removed in v2.0

Written: Henry Ngo, 2018

Deprecated since version 1.0.2: This will be removed in 2.0. Use read_file() instead. v1.0.2 replaces read_formatted_file and read_orbitize_input with read_file(). For now, this will be a wrapper for read_file and will be removed in the v2.0 release.

orbitize.read_input.read_orbitize_input(filename)[source]

Version 1.0.2 replaces this function with read_file. Currently exists as a wrapper for read_file and will be removed in v2.0

Written: Henry Ngo, 2018

Deprecated since version 1.0.2: This will be removed in 2.0. Use read_file() instead. v1.0.2 replaces read_orbitize_input and read_formatted_file with read_file(). For now, this will be a wrapper for read_file and will be removed in the v2.0 release.

orbitize.read_input.write_orbitize_input(table, output_filename, file_type='csv')[source]

Writes orbitize-readable input as an ASCII file

Parameters
  • table (astropy.Table) – Table containing orbitize-readable input for given object, as generated by the read functions in this module.

  • output_filename (str) – csv file to write to

  • file_type (str) –

    Any valid write format for astropy.io.ascii. See the astropy docs. Defaults to csv.

(written) Henry Ngo, 2018