Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions examples/templates/Planck18.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#highL_unlensed_cl_template = /uufs/astro.utah.edu/common/home/u6011908/.local/lib/python3.6/site-packages/camb/HighLExtrapTemplate_lenspotentialCls.dat
number_of_threads = 0
DebugParam = 0.00000000000000
feedback_level = 1
get_scalar_cls = F
get_vector_cls = F
get_tensor_cls = F
want_CMB = T
want_CMB_lensing = T
limber_windows = T
limber_phiphi = 100
Do21cm = F
get_transfer = T
accuracy_boost = 1
l_accuracy_boost = 1
do_nonlinear = 0
evolve_baryon_cs = F
evolve_delta_xe = F
evolve_delta_ts = F
l_min = 2
dark_energy_model = fluid
use_tabulated_w = F
w = -1
wa = 0.000000000000000E+000
cs2_lam = 1
hubble = 67.36
use_physical = T
ombh2 = 0.02237
omch2 = 0.1200
omnuh2 = 0.0006
omk = 0.0
temp_cmb = 2.7255
helium_fraction = 0.247695
massless_neutrinos = 2.0306666666666664
nu_mass_eigenstates = 1
massive_neutrinos = 1
share_delta_neff = F
nu_mass_degeneracies = 1.0153333333333332
nu_mass_fractions = 1
transfer_high_precision = T
accurate_massive_neutrino_transfers = F
transfer_kmax = 1152.5
transfer_k_per_logint = 0
transfer_num_redshifts = 2
transfer_interp_matterpower = T
transfer_power_var = 7
transfer_redshift(1) = 2.406
transfer_redshift(2) = 0.
Alens = 1.00000000000000
reionization = T
re_use_optical_depth = T
re_optical_depth = 0.0544
re_delta_redshift = 1.5
re_ionization_frac = -1
re_helium_redshift = 3.50000000000000
re_helium_delta_redshift = 0.400000000000000
re_helium_redshiftstart = 5.50000000000000
pivot_scalar = 0.05
pivot_tensor = 0.05
initial_power_num = 1
scalar_spectral_index(1) = 0.9649
scalar_nrun(1) = 0
scalar_nrunrun = 0.000000000000000E+000
scalar_amp(1) = 2.100e-9
recombination_model = Recfast
RECFAST_fudge_He = 0.86
RECFAST_Heswitch = 6
RECFAST_Hswitch = T
RECFAST_fudge = 1.14
AGauss1 = -0.140000000000000
AGauss2 = 7.900000000000000E-002
zGauss1 = 7.28000000000000
zGauss2 = 6.73000000000000
wGauss1 = 0.180000000000000
wGauss2 = 0.330000000000000
initial_condition = 1
use_cl_spline_template = T
derived_parameters = T
accurate_polarization = T
accurate_reionization = T
accurate_BB = F
do_late_rad_truncation = T
massive_nu_approx = 1
l_sample_boost = 1
output_root = Planck18
transfer_filename(1) = transfer.dat
transfer_matterpower(1) = matterpower.dat
transfer_filename(2) = transfer_z0.dat
transfer_matterpower(2) = matterpower_z0.dat
do_lensing_bispectrum = F
do_primordial_bispectrum = F
CMB_outputscale = 7.42835025e12
version_check = 1.0.4
output_file_headers = T
78 changes: 78 additions & 0 deletions examples/templates/PlanckDR12_kmax_params.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
output_root = PlanckDR12_kmax
get_scalar_cls = F
get_vector_cls = F
get_tensor_cls = F
CMB_outputscale = 7.42835025e12
get_transfer = T
accuracy_boost = 1
l_accuracy_boost = 1
high_accuracy_default = T
do_nonlinear = 0
w = -1
cs2_lam = 1
hubble = 67.31
use_physical = T
ombh2 = 0.02222
omch2 = 0.1197
omnuh2 = 0.0006
omk = 0
temp_cmb = 2.7255
helium_fraction = 0.247695
massless_neutrinos = 2.0306666666666664
massive_neutrinos = 1.0153333333333332
nu_mass_eigenstates = 1
nu_mass_degeneracies = 0
nu_mass_fractions = 1
transfer_high_precision = T
transfer_kmax = 1152.5
transfer_k_per_logint = 0
transfer_num_redshifts = 3
transfer_interp_matterpower = T
transfer_power_var = 7
transfer_redshift(1) = 2.3
transfer_filename(1) = transfer.dat
transfer_matterpower(1) = matterpower.dat
transfer_redshift(2) = 0.57
transfer_filename(2) = transfer_z057.dat
transfer_matterpower(2) = matterpower_z057.dat
transfer_redshift(3) = 0
transfer_filename(3) = transfer_z0.dat
transfer_matterpower(3) = matterpower_z0.dat
DebugParam = 0.00000000000000
Alens = 1.00000000000000
reionization = T
re_use_optical_depth = T
re_optical_depth = 0.078
re_delta_redshift = 1.5
re_ionization_frac = -1
pivot_scalar = 0.05
pivot_tensor = 0.05
initial_power_num = 1
scalar_spectral_index(1) = 0.9655
scalar_nrun(1) = 0
scalar_amp(1) = 2.19551119e-9
RECFAST_fudge_He = 0.86
RECFAST_Heswitch = 6
RECFAST_Hswitch = T
RECFAST_fudge = 1.14
AGauss1 = -0.140000000000000
AGauss2 = 7.900000000000000E-002
zGauss1 = 7.28000000000000
zGauss2 = 6.73000000000000
wGauss1 = 0.180000000000000
wGauss2 = 0.330000000000000
do_lensing_bispectrum = F
do_primordial_bispectrum = F
initial_condition = 1
accurate_polarization = T
accurate_reionization = T
accurate_BB = F
derived_parameters = T
version_check = July13
do_late_rad_truncation = T
do_tensor_neutrinos = T
feedback_level = 1
massive_nu_approx = 1
number_of_threads = 0
use_spline_template = T
l_sample_boost = 1
8 changes: 8 additions & 0 deletions py/picca/bin/picca_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ def main(cmdargs=None):
help=("Equation of state of dark energy of fiducial " "LambdaCDM cosmology"),
)

parser.add_argument(
"--distance-template",
type=str,
required=False,
help=("Template cosmology to use in distance calculations. "),
)

parser.add_argument(
"--no-project",
action="store_true",
Expand Down Expand Up @@ -380,6 +387,7 @@ def main(cmdargs=None):
Ok=args.fid_Ok,
wl=args.fid_wl,
blinding=blinding,
template=args.distance_template
)

t0 = time.time()
Expand Down
8 changes: 8 additions & 0 deletions py/picca/bin/picca_dmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ def main(cmdargs=None):
help="Equation of state of dark energy of fiducial LambdaCDM cosmology",
)

parser.add_argument(
"--distance-template",
type=str,
required=False,
help=("Template cosmology to use in distance calculations. "),
)

parser.add_argument(
"--remove-same-half-plate-close-pairs",
action="store_true",
Expand Down Expand Up @@ -403,6 +410,7 @@ def main(cmdargs=None):
Ok=args.fid_Ok,
wl=args.fid_wl,
blinding=blinding,
template=args.distance_template
)

t0 = time.time()
Expand Down
8 changes: 8 additions & 0 deletions py/picca/bin/picca_xcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ def main(cmdargs=None):
help="Equation of state of dark energy of fiducial LambdaCDM cosmology",
)

parser.add_argument(
"--distance-template",
type=str,
required=False,
help=("Template cosmology to use in distance calculations. "),
)

parser.add_argument(
"--no-project",
action="store_true",
Expand Down Expand Up @@ -380,6 +387,7 @@ def main(cmdargs=None):
Ok=args.fid_Ok,
wl=args.fid_wl,
blinding=blinding,
template=args.distance_template
)

t0 = time.time()
Expand Down
8 changes: 8 additions & 0 deletions py/picca/bin/picca_xdmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ def main(cmdargs=None):
help="Equation of state of dark energy of fiducial LambdaCDM cosmology",
)

parser.add_argument(
"--distance-template",
type=str,
required=False,
help=("Template cosmology to use in distance calculations. "),
)

parser.add_argument(
"--rej",
type=float,
Expand Down Expand Up @@ -392,6 +399,7 @@ def main(cmdargs=None):
Ok=args.fid_Ok,
wl=args.fid_wl,
blinding=blinding,
template=args.distance_template
)

t0 = time.time()
Expand Down
20 changes: 18 additions & 2 deletions py/picca/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from scipy import interpolate
from scipy.constants import speed_of_light as speed_light
from picca.utils import userprint
import camb

# TODO: this constant is unused. They should be removed at some point
BOSS_LAMBDA_MIN = 3600. # [Angstrom]
Expand Down Expand Up @@ -155,7 +156,8 @@ def get_dist_v(self, z):
"""
raise NotImplementedError("Function should be specified at run-time")

def __init__(self,Om,Ok=0.,Or=0.,wl=-1.,blinding=False,verbose=True):
def __init__(self,Om,Ok=0.,Or=0.,wl=-1.,blinding=False
,verbose=True, template=None):
"""Initializes the methods for this instance

Args:
Expand All @@ -171,6 +173,10 @@ def __init__(self,Om,Ok=0.,Or=0.,wl=-1.,blinding=False,verbose=True):
Hubble constant at redshift 0 (in km/s/Mpc)
"""

#initialise template (if not None)
self._use_template = False
self._init_template(template)

# WARNING: This is introduced due to historical issues in how this class
# is coded. Using H0=100 implies that we are returning the distances
# in Mpc/h instead of Mpc. This class should be fixed at some point to
Expand All @@ -188,7 +194,10 @@ def __init__(self,Om,Ok=0.,Or=0.,wl=-1.,blinding=False,verbose=True):
z_max = 10.
delta_z = z_max/num_bins
z = np.arange(num_bins, dtype=float)*delta_z
hubble = H0*np.sqrt(Ol*(1. + z)**(3.*(1. + wl)) +
if self._use_template:
hubble = self._camb_results.hubble_parameter(z) / self._h_camb
else:
hubble = H0*np.sqrt(Ol*(1. + z)**(3.*(1. + wl)) +
Ok*(1. + z)**2 +
Om*(1. + z)**3 +
Or*(1. + z)**4)
Expand Down Expand Up @@ -223,6 +232,13 @@ def __init__(self,Om,Ok=0.,Or=0.,wl=-1.,blinding=False,verbose=True):
1./3.)
self.get_dist_v = interpolate.interp1d(z, dist_v)

def _init_template(self, template):
if template is not None:
pars = camb.read_ini(template)
self._camb_results = camb.get_results(pars)
self._h_camb = pars.H0 / 100
self._use_template = True

### Absorber names and wavelengths [Angstrom]
ABSORBER_IGM = {
"Halpha" : 6562.8,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ h5py>=3.11.0
future>=1.0.0
setuptools>=69.5.1
gitpython>=3.1.43
camb>=1.5.0
Loading