Skip to content

feat: allow random_seed and node_redshifts to be set in TOML profiles#618

Open
steven-murray wants to merge 1 commit intomainfrom
full-toml-spec
Open

feat: allow random_seed and node_redshifts to be set in TOML profiles#618
steven-murray wants to merge 1 commit intomainfrom
full-toml-spec

Conversation

@steven-murray
Copy link
Member

This updates the reading/writing of TOML "template" files to allow random_seed and node_redshifts to be written there.

Fixes #559

In particular, this allows for much easier loading of cached coeval boxes after running a simulation. E.g. in the run script you might have...

import py21cmfast as p21c

inputs = p21c.InputParameters.from_template("EOS21", random_seed=1, node_redshifts=[5,6,7,8,9,10])
inputs.write_template("my_parameters.toml")
p21c.run_lightcone(inputs=inputs, write=True)

Now, after running that very large simulation, you would like to read some boxes with the nifty RunCache tool in a separate script. Before this PR you must do:

import py21cmfast as p21c

inputs = p21c.InputParameters.from_template("my_parameters.toml", random_seed=1, node_redshfits=[5,6,7,8,9,10])
....

And hope that you kept the random seed and node redshifts in sync between the two scripts.

Now you can just do:

import py21cmfast as p21c
inputs = p21c.InputParameters.from_template("my_parameters.toml")
...

I made it so that by default if mode='full' in write_template() the full information is written (including random seed and node redshifts). However, if mode="minimal" then these are not written. A minimal template is meant to be more like a "physical model" (like our built in templates) which doesn't try to specify what the exact random seed is.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@steven-murray
Copy link
Member Author

@DanielaBreitman you might be interested in this too

@steven-murray steven-murray self-assigned this Feb 20, 2026
@steven-murray steven-murray added context: cache/io Changes predominantly affect caching or I/O type: feature: ui New feature that adds functionality for the user labels Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 20, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

context: cache/io Changes predominantly affect caching or I/O type: feature: ui New feature that adds functionality for the user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Req.] Ability to store node_redshifts in the TOML spec

1 participant