RVData

class thejoker.RVData(t, rv, rv_err, t0=None, clean=True)[source]

Bases: object

Time-domain radial velocity measurements for a single target.

Parameters
tTime, array_like

Array of measurement times. Either as an astropy Time object, or as a numpy array of Barycentric MJD (BMJD) values.

rvQuantity [speed]

Radial velocity (RV) measurements.

rv_errQuantity [speed] (optional)

If 1D, assumed to be the standard deviation for each RV measurement. If this input is 2-dimensional, this is assumed to be a covariance matrix for all data points.

t0numeric (optional) [day]

A reference time. Default is to use the minimum time in barycentric MJD (days). Set to False to disable subtracting the reference time.

cleanbool (optional)

Filter out any NaN or Inf data points.

Attributes Summary

cov

Covariance matrix

ivar

Inverse-variance.

t

The times of each observation.

Methods Summary

copy(self)

from_timeseries(f)

guess_from_table(tbl[, time_kwargs, …])

Try to construct an RVData instance by guessing column names from the input table.

phase(self, P[, t0])

Convert time to a phase.

plot(self[, ax, rv_unit, time_format, …])

Plot the data points.

to_timeseries(self)

Convert this object into an astropy.timeseries.TimeSeries instance.

Attributes Documentation

cov

Covariance matrix

ivar

Inverse-variance.

t

The times of each observation.

Returns
tTime

An Astropy Time object for all times.

Methods Documentation

copy(self)[source]
classmethod from_timeseries(f)[source]
classmethod guess_from_table(tbl, time_kwargs=None, rv_unit=None, fuzzy=False, t0=None)[source]

Try to construct an RVData instance by guessing column names from the input table.

Note

This is an experimental feature! Use at your own risk.

Parameters
tblTable

The source data table.

time_kwargsdict (optional)

Additional keyword arguments to pass to the Time initializer when passing in the inferred time data column. For example, if you know the time data are in Julian days, you can pass in time_kwargs=dict(format='jd') to improve the guessing.

rv_unitastropy.units.Unit (optional)

If not specified via the relevant table column, this specifies the velocity units.

fuzzybool (optional)

Use fuzzy string matching to guess data column names. This requires the fuzzywuzzy package.

phase(self, P, t0=None)[source]

Convert time to a phase.

By default, the phase is relative to the internal reference epoch, t0, but a new epoch can also be specified to this method.

Parameters
PQuantity [time]

The period.

t0Time (optional)

Default uses the internal reference epoch. Use this to compute the phase relative to some other epoch

Returns
phasendarray

The dimensionless phase of each observation.

plot(self, ax=None, rv_unit=None, time_format='mjd', phase_fold=None, relative_to_t0=False, add_labels=True, color_by=None, **kwargs)[source]

Plot the data points.

Parameters
axAxes (optional)

The matplotlib axes object to draw on (default is to grab the current axes object using gca).

rv_unitUnitBase (optional)

Display the radial velocities with a different unit (default uses whatever unit was passed on creation).

time_formatstr, callable (optional)

The time format to use for the x-axis. This can either be a string, in which case it is assumed to be an attribute of the Time object, or it can be a callable (e.g., function) that does more complex things (for example: time_format=lambda t: t.datetime.day).

phase_foldquantity_like (optional)

Plot the phase instead of the time by folding on a period value passed in to this argument as an Astropy Quantity.

relative_to_t0bool (optional)

Plot the time relative to the reference epoch, t0.

add_labelsbool (optional)

Add labels to the figure.

**kwargs

All other keyword arguments are passed to the errorbar (if errors were provided) or plot (if no errors provided) call.

to_timeseries(self)[source]

Convert this object into an astropy.timeseries.TimeSeries instance.