RVData#
- class thejoker.RVData(t, rv, rv_err, t_ref=None, clean=True)#
Bases:
object
Time-domain radial velocity measurements for a single target.
- Parameters:
t (~astropy.time.Time, array_like) – Array of measurement times. Either as an astropy ~astropy.time.Time object, or as a numpy array of Barycentric MJD (BMJD) values.
rv (~astropy.units.Quantity [speed]) – Radial velocity (RV) measurements.
rv_err (~astropy.units.Quantity [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.
t_ref (numeric (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.clean (bool (optional)) – Filter out any NaN or Inf data points.
Attributes Summary
Covariance matrix
Inverse-variance.
The times of each observation.
Methods Summary
copy
()from_timeseries
(f[, path])guess_from_table
(tbl[, time_kwargs, ...])Try to construct an
RVData
instance by guessing column names from the input table.phase
(P[, t_ref])Convert time to a phase.
plot
([ax, rv_unit, time_format, ...])Plot the data points.
Convert this object into an astropy.timeseries.TimeSeries instance.
Attributes Documentation
- cov#
Covariance matrix
- ivar#
Inverse-variance.
- t#
The times of each observation.
- Returns:
t – An Astropy Time object for all times.
- Return type:
~astropy.time.Time
Methods Documentation
- copy()#
- classmethod from_timeseries(f, path=None)#
- classmethod guess_from_table(tbl, time_kwargs=None, rv_unit=None, fuzzy=False, t_ref=None)#
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:
tbl (~astropy.table.Table) – The source data table.
time_kwargs (dict (optional)) – Additional keyword arguments to pass to the ~astropy.time.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_unit (astropy.units.Unit (optional)) – If not specified via the relevant table column, this specifies the velocity units.
fuzzy (bool (optional)) – Use fuzzy string matching to guess data column names. This requires the
fuzzywuzzy
package.
- phase(P, t_ref=None)#
Convert time to a phase.
By default, the phase is relative to the internal reference epoch,
t_ref
, but a new epoch can also be specified to this method.- Parameters:
P (~astropy.units.Quantity [time]) – The period.
t_ref (~astropy.time.Time (optional)) – Default uses the internal reference epoch. Use this to compute the phase relative to some other epoch
- Returns:
phase – The dimensionless phase of each observation.
- Return type:
~numpy.ndarray
- plot(ax=None, rv_unit=None, time_format='mjd', phase_fold_period=None, relative_to_t_ref=False, add_labels=True, **kwargs)#
Plot the data points.
- Parameters:
ax (~matplotlib.axes.Axes (optional)) – The matplotlib axes object to draw on (default is to grab the current axes object using ~matplotlib.pyplot.gca).
rv_unit (~astropy.units.UnitBase (optional)) – Display the radial velocities with a different unit (default uses whatever unit was passed on creation).
time_format (str, 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 ~astropy.time.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_fold (quantity_like (optional)) – Plot the phase instead of the time by folding on a period value passed in to this argument as an Astropy ~astropy.units.Quantity.
relative_to_t_ref (bool (optional)) – Plot the time relative to the reference epoch,
t_ref
.add_labels (bool (optional)) – Add labels to the figure.
**kwargs – All other keyword arguments are passed to the ~matplotlib.pyplot.errorbar (if errors were provided) or ~matplotlib.pyplot.plot (if no errors provided) call.
- to_timeseries()#
Convert this object into an astropy.timeseries.TimeSeries instance.