Skip to content

Migrating to kima v3

João Faria edited this page May 23, 2019 · 2 revisions

Going from kima version 2 to version 3, some backwards-incompatible changes were introduced.

Here are a few tips on how to convert your previous code.

  • The start of the kima_setup.cpp files is simpler
    While before we had to #include a bunch of files, now it's enough to do #include "kima.h" once.

  • Setting priors is less error-prone
    In version 3, the syntax to define priors changed completely. All priors are now set inside the RVmodel constructor. Instead of

    Cprior = new Uniform(-10, 10);

    we now use

    Cprior = make_prior<Uniform>(-10, 10);

    Even if this is slightly more verbose, it's a much easier solution to default priors. This new syntax allows the default prior for the systemic velocity or the slope of the linear trend to depend on the RV data without you having to write anything.

  • No more default_priors.h
    There are still default priors, but kima will use them if you don't do anything in the RVmodel constructor

  • Loading data is simpler
    Before we had to do

    Data::get_instance().load(datafile, "ms", 0);

    while now this is enough

    load(datafile, "ms", 0);

    The same in multi instrument mode:

    load_multi(datafiles, "kms", 2)
  • Some variables are already defined
    Related to the point above, in v3 you can simply write

    datafile = "filename"

    or

    datafiles = {"filename1", "filename2"}

    When including correlations with activity indicators, it's enough to set

    indicators = {"fwhm", "bis"}