Injection and Recovery Tests¶
Injection and recovery class
-
class
rvsearch.inject.
Completeness
(recoveries, xcol='inj_au', ycol='inj_msini', mstar=None, searches=None)[source]¶ Calculate completeness surface from a suite of injections
- Parameters
recoveries (DataFrame) – DataFrame with injection/recovery tests from Injections.save
-
__init__
(recoveries, xcol='inj_au', ycol='inj_msini', mstar=None, searches=None)[source]¶ Object to handle a suite of injection/recovery tests
- Parameters
recoveries (DataFrame) – DataFrame of injection/recovery tests from Injections class
mstar (float) – (optional) stellar mass to use in conversion from p, k to au, msini
xcol (string) – (optional) column name for independent variable. Completeness grids and interpolator will work in these axes
ycol (string) – (optional) column name for dependent variable. Completeness grids and interpolator will work in these axes
-
__weakref__
¶ list of weak references to the object (if defined)
-
completeness_grid
(xlim, ylim, resolution=30, xlogwin=0.5, ylogwin=0.5)[source]¶ Calculate completeness on a fine grid
Compute a 2D moving average in loglog space
- Parameters
xlim (tuple) – min and max x limits
ylim (tuple) – min and max y limits
resolution (int) – (optional) grid is sampled at this resolution
xlogwin (float) – (optional) x width of moving average
ylogwin (float) – (optional) y width of moving average
-
classmethod
from_csv
(recovery_file, *args, **kwargs)[source]¶ Read recoveries and create Completeness object
-
interpolate
(x, y, refresh=False)[source]¶ Interpolate completeness surface
Interpolate completeness surface at x, y. X, y should be in the same units as self.xcol and self.ycol
- Parameters
x (array) – x points to interpolate to
y (array) – y points to interpolate to
refresh (bool) – (optional) refresh the interpolator?
- Returns
completeness value at x and y
- Return type
array
-
class
rvsearch.inject.
Injections
(searchpath, plim, klim, elim, num_sim=1, full_grid=True, verbose=True)[source]¶ Class to perform and record injection and recovery tests for a planetary system.
- Parameters
searchpath (string) – Path to a saved rvsearch.Search object
plim (tuple) – lower and upper period bounds for injections
klim (tuple) – lower and upper k bounds for injections
elim (tuple) – lower and upper e bounds for injections
num_sim (int) – number of planets to simulate
verbose (bool) – show progress bar
-
__init__
(searchpath, plim, klim, elim, num_sim=1, full_grid=True, verbose=True)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__weakref__
¶ list of weak references to the object (if defined)
-
random_planets
(seed)[source]¶ Generate random planets
Produce a DataFrame with random planet parameters
- Parameters
seed (int) – seed for random number generator
- Returns
with columns inj_period, inj_tp, inj_e, inj_w, inj_k
- Return type
DataFrame
-
run_injections
(num_cpus=1)[source]¶ Launch injection/recovery tests
Try to recover all planets defined in self.simulated_planets
- Parameters
num_cpus (int) – number of CPUs to utilize. Each injection will run on a separate CPU. Individual injections are forced to be single-threaded
- Returns
summary of injection/recovery tests
- Return type
DataFrame