TOML Input Files

There are two ways to use Starlord: importing it in Python and using the API, or defining a model in a TOML file and passing it to Starlord on the command line. The latter is an easier place to start. Here’s a minimal example using the demo grid (created in Grid Management):

[model]
# Starting with the likelihood terms, based on demo grid outputs
# The demo grid is defined in Grid Management docs, but it's just:
# x, y -> out1, out2; ratio
demo_grid.out1 = ["normal", 30.5, 3.0]
demo_grid.ratio = ["normal", 0.3, 0.05]
# grid.output_name = [distribution name, the parameters]

# This implicitly defined x and y (the demogrid params),
# so we must set their priors:
prior.x = ["uniform", 0, 10.0]
prior.y = [5.0, 2.0]
# (An omitted distribution name implies "normal")

[sampling]
# Picking a sampler and settings its options
sampler = "emcee"
emcee_run.nsteps = 1000

[output]
# Print a summary to the terminal and write the samples to "demo.npz"
terminal = true
file = "demo.npz"

Notice that it has three sections: model, sampling, and output. The first sets up the statistical model to be fitted, including any likelihood terms, priors, and intermediate variable definitions (see Defining a Model). The next section, sampling lets you select the sampler and the options for it, as well as run-time constants (see Sampling). Finally, the output section defines what Starlord should actually do with the data. For now this is quite minimal – you can set terminal output on or off and select a file to write the results to in the npz format. If you omit this, no output file is written.

Note

When you specify a grid variable, Starlord will handle interpolation and set inputs automatically according to the grid’s defaults. This can including interpolating additional grids or defining new parameters. Use starlord -da your_model.toml to see how Starlord interprets your model.