コード例 #1
0
velociraptor_groups = velociraptor_base_name.replace("properties",
                                                     "catalog_groups")

filenames = {
    "parttypes_filename":
    velociraptor_base_name.replace("properties", "catalog_partypes"),
    "particles_filename":
    velociraptor_base_name.replace("properties", "catalog_particles"),
    "unbound_parttypes_filename":
    velociraptor_base_name.replace("properties", "catalog_partypes.unbound"),
    "unbound_particles_filename":
    velociraptor_base_name.replace("properties", "catalog_particles.unbound"),
}

catalogue = load(velociraptor_properties)
groups = load_groups(velociraptor_groups, catalogue)

# Let's make an image of those particles!
import matplotlib.pyplot as plt
import numpy as np

from swiftsimio.visualisation.sphviewer import SPHViewerWrapper
from matplotlib.colors import LogNorm

particle_type_cmap = {
    "gas": "inferno",
    "stars": "bone",
    "dark_matter": "plasma",
}

コード例 #2
0
from velociraptor.particles import load_groups
from velociraptor import load
from velociraptor.swift.swift import to_swiftsimio_dataset
from swiftsimio.visualisation.sphviewer import SPHViewerWrapper
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

catalogue = load("/cosma6/data/dp004/dc-borr1/snap7/new_randomness_runs/adiabatic/Run_0/halo_0007.properties")
groups = load_groups("/cosma6/data/dp004/dc-borr1/snap7/new_randomness_runs/adiabatic/Run_0/halo_0007.catalog_groups", catalogue=catalogue)

particles, unbound_particles = groups.extract_halo(halo_id=0)

data, mask = to_swiftsimio_dataset(
    particles,
    "/cosma6/data/dp004/dc-borr1/snap7/new_randomness_runs/adiabatic/Run_0/eagle_0007.hdf5",
    generate_extra_mask=True
)


particle_data = getattr(data, 'dark_matter')
sphviewer = SPHViewerWrapper(particle_data)

x = particles.x / data.metadata.a
y = particles.y / data.metadata.a
z = particles.z / data.metadata.a
r_size = particles.r_size * 0.8 / data.metadata.a

sphviewer.get_camera(x=x, y=y, z=z, r=r_size, zoom=2, xsize=1024, ysize=1024)
sphviewer.get_scene()
コード例 #3
0
from velociraptor import load
from velociraptor.particles import load_groups
import numpy

groups = load_groups(
    '/cosma6/data/dp004/dc-borr1/swift-test-data/halo_0037/halo_0037.catalog_groups'
)

particles, unbound_particles = groups.extract_halo(halo_id=1)

print(numpy.where(particles.particle_types == 2))
コード例 #4
0
from velociraptor.particles import load_groups
from velociraptor import load
from velociraptor.swift.swift import to_swiftsimio_dataset
import numpy
import unyt

catalogue = load(
    "/cosma6/data/dp004/dc-borr1/swift-test-data/halo_0037/halo_0037.properties"
)
groups = load_groups(
    "/cosma6/data/dp004/dc-borr1/swift-test-data/halo_0037/halo_0037.catalog_groups",
    catalogue=catalogue)

struc = catalogue.structure_type.structuretype
n = len(struc[struc == 10])
radii = catalogue.apertures.rhalfmass_star_30_kpc
masses = catalogue.apertures.mass_star_30_kpc
radii.convert_to_units(unyt.kpc)
masses.convert_to_units(unyt.msun)

data = numpy.zeros((n, 5))
ids = numpy.where(struc == 10)[0]
data[:, 0] = catalogue.positions.xc[ids]
data[:, 1] = catalogue.positions.yc[ids]
data[:, 2] = catalogue.positions.zc[ids]
data[:, 3] = radii[ids]
data[:, 4] = masses[ids]

numpy.savetxt('/cosma5/data/durham/dc-murr1/halos.txt', data)