Compare commits
2 Commits
b4658825ab
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7284a6f99 | ||
|
|
55d09c691c |
@@ -565,8 +565,8 @@ class Galsec(GalsecAnalysis):
|
|||||||
if binning_mode == "delta":
|
if binning_mode == "delta":
|
||||||
delta = bins[name]
|
delta = bins[name]
|
||||||
elif binning_mode == "number":
|
elif binning_mode == "number":
|
||||||
bin_min = filter_bounds[name][0].value
|
bin_min = filter_bounds[name][0]
|
||||||
bin_max = filter_bounds[name][1].value
|
bin_max = filter_bounds[name][1]
|
||||||
delta = (bin_max - bin_min) / bins[name]
|
delta = (bin_max - bin_min) / bins[name]
|
||||||
|
|
||||||
if delta is not None:
|
if delta is not None:
|
||||||
|
|||||||
55
src/galaxy_ninja/loaders/load_data_osyris.py
Normal file
55
src/galaxy_ninja/loaders/load_data_osyris.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import osyris
|
||||||
|
|
||||||
|
|
||||||
|
def load_fields_osyris(path="", snap_id=0, data=None):
|
||||||
|
"""
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
dict
|
||||||
|
A dataset of cells in the following format:
|
||||||
|
gas:
|
||||||
|
position (Ngas, 3) [kpc], centered
|
||||||
|
volume (Ngas) [pc^3]
|
||||||
|
velocity (Ngas, 3) [km/s]
|
||||||
|
mass (Ngas) [Msun]
|
||||||
|
stars:
|
||||||
|
position (Nstar, 3) [kpc], centered
|
||||||
|
velocity (Nstar, 3) [km/s]
|
||||||
|
mass (Nstar) [Msun]
|
||||||
|
birth_time (Nstar) [Myr]
|
||||||
|
dm:
|
||||||
|
position (Ngas, 3) [kpc], centered
|
||||||
|
velocity (Ngas, 3) [km/s]
|
||||||
|
mass (Ngas) [Msun]
|
||||||
|
maps:
|
||||||
|
extent (xmin, xmax, ymin, ymax) Coordinates of the edges of the map, centered
|
||||||
|
gas_coldens (Nx, Ny) [Msun/pc^2], map of column density
|
||||||
|
"""
|
||||||
|
|
||||||
|
if data is None:
|
||||||
|
data = osyris.RamsesDataset(snap_id, path=path).load(select=["mesh", "part"])
|
||||||
|
|
||||||
|
|
||||||
|
time = data.meta["time"].to("Myr").magnitude
|
||||||
|
boxlen = data.meta["boxlen"] * data.units["x"].to("kpc")
|
||||||
|
|
||||||
|
gas = data["mesh"]
|
||||||
|
center = osyris.Vector(x=500, y=500, z=500, unit="pc")
|
||||||
|
|
||||||
|
# Create dataset
|
||||||
|
data = {
|
||||||
|
"header": {"time": time,
|
||||||
|
"fluids": ["gas"],
|
||||||
|
"box_size": boxlen },
|
||||||
|
"gas": {
|
||||||
|
"position": (gas["position"] - center).to("kpc").values,
|
||||||
|
"volume": (gas["dx"]**3).to("pc^3").values,
|
||||||
|
"velocity": gas["velocity"].to("km/s").values,
|
||||||
|
"mass": (gas["density"] * gas["dx"]**3).to("M_sun").values
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
Reference in New Issue
Block a user