This file contains hidden or 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 | |
| def gaussian_kernel_regression( | |
| x, y, sigma, yerr=None, w=None, x_new=None, niter=20, atol=1e-6, rtol=1e-3 | |
| ): | |
| """ | |
| Iterative Gaussian kernel smoothing. | |
| Parameters |
This file contains hidden or 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 | |
| import matplotlib.pyplot as plt | |
| def fit_gp(x, y, y_err, y_avg=None, x_pred=None, scale=1): | |
| from sklearn.gaussian_process import GaussianProcessRegressor | |
| from sklearn.gaussian_process.kernels import RBF, ConstantKernel, Matern, WhiteKernel | |
| from sklearn.exceptions import ConvergenceWarning | |
| import warnings |
This file contains hidden or 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 matplotlib import pyplot as plt | |
| from scipy.interpolate import griddata | |
| def add_label(x, y, x0=None, y0=None, dx=0, dy=0, s='', **kwargs): | |
| "add label on the curve (x, y) at location specified by (x0, y0)" | |
| if x0 is not None: | |
| if x[-1] > x[0]: | |
| y0 = np.interp(x0, x, y) |
This file contains hidden or 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, print_function, absolute_import | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from matplotlib.patches import Arc | |
| from matplotlib.collections import PatchCollection | |
| __all__ = ['arcs'] | |
| def arcs(x, y, w, h=None, rot=0.0, theta1=0.0, theta2=360.0, | |
| c='b', vmin=None, vmax=None, **kwargs): |
This file contains hidden or 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 hidden or 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} | |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 handy script for querying the new parsec website of padova isochrones. | |
| author: syrte (http://github.com/syrte) | |
| ## Features | |
| - Easy to use | |
| - Flexibility | |
| - Friendly error prompts | |
| - Support latest also previous versions of parsec website |
NewerOlder