Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Elaine Ran committed Sep 28, 2023
2 parents d145349 + 32c9441 commit c7ec702
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 2 deletions.
Binary file modified outfiles/massdist.h5
Binary file not shown.
23 changes: 23 additions & 0 deletions outfiles/params_230907232935488295_150_979018.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
COSMOLOGY:
Battaglia2012:
flat: True
H0: 70
Omega_m0: 0.25
Omega_b0: 0.043
sigma8: 0.8
ns: 0.96
cosmo_h: 0.7
t_cmb: 2.725 #K

SURVEYS:
ACTDR5:
150: #Observation frequency [GHz]
beam_size: 1.3 #From published survey properties
noise_level: 30 #From published survey properties

IMAGES:
image_size: 41
pix_size: 0.5



23 changes: 23 additions & 0 deletions outfiles/params_230908133815461920_150_750702.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
COSMOLOGY:
Battaglia2012:
flat: True
H0: 70
Omega_m0: 0.25
Omega_b0: 0.043
sigma8: 0.8
ns: 0.96
cosmo_h: 0.7
t_cmb: 2.725 #K

SURVEYS:
ACTDR5:
150: #Observation frequency [GHz]
beam_size: 1.3 #From published survey properties
noise_level: 30 #From published survey properties

IMAGES:
image_size: 41
pix_size: 0.5



Binary file added outfiles/sz_sim_230907232935488295_150_979018.h5
Binary file not shown.
Binary file added outfiles/sz_sim_230908133815461920_150_750702.h5
Binary file not shown.
Binary file added sz_sim_data.h5
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_simtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def test_f_sz(self):
T_CMB = cosmo.Tcmb0
fsz = simtools.f_sz(freq,T_CMB)
fsz_expected = -1.999948
assert u.isclose(fsz,fsz_expected),f"Expected {fsz_expected}, but got {fsz}"
assert u.isclose(fsz,fsz_expected),f"Expected {fsz_expected}, but got {fsz}"
26 changes: 26 additions & 0 deletions tests/test_szcluster.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import pytest
<<<<<<< HEAD
from simsz.make_sz_cluster import (
=======
from make_sz_cluster import (
>>>>>>> origin/dev-massdist
P200_Battaglia2012, param_Battaglia2012, Pth_Battaglia2012, epp_to_y)
import simsz.utils as utils
import numpy as np
Expand Down Expand Up @@ -39,7 +43,12 @@ def test_P200_Battaglia2012(self):
R200 = 0.386
P200_expected = 0.00014312182 * (u.keV/u.cm**3.)
P200_calculated = P200_Battaglia2012(cosmo, redshift_z, M200, R200)
<<<<<<< HEAD
assert u.isclose(P200_calculated,P200_expected),f"Expected {P200_expected}, but got {P200_calculated}"
=======
assert u.isclose(P200_calculated,P200_expected),
f"Expected {P200_expected}, but got {P200_calculated}"
>>>>>>> origin/dev-massdist

def test_param_Battaglia2012(self):
'''
Expand Down Expand Up @@ -89,22 +98,39 @@ def test_Pth_Battaglia2012(self):
x = radii/R200 #As defined in Battaglia 2012
Pth_expected = P0 * (x/xc)**(-0.3) * (1 + (x/xc))**(-beta)
result = Pth_Battaglia2012(radii,R200,-0.3,1.0,beta,xc,P0)
<<<<<<< HEAD
assert np.allclose(result, Pth_expected),f"Expected {Pth_expected}, but got {result}"
=======
assert np.allclose(result, Pth_expected),
f"Expected {Pth_expected}, but got {result}"
>>>>>>> origin/dev-massdist

def test_epp_to_y(self):
'''
Test for the method epp_to_y,
which...
'''
<<<<<<< HEAD
(cosmo,sigma8,ns) = get_mock_cosmology()
radii=np.linspace(0.01,10,10000) #Generate a space of radii in arcmin
radii=utils.arcmin_to_Mpc(radii,0.5,cosmo)
redshift_z = 0
=======
radii=np.linspace(0.01,10,10000) #Generate a space of radii in arcmin
radii=utils.arcmin_to_Mpc(radii,0.5,cosmo)
redshift_z = 0
(cosmo,sigma8,ns) = get_mock_cosmology()
>>>>>>> origin/dev-massdist
M200 = 1.3e13
R200 = 0.386
P0 = 18.84628919814473
xc = 0.49587336181740654
beta = 4.395084514715711
P200 = P200_Battaglia2012(cosmo, redshift_z, M200, R200)
<<<<<<< HEAD
y = epp_to_y(Pth_Battaglia2012, radii, R200_mpc=R200, gamma=-0.3,alpha=1.0,beta=beta,xc=xc,P0=P0, P200_kevcm3=P200)
=======
profile = Pth_Battaglia2012(radii,R200,-0.3,1.0,beta,xc,P0)
y = epp_to_y(profile, radii, P200, R200)
>>>>>>> origin/dev-massdist
assert np.max(y)==y[0]
15 changes: 14 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import pytest
from simsz.utils import arcmin_to_Mpc, Mpc_to_arcmin
import astropy.units as u
<<<<<<< HEAD
from astropy.cosmology import FlatLambdaCDM

=======
>>>>>>> origin/dev-massdist

def get_mock_cosmology():
'''
Expand All @@ -24,12 +27,22 @@ def test_arcmin_to_Mpc(self):
(cosmo,sigma8,ns) = get_mock_cosmology()
value_expected = 0.559219683539306
value_calculated = arcmin_to_Mpc(r, z, cosmo)
<<<<<<< HEAD
assert u.isclose(value_calculated, value_expected),f"Expected {value_expected}, but got {value_calculated}"
=======
assert u.isclose(value_calculated, value_expected)
f"Expected {value_expected}, but got {value_calculated}"
>>>>>>> origin/dev-massdist

def test_Mpc_to_arcmin(self):
r = 1
z = 0.5
(cosmo,sigma8,ns) = get_mock_cosmology()
value_expected = 1.7882060117608733
value_calculated = Mpc_to_arcmin(r, z, cosmo)
assert u.isclose(value_calculated, value_expected),f"Expected {value_expected}, but got {value_calculated}"
<<<<<<< HEAD
assert u.isclose(value_calculated, value_expected),f"Expected {value_expected}, but got {value_calculated}"
=======
assert u.isclose(value_calculated, value_expected)
f"Expected {value_expected}, but got {value_calculated}"
>>>>>>> origin/dev-massdist

0 comments on commit c7ec702

Please sign in to comment.