CobayaSampler / cobaya

Code for Bayesian Analysis
http://cobaya.readthedocs.io/en/latest/
Other
128 stars 127 forks source link

$COBAYA_MODULES env variable? #32

Closed timothydmorton closed 5 years ago

timothydmorton commented 5 years ago

Just another suggestion as you move toward 2.0-- have you considered using a $COBAYA_MODULES environment variable as the default modules directory? That way, if modules isn't passed in an info string, then you can just default to os.getenv('COBAYA_MODULES', None) or something like that as the modules path. This would also make it easier to share .yaml files between machines (e.g., would avoid having to hard-code paths).

If you're interested, I'm happy to give a shot at a PR along these lines.

JesusTorrado commented 5 years ago

Already there https://github.com/CobayaSampler/cobaya/blob/master/cobaya/run.py#L136

But I see now that it's not documented. Will add to the docs, thanks!

timothydmorton commented 5 years ago

Great!

timothydmorton commented 5 years ago

Could cobaya-install also default to using $COBAYA_MODULES if -m is not provided?

(cobaya) [tmorton@perseus ~]$ export COBAYA_MODULES=/tigress/tmorton/cosmology/modules
(cobaya) [tmorton@perseus ~]$ cobaya-install cosmo
usage: cobaya-install [-h] -m /install/path [-f] [--no-progress-bars]
                      [-C | -D]
                      input_file.yaml [input_file.yaml ...]
cobaya-install: error: the following arguments are required: -m/--modules
JesusTorrado commented 5 years ago

Added and both documented. I hope you don't mind that it will come with 2.0: cherry-picking is a little dangerous at the moment (quite a few changes). It'll be in <2 weeks anyway.