mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-06-28 18:51:12 +00:00
Add TNG field (#108)
* Add TNG catalogue script * Add imoprt * Add TNG box * Add import * Fix little bug * Add TNG300-1 * Add shell scripts * Organize .gitignore * Add scatter to file name * Add argument scatter * Add threshold on mass * Update nb * Add scatter argument * Add scattering of radial positions * Update nb * Update script
This commit is contained in:
parent
9e4b34f579
commit
f0ab6fc9b4
19 changed files with 583 additions and 43 deletions
|
@ -18,7 +18,7 @@ from .utils import (center_of_mass, delta2ncells, number_counts,
|
|||
periodic_distance, periodic_distance_two_points, # noqa
|
||||
binned_statistic, cosine_similarity, fprint, # noqa
|
||||
hms_to_degrees, dms_to_degrees, great_circle_distance, # noqa
|
||||
radec_to_cartesian) # noqa
|
||||
radec_to_cartesian, cartesian_to_radec) # noqa
|
||||
from .params import paths_glamdring, simname2boxsize # noqa
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ def simname2boxsize(simname):
|
|||
"csiborg2_random": 676.6,
|
||||
"borg1": 677.7,
|
||||
"borg2": 676.6,
|
||||
"quijote": 1000.
|
||||
"quijote": 1000.,
|
||||
"TNG300-1": 205.
|
||||
}
|
||||
|
||||
boxsize = d.get(simname, None)
|
||||
|
@ -54,6 +55,7 @@ paths_glamdring = {
|
|||
"csiborg2_random_srcdir": "/mnt/extraspace/rstiskalek/csiborg2_random", # noqa
|
||||
"postdir": "/mnt/extraspace/rstiskalek/csiborg_postprocessing/",
|
||||
"quijote_dir": "/mnt/extraspace/rstiskalek/quijote",
|
||||
"borg1_dir": "/mnt/users/hdesmond/BORG_final",
|
||||
"borg2_dir": "/mnt/extraspace/rstiskalek/BORG_STOPYRA_2023",
|
||||
"tng300_1_dir": "/mnt/extraspace/rstiskalek/TNG300-1/",
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ from .catalogue import (CSiBORG1Catalogue, CSiBORG2Catalogue,
|
|||
CSiBORG2MergerTreeReader, QuijoteCatalogue) # noqa
|
||||
from .snapshot import (CSiBORG1Snapshot, CSiBORG2Snapshot, QuijoteSnapshot, # noqa
|
||||
CSiBORG1Field, CSiBORG2Field, QuijoteField, BORG2Field, # noqa
|
||||
BORG1Field) # noqa
|
||||
BORG1Field, TNG300_1Field) # noqa
|
||||
from .obs import (SDSS, MCXCClusters, PlanckClusters, TwoMPPGalaxies, # noqa
|
||||
TwoMPPGroups, ObservedCluster, match_array_to_no_masking, # noqa
|
||||
cols_to_structured) # noqa
|
||||
|
|
|
@ -467,9 +467,10 @@ class Paths:
|
|||
fname = f"observer_peculiar_velocity_{simname}_{MAS}_{str(nsim).zfill(5)}_{grid}.npz" # noqa
|
||||
return join(fdir, fname)
|
||||
|
||||
def field_interpolated(self, survey, simname, nsim, kind, MAS, grid):
|
||||
def field_interpolated(self, survey, simname, nsim, kind, MAS, grid,
|
||||
radial_scatter=None):
|
||||
"""
|
||||
Path to the files containing the CSiBORG interpolated field for a given
|
||||
Path to the files containing the interpolated field for a given
|
||||
survey.
|
||||
|
||||
Parameters
|
||||
|
@ -486,13 +487,16 @@ class Paths:
|
|||
Mass-assignment scheme.
|
||||
grid : int
|
||||
Grid size.
|
||||
radial_scatter : float, optional
|
||||
Radial scatter added to the galaxy positions, only supported for
|
||||
TNG300-1.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
"""
|
||||
if "csiborg" not in simname:
|
||||
raise ValueError("Interpolated field only available for CSiBORG.")
|
||||
|
||||
# # In case the galaxy positions of TNG300-1 were scattered..
|
||||
|
||||
if kind not in ["density", "potential", "radvel"]:
|
||||
raise ValueError("Unsupported field type.")
|
||||
|
@ -501,7 +505,12 @@ class Paths:
|
|||
try_create_directory(fdir)
|
||||
|
||||
nsim = str(nsim).zfill(5)
|
||||
return join(fdir, f"{survey}_{simname}_{kind}_{MAS}_{nsim}_{grid}.npz")
|
||||
fname = join(fdir, f"{survey}_{simname}_{kind}_{MAS}_{nsim}_{grid}.npz") # noqa
|
||||
|
||||
if simname == "TNG300-1" and radial_scatter is not None:
|
||||
fname = fname.replace(".npz", f"_scatter{radial_scatter}.npz")
|
||||
|
||||
return fname
|
||||
|
||||
def cross_nearest(self, simname, run, kind, nsim=None, nobs=None):
|
||||
"""
|
||||
|
|
|
@ -1004,7 +1004,7 @@ class TNG300_1Field(BaseField):
|
|||
return density
|
||||
|
||||
def density_field(self, MAS, grid):
|
||||
fpath = join(self.paths.tng300_1, "postprocessing", "density_field",
|
||||
fpath = join(self.paths.tng300_1(), "postprocessing", "density_field",
|
||||
f"rho_dm_099_{grid}_{MAS}.npy")
|
||||
return numpy.load(fpath)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue