Skip to content

Pure CCL creation mode fails when using amplitude parameter As in CosmoSIS #596

@Arara09

Description

@Arara09

Describe the bug
When creating a ModelingTools with amplitude parameter As and using the pure_ccl_mode creation method, the parameter provided in CosmoSIS's values.ini file, the parameter is not mapped into Firecrown's CCL cosmology. As a result, Firecrown raises a RuntimeError due to the missing As parameter.

To Reproduce
Steps to reproduce the behavior:

  1. Enter the firecrown/examples/des_y1_3x2pt folder
  2. Open pure_ccl_experiment.yaml and add the following key to the ccl_factory dict: amplitude_parameter: 'as'
  3. Enter the cosmosis folder
  4. Open values.ini and modify line 14. Replace sigma_8 = 0.801 with A_s_1e9 = 5.0e-1 1.9019 5.0
  5. Run cosmosis pure_ccl.ini

Expected behavior
The CosmoSIS pipeline should execute the 'test' sampler and print out the prior, likelihood and posterior values.

Observed behavior
The pipeline terminates with an error be, returning an error.

Output

Deprecated: The [pipeline] quiet option is deprecated.  Set [runtime] verbosity instead.
Setting up pipeline from parameter file pure_ccl.ini
----------------------------------------------------

Setting up module consistency
------------------------------

Setting up module firecrown_likelihood
---------------------------------------
Setup all pipeline modules

Module timing:
consistency 0.001353
firecrown_likelihood 12.231582

Parameter Priors
----------------
cosmological_parameters--omega_c     ~ U(0.06, 0.46)
cosmological_parameters--omega_b     ~ U(0.03, 0.07)
cosmological_parameters--omega_k     ~ delta(0.0)
cosmological_parameters--tau         ~ delta(0.08)
cosmological_parameters--n_s         ~ delta(0.971)
cosmological_parameters--a_s_1e9     ~ U(0.5, 5.0)
cosmological_parameters--h0          ~ delta(0.682)
cosmological_parameters--w           ~ delta(-1.0)
cosmological_parameters--wa          ~ delta(0.0)
cosmological_parameters--mnu         ~ delta(0.06)
cosmological_parameters--nnu         ~ delta(3.046)
cosmological_parameters--yhe         ~ delta(0.2454)
cosmological_parameters--tcmb        ~ delta(2.7255)
firecrown_two_point--ia_bias         ~ U(-5.0, 5.0)
firecrown_two_point--alphaz          ~ U(-5.0, 5.0)
firecrown_two_point--z_piv           ~ delta(0.62)
firecrown_two_point--lens0_bias      ~ U(0.8, 3.0)
firecrown_two_point--lens1_bias      ~ U(0.8, 3.0)
firecrown_two_point--lens2_bias      ~ U(0.8, 3.0)
firecrown_two_point--lens3_bias      ~ U(0.8, 3.0)
firecrown_two_point--lens4_bias      ~ U(0.8, 3.0)
firecrown_two_point--src0_delta_z    ~ U(-0.05, 0.05)
firecrown_two_point--src1_delta_z    ~ U(-0.05, 0.05)
firecrown_two_point--src2_delta_z    ~ U(-0.05, 0.05)
firecrown_two_point--src3_delta_z    ~ U(-0.05, 0.05)
firecrown_two_point--lens0_delta_z   ~ U(-0.05, 0.05)
firecrown_two_point--lens1_delta_z   ~ U(-0.05, 0.05)
firecrown_two_point--lens2_delta_z   ~ U(-0.05, 0.05)
firecrown_two_point--lens3_delta_z   ~ U(-0.05, 0.05)
firecrown_two_point--lens4_delta_z   ~ U(-0.05, 0.05)
firecrown_two_point--src0_mult_bias  ~ U(0.001, 0.1)
firecrown_two_point--src1_mult_bias  ~ U(0.001, 0.1)
firecrown_two_point--src2_mult_bias  ~ U(0.001, 0.1)
firecrown_two_point--src3_mult_bias  ~ U(0.001, 0.1)

****************************************************
* Running sampler 1/1: test
* Running in serial mode.
****************************************************
consistency took: 0.004 seconds
Traceback (most recent call last):
  File "/home/pedro/DESC/firecrown/firecrown/updatable/_base.py", line 177, in update
    value = params.get_from_full_name(parameter.fullname)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/DESC/firecrown/firecrown/parameters/_map.py", line 145, in get_from_full_name
    raise KeyError(f"Key {full_name} not found.")
KeyError: 'Key A_s not found.'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pedro/DESC/firecrown/firecrown/connector/cosmosis/likelihood.py", line 288, in update_likelihood_and_tools
    self.tools.update(firecrown_params, updated_records)
  File "/home/pedro/DESC/firecrown/firecrown/updatable/_base.py", line 204, in update
    item.update(params, updated_record=child_records)
  File "/home/pedro/DESC/firecrown/firecrown/updatable/_base.py", line 179, in update
    raise MissingSamplerParameterError(parameter.fullname) from exc
firecrown.updatable._exceptions.MissingSamplerParameterError: The parameter `A_s` is required to update something in this likelihood.
It should have been supplied by the sampling framework.
The object being updated was:
A_s


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pedro/miniforge3/envs/project_314/bin/cosmosis", line 4, in <module>
    status = cosmosis.main.main()
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/main.py", line 549, in main
    return run_cosmosis(ini=args.inifile, pool=None, override=args.params, profile_mem=args.mem, profile_cpu=args.profile, variables=args.variables, only=args.only)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/main.py", line 417, in run_cosmosis
    sampler_main_loop(sampler, output, pool, is_root)
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/main.py", line 72, in sampler_main_loop
    sampler.execute()
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/samplers/test/test_sampler.py", line 31, in execute
    like, extra, data = self.pipeline.likelihood(p, return_data=True)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/runtime/pipeline.py", line 1331, in likelihood
    data = self.run_parameters(p, all_params=all_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/runtime/pipeline.py", line 1106, in run_parameters
    if self.run(data):
       ^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/runtime/pipeline.py", line 632, in run
    status = module.execute(data_package)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/miniforge3/envs/project_314/lib/python3.12/site-packages/cosmosis/runtime/module.py", line 246, in execute
    return self.execute_function(data_block, self.data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/DESC/firecrown/firecrown/connector/cosmosis/likelihood.py", line 370, in execute
    return instance.execute(sample)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/DESC/firecrown/firecrown/connector/cosmosis/likelihood.py", line 143, in execute
    updated_records = self.update_likelihood_and_tools(firecrown_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pedro/DESC/firecrown/firecrown/connector/cosmosis/likelihood.py", line 294, in update_likelihood_and_tools
    raise RuntimeError(msg) from exc
RuntimeError: A required parameter was not found in any of the sections searched on DataBlock.
These are specified by the space-separated string `sampling_parameter_sections`.
The supplied value was: `firecrown_two_point`
The missing parameter is named: `A_s`

Configuration:
Please include all relevant information about your configuration:

  • Firecrown version: '1.15.0a0'
  • Master branch (commit 34d1bdb)
  • Developer installation
  • Output of conda list | grep firecrown : firecrown 1.15.0a0 pypi_0 pypi
  • OS and version: Ubuntu 24.04.3 LTS
  • Architecture: x86_64
  • Python version: 3.12.12

Additional context
I think the problem resides in the 'set_params_from_cosmosis' function, as it only maps the sigma8 parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions