Simple class for generating actions for particles in a simulation that can be read using pynbody. The action calculation is done with galpy.
See the notebook for an example.
import pynbody | |
part2birth = '/home/itp/roskar/ramses/galaxy_formation/part2birth' | |
@pynbody.ramses.RamsesSnap.derived_quantity | |
def tform(self) : | |
"""Generate a tform array that is compatible with pynbody unit system | |
and will allow one to get the ages of stars. | |
make sure the 'part2birth' above corresponds to the location of the executable on your machine |
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:51674423333905e7630a6f70f9aed7a81e31205a98f3620d90a7374eb69f0931" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
"""Check whether the default compiler supports OpenMP. | |
This routine is adapted from yt, thanks to Nathan | |
Goldbaum. See https://github.com/pynbody/pynbody/issues/124""" | |
import tempfile | |
import os | |
import sysconfig | |
import subprocess | |
import shutil |
def prepare_for_amiga(outname, write = False, run_amiga=False) : | |
""" | |
Takes a RAMSES output and turns it into a 'tipsy' file for use with | |
tipsy, pkdgrav, or AHF | |
""" | |
import os | |
from pynbody.units import Unit | |
s = pynbody.load(outname) |
{ | |
"metadata": { | |
"name": "pynbody_demo" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |