Add CF4 mean & std (#132)

* Add observer velocity

* Add radec to supergalactic

* Update script

* Add CF4 params

* Add paths to CF4

* Add CF4 but not sth wrong

* Update nb

* Remove errors

* Update nb

* Update scripts
This commit is contained in:
Richard Stiskalek 2024-06-27 15:02:33 +01:00 committed by GitHub
parent 76e8f71556
commit 301ff61e89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 284 additions and 110 deletions

View file

@ -41,7 +41,7 @@ from sklearn.model_selection import KFold
from tqdm import trange
from ..params import SPEED_OF_LIGHT, simname2Omega_m
from ..utils import fprint, radec_to_galactic
from ..utils import fprint, radec_to_galactic, radec_to_supergalactic
H0 = 100 # km / s / Mpc
@ -105,7 +105,11 @@ class DataLoader:
# In case of Carrick 2015 the box is in galactic coordinates..
if simname == "Carrick2015":
# Carrick+2015 box is in galactic coordinates
d1, d2 = radec_to_galactic(self._cat["RA"], self._cat["DEC"])
elif "CF4" in simname:
# CF4 box is in supergalactic coordinates
d1, d2 = radec_to_supergalactic(self._cat["RA"], self._cat["DEC"])
else:
d1, d2 = self._cat["RA"], self._cat["DEC"]
@ -129,10 +133,15 @@ class DataLoader:
mean_rho_matter *= self._Omega_m
self._los_density /= mean_rho_matter
# Since Carrick+2015 provide `rho / <rho> - 1`
if simname == "Carrick2015":
# Since Carrick+2015 and CF4 provide `rho / <rho> - 1`
if simname in ["Carrick2015", "CF4", "CF4gp"]:
self._los_density += 1
# But some CF4 delta values are < -1. Check that CF4 really reports
# this.
if simname in ["CF4", "CF4gp"]:
self._los_density = np.clip(self._los_density, 1e-5, None,)
self._mask = np.ones(len(self._cat), dtype=bool)
self._catname = catalogue

View file

@ -77,6 +77,8 @@ def simname2boxsize(simname):
"quijote": 1000.,
"TNG300-1": 205.,
"Carrick2015": 400.,
"CF4": 1000., # These need to be checked with Helene Courtois.
"CF4gp": 1000.,
}
boxsize = d.get(simname, None)
@ -97,6 +99,8 @@ def simname2Omega_m(simname):
"borg2": 0.3111,
"borg2_all": 0.3111,
"Carrick2015": 0.3,
"CF4": 0.3,
"CF4gp": 0.3,
}
omega_m = d.get(simname, None)

View file

@ -115,6 +115,8 @@ class Paths:
files = [int(search(r'chain_(\d+)', f).group(1)) for f in files]
elif simname == "Carrick2015":
return [0]
elif simname in ["CF4", "CF4gp"]:
return [0]
else:
raise ValueError(f"Unknown simulation name `{simname}`.")

View file

@ -163,6 +163,12 @@ def radec_to_galactic(ra, dec):
return c.galactic.l.degree, c.galactic.b.degree
def radec_to_supergalactic(ra, dec):
"""Convert right ascension and declination to supergalactic coordinates."""
c = SkyCoord(ra=ra*u.degree, dec=dec*u.degree, frame='icrs')
return c.supergalactic.sgl.degree, c.supergalactic.sgb.degree
@jit(nopython=True, fastmath=True, boundscheck=False)
def great_circle_distance(x1, x2, in_degrees=True):
"""