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) |
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
""" | |
Sublime shortcuts for jupyter notebook | |
""" | |
from jupyter_core.paths import jupyter_config_dir | |
import os | |
custom_js_path = os.path.join(jupyter_config_dir(), 'custom', 'custom.js') | |
custom_path = os.path.join(jupyter_config_dir(), 'custom') | |
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
# A function to rasterize components of a matplotlib figure while keeping | |
# axes, labels, etc as vector components | |
# https://brushingupscience.wordpress.com/2017/05/09/vector-and-raster-in-one-with-matplotlib/ | |
from inspect import getmembers, isclass | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def rasterize_and_save(fname, rasterize_list=None, fig=None, dpi=None, |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
git config --global https.proxy http://127.0.0.1:1080 | |
git config --global https.proxy https://127.0.0.1:1080 | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
npm config delete proxy |
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 numpy as np | |
from astropy.table import Table, Column | |
def transpose_table(tab_before, id_col_name='ID'): | |
'''Returns a copy of tab_before (an astropy.Table) with rows and columns interchanged | |
id_col_name: name for optional ID column corresponding to | |
the column names of tab_before''' | |
# contents of the first column of the old table provide column names for the new table | |
# TBD: check for duplicates in new_colnames & resolve | |
new_colnames=tuple(tab_before[tab_before.colnames[0]]) |
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 __future__ import division | |
import collections | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from scipy.spatial import Delaunay, KDTree | |
# an adaptation of https://stackoverflow.com/a/15783581/60982 | |
# using ideas from https://stackoverflow.com/a/9471601/60982 |
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
%%This is often best used in a latex file in two-column mode. To do that, do: | |
%% | |
%%\usepackage{multicol} % before \begin{document} | |
%% ... document ... | |
%%\begin{multicols}{2} | |
%%\bibliography{filename}{} | |
%%\bibliographystyle{apj_short_prop} | |
%%\end{multicols} | |