cosmosis-campaign "include" option imports runs but not components
Closed this issue · 1 comments
jessmuir commented
Hi Joe!
I just ran into a minor (possible) bug when trying to use the include:
option in a campaign file, where the it seems to load runs, but not components or the output_dir
.
As a simplified example, let's say I have two files, campaign_base.yml
and campaign_altsims.yml
.
The first file campaign_base.yml
contains:
output_dir: "test_output"
components:
simdv:
# save sim fits file
pipeline:
- after 2pt_like save_2pt
params:
- sampler = test
- pipeline.fast_slow = F
# should overwrite this for indidual run
- save_2pt.filename = data_vectors/TESTSIM.fits
runs:
- name: baseline
base: params_baseline.ini
and the second file campaign_altsims.yml
contains
include: campaign_base.yml
runs:
- name: sim_w090
parent: baseline
components:
- simdv
params:
- save_2pt.filename = sim_3x2pt_w-0.90.fits
values:
- cosmological_parameters.w = -0.90
When I try to parse this using cosmosis-campaign -l campaign_altsims.yml
I get the message :
Traceback (most recent call last):
File "/Users/Jlmuir/workspace/cosmosis3/env/bin/cosmosis-campaign", line 4, in <module>
cosmosis.campaign.main(args)
File "/Users/Jlmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 678, in main
runs = parse_yaml_run_file(args.run_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Jlmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 525, in parse_yaml_run_file
runs[name] = build_run(name, run_dict, runs, components, output_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Jlmuir/workspace/cosmosis3/env/lib/python3.11/site-packages/cosmosis/campaign.py", line 418, in build_run
component_info = components[component]
~~~~~~~~~~^^^^^^^^^^^
KeyError: 'simdv'
If I move the simdv component definition over to the campaign_altsims.yml
file, the file loads ok, but puts the output in the current working directory, rather than the output_dir specified in the base yml file.
joezuntz commented
Fixed in version 3.6