classy-szfast 0.0.25.post25__tar.gz → 0.0.25.post27__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/PKG-INFO +2 -2
  2. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/classy_szfast.py +18 -7
  3. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/cosmopower_jax.py +6 -2
  4. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast.egg-info/PKG-INFO +2 -2
  5. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/pyproject.toml +1 -1
  6. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/README.md +0 -0
  7. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/__init__.py +0 -0
  8. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/classy_sz.py +0 -0
  9. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/config.py +0 -0
  10. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/cosmopower.py +0 -0
  11. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/cosmosis_classy_szfast_interface.py +0 -0
  12. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/custom_bias/__init__.py +0 -0
  13. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/custom_bias/custom_bias.py +0 -0
  14. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/custom_profiles/__init__.py +0 -0
  15. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/custom_profiles/custom_profiles.py +0 -0
  16. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/emulators_meta_data.py +0 -0
  17. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/pks_and_sigmas.py +0 -0
  18. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/restore_nn.py +0 -0
  19. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/suppress_warnings.py +0 -0
  20. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast/utils.py +0 -0
  21. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast.egg-info/SOURCES.txt +0 -0
  22. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast.egg-info/dependency_links.txt +0 -0
  23. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast.egg-info/requires.txt +0 -0
  24. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/classy_szfast.egg-info/top_level.txt +0 -0
  25. {classy_szfast-0.0.25.post25 → classy_szfast-0.0.25.post27}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: classy_szfast
3
- Version: 0.0.25.post25
3
+ Version: 0.0.25.post27
4
4
  Summary: The accelerator of the class_sz code from https://github.com/CLASS-SZ
5
5
  Maintainer-email: Boris Bolliet <bb667@cam.ac.uk>
6
6
  License: MIT
@@ -13,7 +13,7 @@ from mcfit import TophatVar
13
13
  from scipy.interpolate import CubicSpline
14
14
  import pickle
15
15
  import jax
16
- jax.config.update("jax_enable_x64", False)
16
+ jax.config.update("jax_enable_x64", True)
17
17
  import jax.numpy as jnp
18
18
  import jax.scipy as jscipy
19
19
 
@@ -122,6 +122,7 @@ class Class_szfast(object):
122
122
  self.cp_h_nn = cp_h_nn_jax
123
123
  self.cp_da_nn = cp_da_nn_jax
124
124
  self.cp_pkl_nn = cp_pkl_nn_jax
125
+ self.cp_pknl_nn = cp_pknl_nn_jax
125
126
  self.cp_der_nn = cp_der_nn_jax
126
127
 
127
128
  self.pi = jnp.pi
@@ -130,12 +131,13 @@ class Class_szfast(object):
130
131
  self.log = jnp.log
131
132
  self.pow = jnp.power
132
133
 
133
- self.sigma_B = 2. * self.pow(self.pi,5) * self.pow(Const._k_B_,4) / 15. / self.pow(Const._h_P_,3) / self.pow(Const._c_,2)
134
+ # self.sigma_B = 2. * self.pow(self.pi,5) * self.pow(Const._k_B_,4) / 15. / self.pow(Const._h_P_,3) / self.pow(Const._c_,2)
135
+ self.sigma_B = 5.6704004737209545e-08
134
136
  # print('sigma_B',self.sigma_B)
135
137
  # print('pi',self.pi)
136
138
  # print('k_B',Const._k_B_)
137
139
  # print('h_P',Const._h_P_)
138
- # print('c',Const._c_)
140
+ # # print('c',Const._c_)
139
141
  # print('pow(pi,5)',self.pow(self.pi,5))
140
142
  # print('pow(k_B,4)',self.pow(Const._k_B_,4)) ## this doesnt work if float64 is disabled
141
143
  # print('15.',15.)
@@ -152,6 +154,7 @@ class Class_szfast(object):
152
154
  self.cp_h_nn = cp_h_nn
153
155
  self.cp_da_nn = cp_da_nn
154
156
  self.cp_pkl_nn = cp_pkl_nn
157
+ self.cp_pknl_nn = cp_pknl_nn
155
158
  self.cp_der_nn = cp_der_nn
156
159
  self.pi = np.pi
157
160
  self.transpose = np.transpose
@@ -778,7 +781,10 @@ class Class_szfast(object):
778
781
  for zp in z_arr:
779
782
  params_dict_pp = params_dict.copy()
780
783
  params_dict_pp['z_pk_save_nonclass'] = [zp]
781
- predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predictions_np(params_dict_pp)[0])
784
+ if self.jax_mode:
785
+ predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predict(params_dict_pp))
786
+ else:
787
+ predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predictions_np(params_dict_pp)[0])
782
788
 
783
789
  predicted_pk_spectrum = self.asarray(predicted_pk_spectrum_z)
784
790
 
@@ -789,7 +795,10 @@ class Class_szfast(object):
789
795
  pk_re = self.transpose(pk_re)
790
796
 
791
797
 
792
- self.pknl_interp = PowerSpectrumInterpolator(z_arr,k_arr,self.log(pk_re).T,logP=True)
798
+ if self.jax_mode:
799
+ self.pknl_interp = None
800
+ else:
801
+ self.pknl_interp = PowerSpectrumInterpolator(z_arr,k_arr,self.log(pk_re).T,logP=True)
793
802
 
794
803
 
795
804
  self.cszfast_pk_grid_pknl = pk_re
@@ -876,12 +885,14 @@ class Class_szfast(object):
876
885
 
877
886
  predicted_pk_spectrum_z = []
878
887
 
879
- z_asked = z_asked
880
888
  params_dict_pp = params_dict.copy()
881
889
  update_params_with_defaults(params_dict_pp, self.emulator_dict[self.cosmo_model]['default'])
882
890
 
883
891
  params_dict_pp['z_pk_save_nonclass'] = [z_asked]
884
- predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predictions_np(params_dict_pp)[0])
892
+ if self.jax_mode:
893
+ predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predict(params_dict_pp))
894
+ else:
895
+ predicted_pk_spectrum_z.append(self.cp_pknl_nn[self.cosmo_model].predictions_np(params_dict_pp)[0])
885
896
 
886
897
  predicted_pk_spectrum = self.asarray(predicted_pk_spectrum_z)
887
898
 
@@ -132,8 +132,12 @@ for mp in cosmo_model_list:
132
132
 
133
133
  cp_pp_nn_jax[mp] = Restore_NN(restore_filename=path_to_emulators + 'PP/' + emulator_dict[mp]['PP'])
134
134
 
135
- cp_pknl_nn_jax[mp] = Restore_NN(restore_filename=path_to_emulators + 'PK/' + emulator_dict[mp]['PKNL'])
136
-
135
+ # cp_pknl_nn_jax[mp] = Restore_NN(restore_filename=path_to_emulators + 'PK/' + emulator_dict[mp]['PKNL'])
136
+
137
+ cp_pknl_nn_jax[mp] = CosmoPowerJAX_custom(probe='custom_log',filepath=path_to_emulators +'PK/' + emulator_dict[mp]['PKNL'] + '.npz')
138
+ cp_pknl_nn_jax[mp].ten_to_predictions = False
139
+
140
+
137
141
  cp_pkl_nn_jax[mp] = CosmoPowerJAX_custom(probe='custom_log',filepath=path_to_emulators +'PK/' + emulator_dict[mp]['PKL'] + '.npz')
138
142
  cp_pkl_nn_jax[mp].ten_to_predictions = False
139
143
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: classy_szfast
3
- Version: 0.0.25.post25
3
+ Version: 0.0.25.post27
4
4
  Summary: The accelerator of the class_sz code from https://github.com/CLASS-SZ
5
5
  Maintainer-email: Boris Bolliet <bb667@cam.ac.uk>
6
6
  License: MIT
@@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
- version = "0.0.25.post25"
6
+ version = "0.0.25.post27"
7
7
  license = { text = "MIT" }
8
8
  name = "classy_szfast"
9
9
  maintainers = [{name = "Boris Bolliet",email="bb667@cam.ac.uk"}]