(doc:yamlconf)=

# YAML config file

A full sample of `CONAN` **.yaml** config file is given below:

```{code-block} yaml
:lineno-start: 1
# ========================================== CONAN YAML Configuration ==========================================
# This is a template YAML configuration file for CONAN v3.3.12
# PRIORS: Fix-'F(val)', Norm-'N(mu,std)', Uni-'U(min,start,max)', TruncNorm–'TN(min,max,mu,std)', LogUni-'LU(min,start,max)'

general:
  n_planet   : 1                                           # number of planets in system

photometry:
  light_curves:
    filepath     : Notebooks/WASP-127/WASP127_LC_RV/../data/   # Light curve data directory
    names        : [lc6bjd.dat, WASP-127_S9.dat]    # List of LC filenames (must be in lc_filepath directory)
    filters      : [R, T]                           # List of Filter names for each LC (for wavelength-dependent analysis)
    wavelength_um: [0.6, 0.8]                       # Central wavelengths in microns for each filter
    supersampling: [None, 30]                       # Supersampling factors for long-cadence data (None for no supersampling, number for subdivision factor)
    clip_outliers: [c1:W11C5n1, c1:W5C4.2n1]        # Outlier clipping settings for each LC (format: 'c[columns]:W[width]C[sigma]n[iterations]', None for no clipping))
    scale_columns: [med_sub, None]                  # Data column rescaling (med_sub=subtract median, rs0to1=rescale 0-1, rs-1to1=rescale -1 to 1, None=no rescaling)
    spline       : [None, None]                     # Spline decorrelation setup for each LC (None for no spline)
    apply_jitter : [y, y]                           # Whether to fit jitter term for each light curve ('y'=yes, 'n'=no)
    baseline:                                       # Baseline model configuration - polynomial orders for each data column of each LC
      offset: [y, y]    # Fit offset term ('y'=yes, 'n'=no)
      col0  : [0, 0]    # Time trend (0=none, 1=linear, 2=quadratic)
      col3  : [0, 0]    # Column 3 decorrelation order
      col4  : [0, 0]    # Column 4 decorrelation order  
      col5  : [2, 0]    # Column 5 decorrelation order
      col6  : [1, 0]    # Column 6 decorrelation order
      col7  : [0, 0]    # Column 7 decorrelation order
      col8  : [0, 0]    # Column 8 decorrelation order
  
  sinusoid:
    names: []    # Light curve names to apply sinusoidal decorrelation
    trig : []    # Trigonometric function: 'sin', 'cos', or 'sincos'
    n    : []    # Number of harmonics
    par  : []    # Data column to decorrelate against
    P    : []    # Period of sinusoid
    amp  : []    # Amplitude of sinusoid
    x0   : []    # Phase offset

  gp:             # Gaussian Process configuration
    - lc_name     : WASP-127_S9.dat       # list of LC names to apply GP. 'same' to fit same gp parameters for the LCs, 'all' for all LCs. filter name to apply GP to can also be given.
      kernel      : [mat32]               # list of GP kernel type: mat32, mat52, exp, cos, sho, etc. use tuple to specify combination of more than one kernel e.g. (mat32, exp)
      par         : [col0]                # Data column for GP independent variable
      h1_amp      : ['LU(20,400,4000)']   # GP amplitude prior
      h2_len_scale: ['LU(0.007,0.4,5)']   # GP length scale prior
      h3_other    : [None]                # Third hyperparameter (kernel-dependent)
      h4_period   : [None]                # Fourth hyperparameter (for periodic kernels)
      operation   : []                    # Kernel combination operation ('+' or '*')
      gp_pck      : ce                    # GP package: 'ce'=celerite, 'ge'=george, 'sp'=spleaf

  limb_darkening:                                       # Limb darkening coefficients (using Kipping parameterization)
    filters: [R, T]                                     # list of unique filter names to 
    q1     : ['N(0.4239,0.0253)', 'N(0.2978,0.0159)']  # list of linear LD coefficients prior for each LC
    q2     : ['N(0.3969,0.0166)', 'N(0.3784,0.0135)']  # list of quadratic LD coefficients prior for each LC

  tdv:                            # Transit depth variation between filters
    fit_ddfs : n                  # Fit depth variations ('y'=yes, 'n'=no)
    drprs    : 'U(-0.5,0,0.5)'    # Depth variation prior. deviation of radius ratio from the reference values in planet_parameters (Uniform: min, start, max)
    div_white: n                  # Divide by white light curve

  ttv:                                      # Transit timing variations
    fit_ttvs       : n                      # Fit TTVs ('y'=yes, 'n'=no)
    dt             : 'U(-0.125, 0, 0.125)'  # prior for the deviation of transit times from the expected values
    baseline       : 0.25                   # Baseline fraction around transit
    per_LC_T0      : False                  # Fit one T0 per LC file vs per transit
    include_partial: True                   # Include partial transits in analysis
    
  phase_curve:                      # Phase curve and secondary eclipse modeling
    filters : [R, T]                # list of filter names
    D_occ   : ['F(0)', 'F(0)']      # prior for the observed Occultation depth in ppm
    Fn      : [None, None]          # prior for the Nightside flux in ppm (None = no phase curve, just transit and/or occultation)
    ph_off  : [None, None]          # prior for the Phase offset in degrees
    A_ev    : ['F(0)', 'F(0)']      # prior for the semi amplitude of ellipsoidal variation (EV) in ppm
    f1_ev   : ['F(0)', 'F(0)']      # prior for fraction amplitude of EV signal. values should range between 0 and 1.
    A_db    : ['F(0)', 'F(0)']      # prior for semi-amplitude of Doppler boosting in ppm.
    pc_model: [cosine, cosine]      # Phase curve model: 'cosine' or 'lambert'

  custom_LC_function:               # Custom light curve function (for non-standard models)
    function       : None           # custom function name
    x              : None           # Independent variable
    func_pars      : None           # dictionary of argument priors to pass to the custom function. e.g {A: 'F(1.2)', B:'N(3,0.5)'}
    extra_args     : None           # dictionary of extra arguments to pass to the custom function
    op_func        : None           # operation function to apply to the output of custom function and transit model to obtain the desired model.
    replace_LCmodel: False          # replace the transit model with the custom model

  contamination:                    # contamination due to flux from other sources in aperture
    filters      : [R, T]           # list of filter names
    contam_factor: ['F(0)', 'F(0)'] # contamination fraction: flux of contaminants/ flux of target within the aperture 

  auto_decorr:               # Automatic decorrelation - finds best baseline model using statistical comparison
    get_decorr  : False      # Set to True to automatically find best decorrelation parameters
    delta_bic   : -5         # BIC improvement threshold for parameter selection (more negative = more conservative)
    exclude_cols: []         # Column numbers to exclude from decorrelation analysis
    exclude_pars: []         # Specific parameters to exclude (e.g., ['A3', 'B4'])
    enforce_pars: []         # Parameters to always include in decorrelation


# ==== RADIAL VELOCITY CONFIGURATION ====
radial_velocity:   
    
  rv_curves:
    filepath     : Notebooks/WASP-127/WASP127_LC_RV/../data/   # Radial velocity data directory
    rv_unit      : km/s                                       # unit for radial velocity data: m/s or km/s 
    names        : [rv1.dat, rv2.dat]
    scale_columns: [med_sub, med_sub]   # Data column rescaling (med_sub=subtract median, rs0to1=rescale 0-1, rs-1to1=rescale -1 to 1, None=no rescaling)
    spline       : [None, None]         # c{column_no}:d{degree}K{knot_spacing} e.g. c0:d3K2 or c0:d3K2|c4:d3K2 for two dimensional
    apply_jitter : [y, y]               # Whether to fit jitter term for each light curve ('y'=yes, 'n'=no)
    baseline:
      gammas: ['N(-9.229240663524008,0.1)', 'N(-9.210554832958305,0.1)']  # systemic velocity priors 
      col0  : [2, 0]
      col3  : [1, 0]
      col4  : [1, 0]
      col5  : [0, 0]
  gp:
    - rv_name     : None    # RV filename (None = no GP)
      kernel      : None    # GP kernel type
      par         : None    # Independent variable column
      h1_amp      : None    # GP amplitude
      h2_len_scale: None    # GP length scale
      h3_other    : None    # Third hyperparameter
      h4_period   : None    # Fourth hyperparameter
      h5_der_amp  : None    # Derivative amplitude (for activity)
      error_col   : None    # Error column for multi-dimensional GP
      operation   :         # Kernel operation
      gp_pck      : n       # GP package ('n' = none)

  custom_RV_function:             # custom RV function
    function       : None         # custom function name
    x              : None         # Independent variable
    func_pars      : None         # dictionary of argument priors to pass to the custom function. e.g {A: 'F(1.2)', B:'N(3,0.5)'}
    extra_args     : None         # dictionary of extra arguments to pass to the custom function
    op_func        : None         # operation function to apply to the output of custom function and transit model to obtain the desired model.
    replace_RVmodel: False        # Replace standard RV model

  auto_decorr:             # Automatic decorrelation for RV data
    get_decorr  : False    # Automatically find best RV decorrelation
    delta_bic   : -5       # BIC threshold for parameter selection
    exclude_cols: []       # Columns to exclude from decorrelation
    exclude_pars: []       # Parameters to exclude
    enforce_pars: []       # Parameters to enforce

    
planet_parameters:
  rho_star    : 'N(0.565,0.035)'                  # Stellar density prior (g/cm³) - alternative to duration parameterization
  Duration    : None                              # Transit duration (alternative to rho_star) - set to None if using rho_star
  RpRs        : ['U(0.05,0.108,0.17)']           # prior Planet-to-star radius ratio. make into list for multiplanet
  Impact_para : ['U(0,0.29,1)']                 # pripr on impact parameter, list for multiplanet
  T_0         : ['N(6776.621239999775,0.001)']    # Mid-transit time (BJD)
  Period      : ['F(4.17806203)']               # Orbital period (days)
  Eccentricity: ['F(0)']                        # prior on eccentricity. list for multiplanet
  omega       : ['F(90)']                       # prior on argument of periastron (degrees: 0-360)    
  sesinw      : None                            # prior on sqrt(e)sinw. alternative to eccentricity/omega      
  secosw      : None                            # prior on sqrt(e)cosw. alternative to eccentricity/omega
  K           : ['U(0,0.01,0.05)']              #prior on RV semi amplitude. in same unit as rv data

stellar_parameters:                             #stellar paramters. only used to convert radius and mass to actual units
  radius_rsun : 'N(1.33, 0.03)'                  #stellar radius in Rsun 
  mass_msun   : 'N(0.95, 0.02)'                   # stellar mass in Msun
  input_method: Rrho                             # Method for stellar parameter input: 'Rrho' uses radius+density, 'Mrho' uses mass+density   

# ==== SAMPLING CONFIGURATION ====
fit_setup:
  sampler                     : dynesty   # Sampling algorithm: 'dynesty' (nested sampling) or 'emcee' (MCMC)
  number_of_processes         : 10        # Number of CPU cores for parallel processing
  
  # === EMCEE Parameters (if sampler='emcee') ===
  emcee_number_steps          : 2000      # Chain length
  emcee_number_chains         : 64        # Number of walkers
  emcee_burnin_length         : 500       # Burn-in steps to discard
  emcee_move                  : stretch   # Move algorithm: 'stretch', 'demc', 'snooker'
  
  # === Dynesty Parameters (if sampler='dynesty') ===
  dynesty_nlive               : 100       # Number of live points
  dynesty_dlogz               : 0.1       # Stopping criterion (evidence tolerance)
  dynesty_nested_sampling     : static    # 'static' or 'dynamic'
  force_nlive                 : False     # Force nlive even if < ndim*(ndim+1)/2
  
  # === Advanced Options ===
  leastsq_for_basepar         : n         # Use least-squares for baseline fitting
  light_travel_time_correction: n         # Apply light travel time correction
  
  # Prior limits (set to 'auto' for automatic determination from data)
  lc_jitter_loglims           : auto      # Log jitter limits for light curves
  rv_jitter_lims              : auto      # Jitter limits for RV data  
  lc_basecoeff_lims           : auto      # Baseline coefficient limits (LC)
  rv_basecoeff_lims           : auto      # Baseline coefficient limits (RV)
  
  # Multi-dimensional GP options (for spleaf package)
  apply_lc_gpndim_jitter      : n         # Jitter for each GP dimension (LC)
  apply_rv_gpndim_jitter      : n         # Jitter for each GP dimension (RV)
  apply_lc_gpndim_offset      : n         # Offset for each GP dimension (LC)  
  apply_rv_gpndim_offset      : n         # Offset for each GP dimension (RV)
# ============ END OF FILE ============================================
```


There are 6 main sections:
`general`: specify the number of planets to model in the LC and RV models.
`photometry`: define the setup for the lightcurves. can be excluded if no lightcurves to analyse.
`radial_velocity`: define the setup for the rvs. Can be excluded if no rv files to analyse.
`planet_parameters`: define priors for fitting the planet's orbit and physical parameters
`stellar_parameters`: give stellar radius and mass to use post-fit to convert planet radius and mass to actual punits. when fitting a phase curve or occultation, the stellar radius is also used to compute the light-travel-time delay.
`fit_setup`: specify the desired sampling strategy and other options.