Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more flexible CosmoPower network settings. #88

Merged
merged 27 commits into from
Feb 1, 2023

Conversation

HTJense
Copy link
Member

@HTJense HTJense commented Nov 22, 2022

CosmoPower as it currently stands requires the user to include a TT/TE/EE network of NN/PCAplusNN/NN type. Since this is a pretty strict set of requirements, this commit works on changing that.

Instead of each network being defined only by a network path, there is now a network_settings dict within the CosmoPower theory block, which lists each network and what type of network it specifies. This allows one to:

  • include more or fewer networks than just TT/TE/EE (think inclusion of BB or pp).
  • Added support for pp.
  • specify the type of network for each spectrum. No longer is TE specified to be a PCA+NN type, but one can specify the network type for each network individually.
  • The required input parameters are now checked at initialization instead.
  • (4400ef0) If your network has been trained on D_ell instead of C_ell, you can set a flag that will take care of the prefactor (a necessity, based on personal experience).
  • (cdf3e80) Added networks for derived parameter calculation.

Some things that might be worthwhile adding before or after this merge include:

  • Ensure that networks trained over different ell-ranges are supported (right now it still asserts every network operates over the same ell range, but this may not be necessarily true, see also point below).
  • P(k), see also Add CosmoPower P(k, z) emulation  #84.
  • Derived parameter networks (see Boris Bolliet's work). Added in cdf3e80.
  • A better pytest implementation.

@itrharrison itrharrison mentioned this pull request Nov 30, 2022
@HTJense
Copy link
Member Author

HTJense commented Dec 7, 2022

Current state is good enough to go into main branch for me, it already allows for an improved experience by end-users.
Extra features (i.e. non-Cl spectra, derived parameters, better error coverage, etc.) is probably more fitting for a different pull request, to prevent lengthy review & development hell.

Copy link
Collaborator

@itrharrison itrharrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just need to mention that the ell_factors are for CLASS units.

soliket/cosmopower.py Show resolved Hide resolved
@HTJense
Copy link
Member Author

HTJense commented Jan 9, 2023

Any updates on this @itrharrison ?

@itrharrison itrharrison added this to the v0.1 milestone Jan 23, 2023
itrharrison
itrharrison previously approved these changes Feb 1, 2023
Copy link
Collaborator

@itrharrison itrharrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a more extensive test suite, but I am happy with this for now.

soliket/cosmopower.py Outdated Show resolved Hide resolved
@itrharrison itrharrison merged commit 3a98c76 into master Feb 1, 2023
@itrharrison itrharrison deleted the dev-cosmopower-settings branch February 1, 2023 18:45
mgerbino pushed a commit that referenced this pull request Oct 4, 2023
* Allow user-specified number of networks.

* Minor mistake in error string formatting.

* Added option for internal ell-factor in network.

* Bugfix.

* Changed which parameters get passed on to network.

* Added Clpp support.

* Generalized CMB unit factor.

* Added parameter requirements for cobaya standard.

* Added general ell factor function and type hinting.

* Added ell_factor docstring.

* Fixed a bug where cobaya would not resume a run due to default argument overwrite.

* Using BoltzmannBase.renames instead of old system.

* Added Derived parameter network.

* Codestyle.

* Added init file change.

* Docstring changes in prep for #37

* Updated pytest.

* Codestyle.

* codestyle fixes

* fixed data location for tests

* fixed test data path

* syntax for py37

* added need to install cosmopower

---------

Co-authored-by: Ian Harrison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants