This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import astropy.units as u | |
import numpy as np | |
from matplotlib.pylab import * | |
import agama | |
agama.setUnits(length=1, velocity=1, mass=1) | |
def sigmoid(x, fmax=1, scale=0.5): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for image_file in $(ls figs6/) | |
do | |
if grep $image_file */*.log -c > 1 | |
then | |
echo "File $image_file is in use." | |
else | |
echo "File $image_file is not in use." | |
mv "figs6/$image_file" "figs6/moved.$image_file" # or any other action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.special import gammaincinv | |
def b(n): | |
# 2 * n - 1 / 3 + 4 / (405 * n) + 46 / (25515 * n**2) + 131 / (1148175 * n**3) | |
return gammaincinv(2 * n, 0.5) | |
def d(n): | |
# 3 * n - 1 / 3 + 8 / (1215 * n) + 184 / (229635 * n**2) + 1048 / (31000725 * n**3) | |
return gammaincinv(3 * n, 0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import pi, exp | |
from scipy.special import gamma, gammaincinv, gammainc | |
# Normalisation constant | |
def b(n): | |
return gammaincinv(2*n, 0.5) | |
# Total luminosity of a 2D Sérsic profile | |
def sersic_total_lum(Ie, re, n): | |
bn = b(n) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
exec and load Zhao+2009 model | |
cf http://202.127.29.4/dhzhao/mandc.html | |
""" | |
import os | |
from astropy.io import ascii |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
from __future__ import division | |
from numpy import sqrt, exp, log, abs, diff, sin, cos, linspace, interp | |
from numpy import empty_like, atleast_1d, asarray | |
from numpy.testing import assert_almost_equal | |
from scipy.optimize import bisect as root | |
from numpy import e, pi | |
from scipy.integrate import romberg | |
mid = lambda x: (x[1:] + x[:-1]) / 2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy import units as u | |
(0 * u.ABmag).to(u.erg/u.s/u.cm**2/u.Hz) | |
# 0 ABmag corresponsds to 3.6307805477010035e-20 erg / (cm2 Hz s) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import np | |
def kern_smooth(x, xp, yp, bw=1, return_std=False): | |
w = np.exp(-0.5 * ((xp - x.reshape(-1, 1)) / bw)**2) | |
w = w / w.sum(1, keepdims=True) | |
y = (yp * w).sum(1) | |
if not return_std: | |
return y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getdist_colors(): | |
"return getdist color table" | |
# taken from getdist, https://github.com/cmbant/getdist | |
return ['#006FED', '#E03424', 'gray', '#009966', '#000866', '#336600', '#006633', 'm', 'r'] | |
NewerOlder