-
Notifications
You must be signed in to change notification settings - Fork 83
quality of life fix for pip users #1289
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,16 @@ class MatterPowerSpectra(Enum): | |
| 'emulator': lib.emulator_nlpk | ||
| } | ||
|
|
||
| def _camb_available(): | ||
| try: | ||
| import camb # noqa: F401 | ||
| return True | ||
| except ImportError: | ||
| return False | ||
|
|
||
|
|
||
| _DEFAULT_TRANSFER_FUNCTION = 'boltzmann_camb' if _camb_available() else 'eisenstein_hu' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to keep |
||
|
|
||
| _TOP_LEVEL_MODULES = ("",) | ||
|
|
||
|
|
||
|
|
@@ -238,7 +248,7 @@ def __init__( | |
| Neff=None, m_nu=0., mass_split='normal', w0=-1., wa=0., | ||
| T_CMB=DefaultParams.T_CMB, | ||
| T_ncdm=DefaultParams.T_ncdm, | ||
| transfer_function='boltzmann_camb', | ||
| transfer_function=_DEFAULT_TRANSFER_FUNCTION, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As said above. Revert this. |
||
| matter_power_spectrum='halofit', | ||
| baryonic_effects=None, | ||
| mg_parametrization=None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,9 +39,9 @@ def test_power_mu_sigma_sigma8norm(tf): | |
| assert np.allclose(pk_rat, gfac) | ||
|
|
||
| with mock.patch.dict(sys.modules, {'isitgr': None}): | ||
| with pytest.raises(ModuleNotFoundError): | ||
| with pytest.raises(ccl.CCLError): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? Isn't |
||
| get_isitgr_pk_lin(cosmo) | ||
| # Importing ccl without isitgr is fine. No ModuleNotFoundError triggered. | ||
| # Importing ccl without isitgr is fine. No error triggered. | ||
| with mock.patch.dict(sys.modules, {'isitgr': None}): | ||
| reload(ccl.boltzmann) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,11 @@ dev = [ | |
| "pytest-cov", | ||
| ] | ||
|
|
||
| boltzmann = ["camb", "classy", "isitgr"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would keep |
||
| pt = ["velocileptors", "fast-pt"] | ||
| emulators = ["baccoemu", "MiraTitanHMFemulator", "dark_emulator"] | ||
| full = ["camb", "classy", "isitgr", "velocileptors", "fast-pt", "baccoemu", "MiraTitanHMFemulator", "dark_emulator"] | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| include = ["pyccl*"] | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said above, we won't change the default transfer function so remove these lines.