Skip to content

API documentation

arvi.timeseries.RV

A class holding RV observations

Parameters:

Name Type Description Default
star str

Name of the star

required
instrument (str, list)

Name of the instrument or list of instruments

None
verbose bool

Print logging messages

True
do_maxerror float

Mask points based on a maximum RV uncertainty

None
do_secular_acceleration bool

Apply secular acceleration correction. This only applies to certain instruments.

True
do_sigma_clip bool

Apply sigma clipping on the RVs

False
do_adjust_means bool

Subtract individual weighted mean RV from each instrument

True
only_latest_pipeline bool

Select only the latest pipeline from each instrument

True
load_extra_data bool
False
check_drs_qc bool

Mask points based on DRS quality control flags

True
user str

User name for DACE queries (should be a section in ~/.dacerc file)

None

Examples:

>>> s = RV('Proxima')
>>> s = RV('HD10180', instrument='HARPS')

Attributes

N property

Total number of observations

NN property

Total number of observations per instrument

N_nights property

Number of individual nights

download_directory property writable

Directory where to download data

msvrad property

Masked array of radial velocity uncertainties

mtime property

Masked array of times

mvrad property

Masked array of radial velocities

planets property

Query the NASA Exoplanet Archive for any known planets

rms property

Weighted rms of the (masked) radial velocities

sigma property

Average radial velocity uncertainty

Functions

add_to_quantity(quantity, values)

Add a value or array of values to the given quantity of all instruments

add_to_vrad(values)

Add a value or array of values to the RVs of all instruments

adjust_means(just_rv=False, exclude_rv=False, instrument=None, **kwargs)

Subtract individual weighted mean RV from each instrument or from specific instruments

bin()

Nightly bin the observations.

Warning

This creates and returns a new object and does not modify self.

change_instrument_name(old_name, new_name, strict=False)

Change the name of an instrument

Parameters:

Name Type Description Default
old_name str

The old name of the instrument

required
new_name str

The new name of the instrument, or postfix if strict is False

required
strict bool

Whether to match (each) instrument exactly

False

checksum(write_to=None)

Calculate a hash based on the data

choose_n_points(n, seed=None, instrument=None)

Randomly choose n observations and mask out the remaining ones

Parameters:

Name Type Description Default
n int

Number of observations to keep.

required
seed int

Random seed for reproducibility.

None
instrument str or list

For which instrument to choose points (default is all).

None

clip_maxerror(maxerror)

Mask out points with RV error larger than a given value

Parameters:

Name Type Description Default
maxerror float

Maximum error to keep.

required

detrend(degree=1)

Detrend the RVs of all instruments

download_ccf(instrument=None, index=None, limit=None, directory=None, clobber=False, symlink=False, load=True, **kwargs)

Download CCFs from DACE

Parameters:

Name Type Description Default
instrument str

Specific instrument for which to download data

None
index int

Specific index of point for which to download data (0-based)

None
limit int

Maximum number of files to download.

None
directory str

Directory where to store data.

None
clobber bool

Whether to overwrite existing files.

False

download_s1d(instrument=None, index=None, limit=None, directory=None, clobber=False, apply_mask=True, symlink=False, **kwargs)

Download S1Ds from DACE

Parameters:

Name Type Description Default
instrument str

Specific instrument for which to download data

None
index int

Specific index of point for which to download data (0-based)

None
limit int

Maximum number of files to download.

None
directory str

Directory where to store data.

None
clobber bool

Whether to overwrite existing files.

False
apply_mask bool

Apply mask to the observations before downloading.

True

download_s2d(instrument=None, index=None, limit=None, directory=None, clobber=False, symlink=False, **kwargs)

Download S2Ds from DACE

Parameters:

Name Type Description Default
instrument str

Specific instrument for which to download data

None
index int

Specific index of point for which to download data (0-based)

None
limit int

Maximum number of files to download.

None
directory str

Directory where to store data.

None
clobber bool

Whether to overwrite existing files.

False

from_ccf(files, star=None, instrument=None, **kwargs) classmethod

Create an RV object from a CCF file or a list of CCF files

Note

This function relies on the iCCF package

Parameters:

Name Type Description Default
files str or list

CCF file or list of CCF files

required
star str

Star name. If not provided, it will be inferred from the header of the CCF file

None
instrument str

Instrument name. If not provided, it will be inferred from the header of the CCF file

None

from_rdb(files, star=None, instrument=None, instrument_suffix=None, units='ms', header_skip=2, **kwargs) classmethod

Create an RV object from an rdb file or a list of rdb files

Parameters:

Name Type Description Default
files (str, list)

File name, file object, or list of file names

required
star str

Name of the star. If None, try to infer it from file name

None
instrument (str, list)

Name of the instrument(s). If None, try to infer it from file name

None
units str

Units of the radial velocities. Defaults to 'ms'.

'ms'
header_skip int

Number of lines to skip in the header. Defaults to 2.

2

Examples:

>>> s = RV.from_rdb('star_HARPS.rdb')

nth_day_mean(n=1.0, masked=True)

Calculate the n-th day rolling mean of the radial velocities

put_at_systemic_velocity()

For instruments in which mean(RV) < ptp(RV), "move" RVs to the systemic velocity from simbad. This is useful if some instruments are centered at zero while others are not, and instead of calling .adjust_means(), but it only works when the systemic velocity is smaller than ptp(RV).

