LSSTDESC / firecrown

DESC Cosmology Likelihood Framework
BSD 3-Clause "New" or "Revised" License
29 stars 7 forks source link

Add a save_to_sacc utility function #390

Closed tilmantroester closed 6 months ago

tilmantroester commented 6 months ago

This PR factors out functionality in make_realization into a new GaussFamiliy.get_sacc_indices method and a save_to_sacc function for easier handling of sacc objects. For example, for blinding we need to write a modified data vector back to a sacc file.

Usage:

idx = likelihood.get_indices()
new_sacc = save_to_sacc(
    sacc_data=sacc_data,
    data_vector=new_data_vector,
    indices=idx,
    strict=True,
)

TODO: add tests

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (946e50f) 95.5% compared to head (6784a7a) 95.5%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #390 +/- ## ====================================== Coverage 95.5% 95.5% ====================================== Files 35 35 Lines 2567 2583 +16 ====================================== + Hits 2452 2469 +17 + Misses 115 114 -1 ``` | [Files](https://app.codecov.io/gh/LSSTDESC/firecrown/pull/390?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=LSSTDESC) | Coverage Δ | | |---|---|---| | [firecrown/likelihood/gauss\_family/gauss\_family.py](https://app.codecov.io/gh/LSSTDESC/firecrown/pull/390?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=LSSTDESC#diff-ZmlyZWNyb3duL2xpa2VsaWhvb2QvZ2F1c3NfZmFtaWx5L2dhdXNzX2ZhbWlseS5weQ==) | `99.3% <100.0%> (+0.6%)` | :arrow_up: | | [firecrown/utils.py](https://app.codecov.io/gh/LSSTDESC/firecrown/pull/390?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=LSSTDESC#diff-ZmlyZWNyb3duL3V0aWxzLnB5) | `100.0% <100.0%> (ø)` | |