Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ tests/FLAMINGO/test_parameters.yml
tests/COLIBRE/test_parameters.yml
tests/test_SO_radius_*.png
test_data/*
test_SO_radius*png
8 changes: 4 additions & 4 deletions SOAP/catalogue_readers/read_hbtplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def read_hbtplus_groupnr(basename, read_potential_energies=False, registry=None)
if comm_rank == 0:
if os.path.exists(hbt_filename(basename, 0)):
with h5py.File(hbt_filename(basename, 0), "r") as infile:
nr_files = int(infile["NumberOfFiles"][...])
nr_files = infile["NumberOfFiles"][0]
sorted_file = False
elif os.path.exists(basename):
with h5py.File(basename, "r") as infile:
Expand Down Expand Up @@ -241,9 +241,9 @@ def read_hbtplus_catalogue(
have_units = False
with h5py.File(filename, "r") as infile:
if "Units" in infile:
LengthInMpch = float(infile["Units/LengthInMpch"][...])
MassInMsunh = float(infile["Units/MassInMsunh"][...])
VelInKmS = float(infile["Units/VelInKmS"][...])
LengthInMpch = infile["Units/LengthInMpch"][0]
MassInMsunh = infile["Units/MassInMsunh"][0]
VelInKmS = infile["Units/VelInKmS"][0]
have_units = True
# Otherwise, will have to read the Parameters.log file
if not (have_units):
Expand Down
2 changes: 1 addition & 1 deletion SOAP/core/halo_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def process_halos(
next_task.win.Lock(0)
next_task.win.Fetch_and_op(one, task_to_do, 0)
next_task.win.Unlock(0)
task_to_do = int(task_to_do)
task_to_do = int(task_to_do.flat[0])

# Execute the task, if there's one left
if task_to_do < nr_halos:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "SOAP"
version = "0.1.1"
version = "0.1.2"
description = "MPI parallel Python code to compute properties of halos in SWIFT n-body simulations"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mpi4py
h5py
numpy>=2,<2.4
numpy>=2
unyt>=3
astropy>=6
scipy
Expand Down
5 changes: 5 additions & 0 deletions tests/dummy_halo_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def __init__(self):
"BirthTemperatures",
"SmoothedElementMassFractions",
"IronMassFractionsFromSNIa",
"BirthHaloCatalogueIndex",
],
"PartType5": [
"Coordinates",
Expand Down Expand Up @@ -1170,6 +1171,10 @@ def get_random_halo(
data["PartType4"]["GroupNr_all"] = groupnr_all[star_mask]
data["PartType4"]["GroupNr_bound"] = groupnr_bound[star_mask]
data["PartType4"]["FOFGroupIDs"] = fof_group_ids[star_mask]
# Some in-situ stars, some ex-situ
data["PartType4"]["BirthHaloCatalogueIndex"] = groupnr_bound[star_mask]
mask = np.random.random(Nstar) < 0.1
data["PartType4"]["BirthHaloCatalogueIndex"][mask] = -1
# initial masses are always larger than the actual mass
data["PartType4"]["InitialMasses"] = unyt.unyt_array(
mass[star_mask].value * (1.0 + np.random.random(Nstar)),
Expand Down