kaitiaki.STARSController
Exceptions
Represents an error from the server |
Classes
Represents an instance of the STARS code. |
Functions
|
Installs STARS |
|
Recompiles the STARS code |
|
|
|
Module Contents
- exception kaitiaki.STARSController.ServerError(server_code, message)
Bases:
ExceptionRepresents an error from the server
Syntactic sugar for a server error.
- server_code
- message
- kaitiaki.STARSController.install(install_path)
Installs STARS
Downloads the latest version of AotearoaSTARS from GitHub.
- Parameters:
install_path (str) – The location to install AotearoaSTARS to.
- Raises:
FileNotFoundError – If the repository could not be found
ServerError – If the HTTP response code is not 200
- kaitiaki.STARSController.recompile(install_path)
Recompiles the STARS code
Recompiles the STARS code. Executes make clean && make to do so.
- Parameters:
install_path (str) – The location that the STARS code is installed to
- Returns:
a 2-tuple of 3-tuples representing ((stdout, stderr, termination_reason), (stdout, stderr, termination_reason)) for (make clean, make) respectively.
- Return type:
tuple
- Raises:
ChildProcessError – If either command fails.
- kaitiaki.STARSController._allocate_cores(reserve_core: bool)
- kaitiaki.STARSController._worker_evolve(directory, timeout, mass, do_he_flash, run_bs, STARS)
- class kaitiaki.STARSController.STARSController(verbose_output: bool = True, run_bs: str = '.')
Represents an instance of the STARS code.
- _verbose_output = True
- _output_dir = '.'
- _params
- _run_bs_location = '.'
- _datafile = 'data'
- _options = None
- _lexicon = None
- blit(ZS='z020', directory='.')
Blits the directory given by creating the COTables and data file.
Loads the default data file and the default COtable.
- Parameters:
ZS – the metallicity (BPASS-formatted) to load opacity tables for.
directory – The directory to blit.
- Returns:
None
Notes
Also sets the parameters ZS and CH in the data file. CH is set to 0.75-2.5*ZS.
Creates a new file data in the directory specified.
Creates a new file COtables in the directory specified
- set_period(period, directory='.', boost_max_nmodels=True, forcibly_do_both=False)
Sets the period in the modin file.
- use_lexicon(lexicon)
- update_datafile(new_location)
- update_run_bs(loc)
- fetch_datafile()
- load_default_modin(directory='.', as_secondary=False, Z='z020', set_nmodels_to=99999)
- generate_datafile(loc)
- output(msgtype, message)
Outputs a message to stdout, if verbose_output is on. Does nothing otherwise.
- Parameters:
msgtype (str) – The message type (warning, error, info, status) to output
message (str) – The message to output
- configure_parameters(params)
Sets up the parameters. Doesn’t commit them yet.
- Parameters:
key (params {dict} -- A dictionary containing) – value pairs
datafile. (of what to write to the)
- _write_orbital_equations(block, dfile_name='')
- setup_binary_evolution(dfile='data')
Modifies data to allow for binary evolution. Sets the following :param ID block for binaries: :param IMODE - To 2: :type IMODE - To 2: binaries :param IML1 - To 5: Check what prescription is :type IML1 - To 5: custom :param IML2 - To 5: :type IML2 - To 5: custom :param RML - 0: :type RML - 0: off :param ITH - 1: :type ITH - 1: on :param IX - 1: :type IX - 1: on :param IY - 1: :type IY - 1: on :param IZ - 1: :type IZ - 1: on :param ISTART - 1: :type ISTART - 1: reset age, nmod, dt
- setup_single_evolution(dfile='data')
Modifies data to allow for single star evolution. Sets the following :param ID block for single stars: :param IMODE - To 1: :type IMODE - To 1: single stars :param IML1 - To 5: Check what prescription is :type IML1 - To 5: custom :param IML2 - To 0: :type IML2 - To 0: off - shouldn’t matter though :param RML - 0: :type RML - 0: off :param ITH - 1: :type ITH - 1: on :param IX - 1: :type IX - 1: on :param IY - 1: :type IY - 1: on :param IZ - 1: :type IZ - 1: on :param ISTART - 1: :type ISTART - 1: reset age, nmod, dt
- setup_zams_inflation(mass)
Sets up the data and modin files for ZAMS inflation.
- Parameters:
set. (mass {float} -- the ZAMS mass to)
Notes
This does not actually inflate the star – you still must call STARS.run() after this.
- setup_evolution(mode='single', iml_option=5)
- relax_model()
- set_output_directory(directory)
Sets up the output directory.
If the directory doesn’t exist, this will create it.
- Parameters:
to. (directory {string} -- The directory to output files)
- terminal_command(command, timeout=5 * 60, cwd=None, warn=True)
Included for backwards compatibility.
You should use kaitiaki.terminal.execute() instead
- commit_parameters()
- run(timeout=5 * 60, cwd=None, warn=True, time_me=False)
Runs ./run_bs
- Returns:
tuple – The output from run() above.
- get_last_converged_model(file, as_obj=False)
- get_outfile_models(file: str)
- evolve_async(masses, timeout: int = 20 * 60, evolution_dir: str = '', attempt_he_flash: bool = True, data_params: dict = dict(), reserve_core: bool = True, logged_masses: bool = False, ZAMS_files_location: str = '', metallicity: str = 'z020')
- evolve_through_helium_flash(timeout=30 * 60, filedir='.')
- modout_to_modin(modout_location='modout', modin_location='modin', n_models_ago=0)
Moves the last model in modout to modin
Reads modout to determine the number of lines to move (columns 88-94 of the first line).
- Parameters:
modout_location (str) – The modout file to load (default: “modout”)
modin_location (str) – The modin file to write to (default: “modin”)
n_models_ago (number) – How many models ago to load (e.g. n_models_ago=3 loads 3 models back, n_models_ago=-1 loads the first model in the file, n_models_ago=0 loads the last model in the file.) (default: 0)
- run_default_evolution(zams_mass, NM2=199)
Performs one run from pre-ZAMS until the end of evolution. Assumes NORMAL file structure.
Not really useful for scientific applications – just here for educational purposes on how STARS runs.
- Parameters:
target. (zams_mass {float} -- The ZAMS mass we should)