"in_halo",
            "in_halo_from_own_lr",
            "in_halo_from_other_lr",
            "in_halo_from_outside_lr",
            "in_lr",
            "in_other_halo_from_lr",
            "outside_haloes",
        ]
    }
with open(f"{particle_type}.pickle", "wb") as handle:
    pickle.dump(x, handle)

with open(f"haloes.pickle", "wb") as handle:
    pickle.dump(
        {
            "halo_coordinates": cross.final_snapshot.halo_coordinates,
            "halo_radii": cross.final_snapshot.halo_radii,
        },
        handle,
    )

spread_metric = SpreadMetricCalculator(simulation=cross)
spread_metric.find_neighbour_distances()

spread_metric.dark_matter_spread.write_hdf5(
    "/cosma5/data/durham/dc-murr1/dark_matter_spread.hdf5")
spread_metric.gas_spread.write_hdf5(
    "/cosma5/data/durham/dc-murr1/gas_spread.hdf5")
spread_metric.star_spread.write_hdf5(
    "/cosma5/data/durham/dc-murr1/star_spread.hdf5")
Beispiel #2
0
from transfer.spreadmetric import SpreadMetricCalculator
from transfer.frontends.swiftvr import SWIFTSnapshotData
from transfer.holder import SimulationData
import numpy

initial_snap = SWIFTSnapshotData('/cosma6/data/dp004/dc-borr1/swift-test-data/eagle_0000.hdf5', halo_filename = None)
final_snap = SWIFTSnapshotData('/cosma6/data/dp004/dc-borr1/swift-test-data/eagle_0037.hdf5', 
halo_filename = '/cosma6/data/dp004/dc-borr1/swift-test-data/halo_0037/halo_0037.properties')

data = SimulationData(initial_snap, final_snap)

cal = SpreadMetricCalculator(simulation = data)

cal.find_neighbour_distances()
dm_spread = cal.dark_matter_spread
gas_spread = cal.gas_spread
star_spread = cal.star_spread
numpy.savetxt('/cosma5/data/durham/dc-murr1/dm_spread.txt', dm_spread)
numpy.savetxt('/cosma5/data/durham/dc-murr1/gas_spread.txt', gas_spread)
numpy.savetxt('/cosma5/data/durham/dc-murr1/star_spread.txt', star_spread)



Beispiel #3
0
                          truncate_ids=truncate_ids)

cross = SimulationData(initial_snapshot=initial, final_snapshot=final)

for particle_type in ["dark_matter", "stars", "gas"]:
    x = {
        n: getattr(getattr(cross, f"{particle_type}_transfer"), n)
        for n in [
            "in_halo",
            "in_halo_from_own_lr",
            "in_halo_from_other_lr",
            "in_halo_from_outside_lr",
            "in_lr",
            "in_other_halo_from_lr",
            "outside_haloes",
        ]
    }
with open(f"{particle_type}.pickle", "wb") as handle:
    pickle.dump(x, handle)

with open(f"haloes.pickle", "wb") as handle:
    pickle.dump(
        {
            "halo_coordinates": cross.final_snapshot.halo_coordinates,
            "halo_radii": cross.final_snapshot.halo_radii,
        },
        handle,
    )

spread_metric = SpreadMetricCalculator(simulation=cross)