California-Planet-Search / rvsearch

RV Planet Search Pipeline Based on RadVel
http://california-planet-search.github.io/rvsearch/
MIT License
10 stars 5 forks source link

Can't set max_planets #206

Closed aberrico closed 1 year ago

aberrico commented 1 year ago

I'm running rvsearch using the following commands: rvsearch find -s /path_to/rvsearch_example_data/HD103774.py rvsearch plot -t summary -d /path/HD103774 rvsearch inject -d /path/HD103774 rvsearch plot -t recovery -d /path/HD103774

I want to set max_planets = 1 because the search lasts too long and is finding a lot of planets that are no really there, but I don't know how to set it. I tried in a couple of places in my python file, but none of them worked. Here is my python file. Thanks in advance

HD103774.py

Example Keplerian fit configuration file

Required packages for setup

import os import pandas as pd import numpy as np import radvel

Define global planetary system and dataset parameters

starname = 'HD103774' nplanets = 1 # number of planets in the system instnames = ['HARPS_post', 'HARPS_pre','Minerva'] # list of instrument names. Can be whatever you like (no spaces) but should match 'tel' column in the input file. ntels = len(instnames) # number of instruments with unique velocity zero-points fitting_basis = 'per tc secosw sesinw logk' # Fitting basis, see radvel.basis.BASIS_NAMES for available basis names bjd0 = 0 # reference epoch for RV timestamps (i.e. this number has been subtracted off your timestamps) planet_letters = {1: 'b'} # map the numbers in the Parameters keys to planet letters (for plotting and tables)

max_planets = 1

Define prior centers (initial guesses) in a basis of your choice (need not be in the fitting basis)

anybasis_params = radvel.Parameters(nplanets,basis='per tc e w k', planet_letters=planet_letters) # initialize Parameters object

anybasis_params['per1'] = radvel.Parameter(value=5.8881) # period of 1st planet anybasis_params['tc1'] = radvel.Parameter(value=2455693.566) # time of inferior conjunction of 1st planet anybasis_params['e1'] = radvel.Parameter(value=0.09) # eccentricity of 1st planet anybasis_params['w1'] = radvel.Parameter(value=327.885) # argument of periastron of the star's orbit for 1st planet anybasis_params['k1'] = radvel.Parameter(value=33.469) # velocity semi-amplitude for 1st planet

time_base = 2455785 # abscissa for slope and curvature terms (should be near mid-point of time baseline) anybasis_params['dvdt'] = radvel.Parameter(value=0.0) # slope: (If rv is m/s and time is days then [dvdt] is m/s/day) anybasis_params['curv'] = radvel.Parameter(value=0.0) # curvature: (If rv is m/s and time is days then [curv] is m/s/day^2)

analytically calculate gamma if vary=False and linear=True ****

anybasis_params['gamma_HARPS_pre'] = radvel.Parameter(value=-3049.84) # velocity zero-point for HARPS_pre anybasis_params['gamma_HARPS_post'] = radvel.Parameter(value=3.43) # " " HARPS_post anybasis_params['gamma_Minerva'] = radvel.Parameter(value=-21.01) # " " Minerva

anybasis_params['jit_HARPS_pre'] = radvel.Parameter(value=0.75) # jitter for HARPS_pre anybasis_params['jit_HARPS_post'] = radvel.Parameter(value=0.0) # " " HARPS_post anybasis_params['jit_Minerva'] = radvel.Parameter(value=0.0) # " " HARPS_post

Convert input orbital parameters into the fitting basis

params = anybasis_params.basis.to_any_basis(anybasis_params,fitting_basis)

Set the 'vary' attributes of each of the parameters in the fitting basis. A parameter's 'vary' attribute should

be set to False if you wish to hold it fixed during the fitting process. By default, all 'vary' parameters

are set to True.

params['dvdt'].vary = False params['curv'].vary = False

Load radial velocity data, in this example the data is contained in

an ASCII file, must have 'time', 'mnvel', 'errvel', and 'tel' keys

the velocities are expected to be in m/s

data = pd.read_csv(os.path.join(radvel.DATADIR,'HD103774'), sep=' ')

Define prior shapes and widths here.

priors = [ radvel.prior.EccentricityPrior( nplanets ), # Keeps eccentricity < 1 radvel.prior.Gaussian('tc1', params['tc1'].value, 3), # Gaussian prior on tc1 with center at tc1 and width 3 days radvel.prior.HardBounds('jit_HARPS_pre', 0.0, 10000), radvel.prior.HardBounds('jit_HARPS_post', 0.0, 10000), radvel.prior.HardBounds('jit_Minerva', 0.0, 10000) ]

optional argument that can contain stellar mass in solar units (mstar) and

uncertainty (mstar_err). If not set, mstar will be set to nan.

stellar = dict(mstar=1.335, mstar_err=0.03, max_planets=1)

bjfultn commented 1 year ago

You can use the --maxplanets flag in the rvsearch find command. Use rvsearch find --help to see the list of available options.