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)
from transfer.frontends.swiftvr import SWIFTSnapshotData import numpy from numba import njit data = SWIFTSnapshotData( filename='/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' ) halo_coords = data.halo_coordinates.value dm_coords = data.dark_matter.coordinates.value halo_ids = numpy.loadtxt('/cosma5/data/durham/dc-murr1/ids.txt') @njit def find_displacements(halo_coords, dm_coords, halo_ids): dm_coords = dm_coords[numpy.where(halo_ids >= 0)] halo_ids = halo_ids[numpy.where(halo_ids >= 0)] halo_ids = halo_ids.astype(numpy.int64) halo_coords = halo_coords[halo_ids, :] displacements = numpy.zeros(len(dm_coords[:, 0])) for i in range(len(dm_coords[:, 0])): x_diff = dm_coords[i, 0] - halo_coords[i, 0] y_diff = dm_coords[i, 1] - halo_coords[i, 1] z_diff = dm_coords[i, 2] - halo_coords[i, 2] vec = numpy.sqrt(x_diff**2 + y_diff**2 + z_diff**2) if vec > 1: vec = numpy.absolute(25 - vec) displacements[i] = vec
from transfer.frontends.swiftvr import SWIFTSnapshotData import numpy final_snap = SWIFTSnapshotData( '/cosma6/data/dp004/dc-borr1/snap7/new_randomness_runs/adiabatic/Run_0/eagle_0007.hdf5', halo_filename= '/cosma6/data/dp004/dc-borr1/snap7/new_randomness_runs/adiabatic/Run_0/halo_0007.properties' ) coords = final_snap.gas.coordinates numpy.savetxt('/cosma5/data/durham/dc-murr1/adi_gas_coords.txt', coords)
from transfer.frontends.swiftvr import SWIFTSnapshotData from scipy.spatial import cKDTree import numpy final = SWIFTSnapshotData( '/cosma6/data/dp004/dc-borr1/swift-test-data/eagle_0037.hdf5', '/cosma6/data/dp004/dc-borr1/swift-test-data/halo_0037/halo_0037.properties', ) boxsize = final.boxsize boxsize.convert_to_units('Mpc') dm_coords = final.dark_matter.coordinates halo_coords = final.halo_coordinates dm_coords.convert_to_units('Mpc') halo_coords.convert_to_units('Mpc') tree = cKDTree(halo_coords, boxsize=boxsize.value) d, i = tree.query(dm_coords, k=1, n_jobs=-1) numpy.savetxt('/cosma5/data/durham/dc-murr1/dm_nearest_halo_distance.txt', d) numpy.savetxt('/cosma5/data/durham/dc-murr1/dm_nearest_halos.txt', i)