Skip to content

Instantly share code, notes, and snippets.

View brittonsmith's full-sized avatar

Britton Smith brittonsmith

View GitHub Profile
@brittonsmith
brittonsmith / plot_cosmo.py
Created March 1, 2022 13:01
An example of plotting time on the bottom axis and redshift on the top.
from matplotlib import pyplot
from matplotlib.ticker import FuncFormatter
import numpy as np
from yt.utilities.cosmology import Cosmology
import matplotlib as mpl
mpl.rcParams['axes.unicode_minus'] = False
def _z_from_t(t, pos):
global co
@brittonsmith
brittonsmith / ctree_units.py
Created June 25, 2020 15:16
Provide path to tree_0_0_0.dat file and it will print out units for all fields.
import functools
import re
import sys
from unyt import \
unyt_array, \
unyt_quantity
from unyt.dimensions import \
dimensionless, \
length