mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-13 22:21:12 +00:00
Add CLONES support (#145)
* Add submit script * Add support for gadget2 * Add OMP * Lower resolution * Update resolution again * Add selection on galactic latitude * Update name * Update nb * Update nb * Add CLONES params * Add import * Add CLONES path * Add CLONES reader * Quick fix * Add CLONES * Update slice nb * Update nb * Update nb * Tiny updates * Update nb * Add name * Add CLONES support * Add CF4 field * Add CLONES * Update script * Update nb * Update nb
This commit is contained in:
parent
a4d02b4cc4
commit
32e36afdc3
17 changed files with 874 additions and 214 deletions
|
@ -189,20 +189,29 @@ def main_from_field(args, folder):
|
|||
for i, nsim in enumerate(tqdm(nsims, desc="Simulations")):
|
||||
if args.simname == "csiborg2X":
|
||||
reader = csiborgtools.read.CSiBORG2XField(nsim, paths)
|
||||
kwargs = {}
|
||||
elif args.simname == "CF4":
|
||||
reader = csiborgtools.read.CF4Field(nsim, paths)
|
||||
kwargs = {}
|
||||
elif args.simname == "CLONES":
|
||||
reader = csiborgtools.read.CLONESField(nsim, paths)
|
||||
kwargs = {"MAS": "SPH", "grid": 1024}
|
||||
elif args.simname == "Carrick2015":
|
||||
reader = csiborgtools.read.Carrick2015Field(paths)
|
||||
kwargs = {}
|
||||
elif args.simname == "Lilow2024":
|
||||
reader = csiborgtools.read.Lilow2024Field(paths)
|
||||
kwargs = {}
|
||||
else:
|
||||
raise ValueError(f"Unknown simname: `{args.simname}`.")
|
||||
|
||||
density_field = reader.density_field()
|
||||
density_field = reader.density_field(**kwargs)
|
||||
cumulative_mass[i, :], cumulative_volume[i, :] = field_enclosed_mass(
|
||||
density_field, distances, boxsize, verbose=False)
|
||||
del density_field
|
||||
collect()
|
||||
|
||||
velocity_field = reader.velocity_field()
|
||||
velocity_field = reader.velocity_field(**kwargs)
|
||||
radial_velocity_field = csiborgtools.field.radial_velocity(
|
||||
velocity_field, [0., 0., 0.])
|
||||
|
||||
|
@ -235,6 +244,19 @@ def main_from_field(args, folder):
|
|||
cumulative_vel_y = icrs_cartesian.y.to(u.km/u.s).value
|
||||
cumulative_vel_z = icrs_cartesian.z.to(u.km/u.s).value
|
||||
|
||||
if args.simname in ["CLONES", "CF4"]:
|
||||
# CLONES is in supergalactic coordinates.
|
||||
supergalactic_cartesian = CartesianRepresentation(
|
||||
cumulative_vel_x, cumulative_vel_y, cumulative_vel_z,
|
||||
unit=u.km/u.s)
|
||||
supergalactic_coord = SkyCoord(
|
||||
supergalactic_cartesian, frame='supergalactic')
|
||||
icrs_cartesian = supergalactic_coord.icrs.cartesian
|
||||
|
||||
cumulative_vel_x = icrs_cartesian.x.to(u.km/u.s).value
|
||||
cumulative_vel_y = icrs_cartesian.y.to(u.km/u.s).value
|
||||
cumulative_vel_z = icrs_cartesian.z.to(u.km/u.s).value
|
||||
|
||||
cumulative_vel = np.stack(
|
||||
[cumulative_vel_x, cumulative_vel_y, cumulative_vel_z], axis=-1)
|
||||
cumulative_vel /= cumulative_volume[..., None]
|
||||
|
@ -260,11 +282,12 @@ if __name__ == "__main__":
|
|||
parser.add_argument("--simname", type=str, help="Simulation name.",
|
||||
choices=["csiborg1", "csiborg2_main", "csiborg2_varysmall", "csiborg2_random", # noqa
|
||||
"borg1", "borg2", "borg2_all", "csiborg2X", "Carrick2015", # noqa
|
||||
"Lilow2024"]) # noqa
|
||||
"Lilow2024", "CLONES", "CF4"]) # noqa
|
||||
args = parser.parse_args()
|
||||
|
||||
folder = "/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells"
|
||||
if args.simname in ["csiborg2X", "Carrick2015", "Lilow2024"]:
|
||||
if args.simname in ["csiborg2X", "Carrick2015", "Lilow2024",
|
||||
"CLONES", "CF4"]:
|
||||
main_from_field(args, folder)
|
||||
elif "csiborg" in args.simname:
|
||||
main_csiborg(args, folder)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
nthreads=1
|
||||
memory=48
|
||||
on_login=0
|
||||
on_login=1
|
||||
queue="berg"
|
||||
env="/mnt/zfsusers/rstiskalek/csiborgtools/venv_csiborg/bin/python"
|
||||
file="field_bulk.py"
|
||||
|
|
|
@ -107,8 +107,8 @@ def get_los(catalogue_name, simname, comm):
|
|||
# we need to convert the RA/dec to galactic coordinates.
|
||||
c = SkyCoord(ra=RA*u.degree, dec=dec*u.degree, frame='icrs')
|
||||
pos = np.vstack((c.galactic.l, c.galactic.b)).T
|
||||
elif "CF4" in simname:
|
||||
# CF4 fields are in supergalactic coordinates.
|
||||
elif simname in ["CF4", "CLONES"]:
|
||||
# CF4 and CLONES fields are in supergalactic coordinates.
|
||||
c = SkyCoord(ra=RA*u.degree, dec=dec*u.degree, frame='icrs')
|
||||
pos = np.vstack((c.supergalactic.sgl, c.supergalactic.sgb)).T
|
||||
else:
|
||||
|
@ -148,6 +148,8 @@ def get_field(simname, nsim, kind, MAS, grid):
|
|||
field_reader = csiborgtools.read.CSiBORG2Field(nsim, simkind)
|
||||
elif simname == "csiborg2X":
|
||||
field_reader = csiborgtools.read.CSiBORG2XField(nsim)
|
||||
elif simname == "CLONES":
|
||||
field_reader = csiborgtools.read.CLONESField(nsim)
|
||||
elif simname == "Carrick2015":
|
||||
folder = "/mnt/extraspace/rstiskalek/catalogs"
|
||||
warn(f"Using local paths from `{folder}`.", RuntimeWarning)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
nthreads=1
|
||||
memory=64
|
||||
memory=48
|
||||
on_login=${1}
|
||||
queue="berg"
|
||||
env="/mnt/users/rstiskalek/csiborgtools/venv_csiborg/bin/python"
|
||||
|
@ -19,8 +19,9 @@ fi
|
|||
|
||||
|
||||
# for simname in "csiborg1" "csiborg2_main" "csiborg2X" "Lilow2024" "Carrick2015" "CF4"; do
|
||||
for simname in "csiborg2_main"; do
|
||||
for catalogue in "2MTF" "SFI_gals" "CF4_TFR"; do
|
||||
for simname in "CLONES"; do
|
||||
# for catalogue in "2MTF" "SFI_gals" "CF4_TFR"; do
|
||||
for catalogue in "Foundation" "2MTF" "SFI_gals" "CF4_TFR"; do
|
||||
pythoncm="$env $file --catalogue $catalogue --nsims $nsims --simname $simname --MAS $MAS --grid $grid"
|
||||
if [ $on_login -eq 1 ]; then
|
||||
echo $pythoncm
|
||||
|
|
|
@ -44,9 +44,7 @@ def interpolate_indranil_void(kind, nsims, RA, dec, rmax, dr, dump_folder,
|
|||
|
||||
# The grid is in Mpc
|
||||
r_grid = np.arange(0, 251)
|
||||
# NOTE: The shape of the files is no longer (181, 251). It is now
|
||||
# (180, 251), asked Sergij about this. He will produce new files.
|
||||
phi_grid = np.arange(0, len(data))
|
||||
phi_grid = np.arange(0, 181)
|
||||
# The input is in Mpc/h, so we need to convert to Mpc
|
||||
r_eval = np.arange(0, rmax, dr).astype(float) / 0.674
|
||||
|
||||
|
@ -83,7 +81,7 @@ def interpolate_indranil_void(kind, nsims, RA, dec, rmax, dr, dump_folder,
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
kind = "exp"
|
||||
kind = "gauss"
|
||||
rmax = 165
|
||||
dr = 1
|
||||
|
||||
|
@ -93,7 +91,7 @@ if __name__ == "__main__":
|
|||
|
||||
out_folder = "/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_los"
|
||||
|
||||
for catalogue in ["LOSS", "Foundation", "2MTF", "SFI_gals", "CF4_TFR", "CF4_GroupAll"]: # noqa
|
||||
for catalogue in ["LOSS", "Foundation", "2MTF", "SFI_gals", "CF4_TFR"]:
|
||||
print(f"Running kind `{kind}` for catalogue `{catalogue}`.")
|
||||
|
||||
RA, dec = get_los(catalogue, "", comm).T
|
||||
|
|
|
@ -37,24 +37,27 @@ else
|
|||
fi
|
||||
|
||||
|
||||
for simname in "IndranilVoid_gauss"; do
|
||||
# for simname in "CLONES"; do
|
||||
# for simname in "csiborg2_main" "csiborg2X" ; do
|
||||
# for simname in "Carrick2015" "Lilow2024" "csiborg2_main" "csiborg2X" "CF4"; do
|
||||
# for simname in "carrick2015" "lilow2024" "csiborg2_main" "csiborg2x" "cf4" "clones"; do
|
||||
for simname in "Carrick2015" "csiborg2_main"; do
|
||||
# for simname in "Carrick2015" "csiborg2X" "csiborg2_main"; do
|
||||
# for simname in "Carrick2015"; do
|
||||
# for catalogue in "LOSS" "Foundation" "2MTF" "SFI_gals" "CF4_TFR_i" "CF4_TFR_w1"; do
|
||||
for catalogue in "LOSS"; do
|
||||
for catalogue in "SFI_gals" "2MTF" "CF4_TFR_i"; do
|
||||
# for catalogue in "CF4_TFR_i" "CF4_TFR_w1"; do
|
||||
# for catalogue in "2MTF" "SFI" "CF4_TFR_not2MTForSFI_i"; do
|
||||
# for catalogue in "2MTF" "SFI_gals" "CF4_TFR_i"; do
|
||||
# for catalogue in "CF4_TFR_w1"; do
|
||||
# for catalogue in "CF4_GroupAll"; do
|
||||
for ksmooth in 1 2 3 4; do
|
||||
for ksim in "none"; do
|
||||
# for ksim in {0..500}; do
|
||||
pythoncm="$env $file --catalogue $catalogue --simname $simname --ksim $ksim --ksmooth $ksmooth --ndevice $ndevice --device $device"
|
||||
|
||||
if [ "$on_login" == "1" ]; then
|
||||
echo $pythoncm
|
||||
# eval $pythoncm
|
||||
eval $pythoncm
|
||||
else
|
||||
if [ "$device" == "gpu" ]; then
|
||||
cm="addqueue -q $queue -s -m $memory --gpus 1 --gputype $gputype $pythoncm"
|
||||
|
@ -63,7 +66,7 @@ for simname in "IndranilVoid_gauss"; do
|
|||
fi
|
||||
echo "Submitting:"
|
||||
echo $cm
|
||||
# eval $cm
|
||||
eval $cm
|
||||
fi
|
||||
|
||||
echo
|
||||
|
@ -71,4 +74,5 @@ for simname in "IndranilVoid_gauss"; do
|
|||
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue