camber.mesa

Camber has a built-in engine to run workloads for MESA, a software suite to run experiments in stellar evolution.

import camber.mesa

Methods

create_job

Executes a MESA job on CamberCloud.

Arguments

file_dir: str
Supply the file directory containing the MESA inlist files
command: str
The command to execute the MESA job.
Default is ./mk && ./rn
module: str
The module to run simulations (such as star, binary, astero, and so on).
Default is star
sync_mesa_scripts: bool
Whether to sync MESA scripts to the job directory.
Default is True
engine_size: str
The size of the engine. One of XMICRO, MICRO, XXSMALL, XSMALL, SMALL, MEDIUM, or LARGE.
Default is XSMALL.
extra_env_vars: Optional[Dict[str, str]]
Extra environment variables to pass to the MESA job
mesa_version: Optional[str]
The MESA version to use.
Default is r23.05.1
tags: Optional[Union[str, List]]
Tags to add to the job.
e.g. ["tag1", "tag2"] or "tag1".

Returns

CamberJob
The CamberJob object representing the created job.

create_scatter_job

Run multiple parallel MESA jobs.

Supply a list of inlist files that contains templating variables. For example

&pgstar
  ! show HR diagram
    HR_win_flag = $HR_WIN_FLAG

  ! set static plot bounds
    HR_logT_min = $HR_LOGT_MIN
...

Prefix template variables with $. To fill in the template, supply a dictionary of parameters, or param_set, as follows:

param_set = {"HR_WIN_FLAG": ".true.", "HR_LOGT_MIN": 3.5}

When Camber executes this job, it combines the two inputs to generate an actual inlist file used by MESA:

&pgstar
  ! show HR diagram
    HR_win_flag = .true.

  ! set static plot bounds
    HR_logT_min = 3.5

With the same template file, this function provides a way to execute multiple MESA jobs by supplying a param_set list. Each param_set generates a new set of inlist files nested in their param_set or job specific directory. The MESA job executes in this directory. Camber also generates meta.json file in each job directory. This file contains job info alongside the param_set used to template the inlist files.

This means the user creates n jobs from param_sets of length n.

Arguments

param_sets: List[Dict[str, Any]]
The list of parameter sets
inlist_files: List[str]
The list of inlist files with template parameters
model_files: Optional[Union[str, List[str]]]
The list of model files or a single model file to be copied to each job directory.
If a list is provided, it should have the same length as param_sets. Otherwise, the single model will be used for all jobs.
command: str
The command to execute the MESA job.
Default is ./mk && ./rn
module: str
The module to run simulations (such as star, binary, astero, and so on).
Default is star
sync_mesa_scripts: bool
Whether to sync MESA scripts to the job directory.
Default is True
engine_size: str
The size of the engine. One of XMICRO, MICRO, XXSMALL, XSMALL, SMALL, MEDIUM, or LARGE.
Default is XSMALL.
extra_env_vars: Optional[Dict[str, str]]
Extra environment variables to pass to the MESA job
mesa_version: Optional[str]
The MESA version to use.
Default is r23.05.1
tags: Optional[Union[str, List]]
Tags to help identify the job. String or list of strings.

Returns:

List[CamberJob]
The list of CamberJob objects representing the created jobs.

delete_job

Deletes the MESA based CamberJob from your account. Supply the id of the CamberJob.

Arguments:

job_id: Union[int, str]
The id of the CamberJob to delete

get_job

Retrieves the MESA based CamberJob from CamberCloud. Supply the id of the CamberJob.

Arguments:

job_id: Union[int, str]
The id of the CamberJob to retrieve

Returns:

CamberJob
The retrieved CamberJob object.

list_jobs

Lists all MESA based CamberJobs in CamberCloud. Optionally supply the tags to filter the jobs.

Arguments:

tags: Optional[Union[str, List]]
Tags to filter the jobs.

Returns:

List[CamberJob]
The list of CamberJob objects.