remove_after_bjd(bjd)

Remove observations after a given BJD

remove_before_bjd(bjd)

Remove observations before a given BJD

remove_between_bjds(bjd1, bjd2)

Remove observations between two BJDs

remove_condition(condition)

Remove all observations that satisfy a condition

Parameters:

Name Type Description Default
condition ndarray

Boolean array of the same length as the observations

required

remove_instrument(instrument, strict=False)

Remove all observations from one instrument

Parameters:

Name Type Description Default
instrument str or list

The instrument(s) for which to remove observations.

required
strict bool

Whether to match (each) instrument exactly

False
Note

A common name can be used to remove observations for several subsets of a given instrument. For example

s.remove_instrument('HARPS')

will remove observations from HARPS03 and HARPS15, if they exist. But

s.remove_instrument('HARPS03')

will only remove observations from the specific subset.

remove_non_public()

Remove non-public observations

remove_point(index)

Remove individual observations at a given index (or indices).

Note

Like Python, the index is 0-based.

Parameters:

Name Type Description Default
index (int, list, ndarray)

Single index, list, or array of indices to remove.

required

remove_prog_id(prog_id)

Remove observations from a given program ID

remove_public()

Remove public observations

remove_single_observations()

Remove instruments for which there is a single observation

replace_quantity(quantity, values)

Replace the given quantity of all instruments by a value or array of values

replace_svrad(values)

Replace the RV uncertainties of all instruments with a value or array of values

replace_vrad(values)

Replace the RVs of all instruments with a value or array of values

restore_point(index)

Restore previously deleted individual observations at a given index (or indices).

Note

Like Python, the index is 0-based

Parameters:

Name Type Description Default
index (int, list, ndarray)

Single index, list, or array of indices to restore

required

save(directory=None, instrument=None, full=False, postfix=None, save_masked=False, save_nans=True)

Save the observations in .rdb files.

Parameters:

Name Type Description Default
directory str

Directory where to save the .rdb files.

None
instrument str

Instrument for which to save observations.

None
full bool

Save just RVs and errors (False) or more indicators (True).

False
postfix str

Postfix to add to the filenames ([star][instrument][postfix].rdb).

None

secular_acceleration(epoch=None, just_compute=False, force_simbad=False)

Remove secular acceleration from RVs. This uses the proper motions from Gaia (in self.gaia) if available, otherwise from Simbad (in self.simbad), unless force_simbad=True.

Parameters:

Name Type Description Default
epoch float

The reference epoch (DACE uses 55500, 31/10/2010)

None
just_compute bool

Just compute the secular acceleration and return, without changing the RVs

False
force_simbad bool

Use Simbad proper motions even if Gaia is available

False

sigmaclip(sigma=5, instrument=None, strict=True)

Sigma-clip RVs (per instrument!), by MAD away from the median.

Parameters:

Name Type Description Default
sigma float

Number of MADs to clip

5
instrument (str, list)

Instrument(s) to sigma-clip

None

sort_instruments(by_first_observation=True, by_last_observation=False)

Sort instruments by first or last observation date.

Parameters:

Name Type Description Default
by_first_observation bool

Sort by first observation date

True
by_last_observation bool

Sort by last observation date

False

subtract_mean()

Subtract (a single) non-weighted mean RV from all instruments

Sub-packages

The following are mostly internal packages and functions with which a user may not need to interact directly.

arvi.simbad API

arvi.simbad(star, _debug=False)

A very simple wrapper around a TAP query to simbad for a given target. This class simply runs a few TAP queries and stores the result as attributes.

Attributes:

Name Type Description
ra float

right ascension

dec float

declination

coords SkyCoord

coordinates as a SkyCoord object

main_id str

main identifier

gaia_id int

Gaia DR3 identifier

plx float

parallax

rvz_radvel float

radial velocity

sp_type str

spectral type

B float

B magnitude

V float

V magnitude

ids list

list of identifiers

Parameters:

Name Type Description Default
star str

The name of the star to query simbad

required
arvi.stats API

arvi.stats

rms(a, ignore_nans=False)

Root mean square of array a

Parameters:

Name Type Description Default
a array

Array containing data

required

sigmaclip_median(a, low=4.0, high=4.0)

Same as scipy.stats.sigmaclip but using the median and median absolute deviation instead of the mean and standard deviation.

Parameters:

Name Type Description Default
a array

Array containing data

required
low float

Number of MAD to use for the lower clipping limit

4.0
high float

Number of MAD to use for the upper clipping limit

4.0

Returns: SigmaclipResult: Object with the following attributes: - clipped: Masked array of data - lower: Lower clipping limit - upper: Upper clipping limit

wmean(a, e)

Weighted mean of array a, with uncertainties given by e. The weighted mean is calculated using 1/e**2 as weights.

Parameters:

Name Type Description Default
a array

Array containing data

required
e array

Uncertainties on a

required

wrms(a, e, ignore_nans=False)

Weighted root mean square of array a, with uncertanty given by e. The weighted rms is calculated using the weighted mean, where the weights are equal to 1/e**2.

Parameters:

Name Type Description Default
a array

Array containing data

required
e array

Uncertainties on a

required