Skip to content

Instantly share code, notes, and snippets.

View saimn's full-sized avatar

Simon Conseil saimn

  • Institut de Physique des 2 Infinis (IP2I, CNRS)
  • Lyon, France
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saimn
saimn / gist:bc2190e6e5b7a03284ae1d2ac0eec37b
Created March 14, 2018 17:23 — forked from tspriggs/gist:989b57a495ab2831a021fb376e18fabc
custom model to fit a 2D moffat model to data, equate that to F_OIII_xy, then pass it to a 1D custom Gaussian equation to get a model spectrum. The idea is to have x, y and l (wavelength) as inputs, then the amplitude is fixed as it is calculated. When I run it I normally get mismatched dimension errors: wavelength is a 271 long list, and then x…
def Moffat_3d_test(x, mean, stddev, Gauss_bkg, Gauss_grad,
Moffat_amplitude, x_0, y_0, gamma, alpha, Moffat_bkg):
# Moffat
rr_gg = ((x_fit - x_0)**2 + (y_fit - y_0)**2) / gamma**2
F_OIII_xy = Moffat_amplitude * (1 + rr_gg)**(-alpha) + Moffat_bkg
# Prep for Gauss 1D
Gauss_std = np.sqrt(stddev**2 + std_MUSE**2)
A_OIII_xy = F_OIII_xy / (np.sqrt(2*np.pi) * Gauss_std)
check_1.append(A_OIII_xy)
model_spectra = []
@saimn
saimn / gist:fa76010f83131f525dc747d1dac5840c
Created December 13, 2017 14:25
Astropy tests with Python 3.7a3 and Numpy 1.14pre
===================================== test session starts =====================================
platform linux -- Python 3.7.0a3, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
Running tests with Astropy version 3.0.dev20889.
Running tests in astropy docs.
Date: 2017-12-13T15:20:29
Platform: Linux-4.14.4-1-ARCH-x86_64-with-arch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-24-80ea1cd1ef6b> in <module>()
5 make_nans_transparent=True, embed_avm_tags=True,
6 vmin_r=vmin, vmin_g=vmin, vmin_b=vmin, vmax_r=vmax, vmax_g=vmax, vmax_b=vmax,
----> 7 stretch_r='sqrt', stretch_g='sqrt', stretch_b='sqrt')
8
9 rgb_name = IMAGE.replace('IMAGE', 'IMAGE_RGB').replace('.fits', '.jpg')
~/miniconda3/lib/python3.6/site-packages/aplpy/rgb.py in make_rgb_image(data, output, indices, vmin_r, vmax_r, pmin_r, pmax_r, stretch_r, vmid_r, exponent_r, vmin_g, vmax_g, pmin_g, pmax_g, stretch_g, vmid_g, exponent_g, vmin_b, vmax_b, pmin_b, pmax_b, stretch_b, vmid_b, exponent_b, make_nans_transparent, embed_avm_tags)
================================= slowest 100 test durations ==================================
31.77s call lib.linux-x86_64-3.6/astropy/stats/tests/test_spatial.py::test_ripley_large_density[points0-0-1]
30.63s call lib.linux-x86_64-3.6/astropy/stats/tests/test_spatial.py::test_ripley_modes[points0-5-10]
30.40s call lib.linux-x86_64-3.6/astropy/stats/tests/test_spatial.py::test_ripley_modes[points1--10--5]
29.69s call lib.linux-x86_64-3.6/astropy/stats/tests/test_spatial.py::test_ripley_large_density[points1--1-0]
6.32s call lib.linux-x86_64-3.6/astropy/convolution/tests/test_discretize.py::test_gaussian_eval_2D_integrate_mode
3.33s call lib.linux-x86_64-3.6/astropy/utils/tests/test_timer.py::test_timer
3.03s call lib.linux-x86_64-3.6/astropy/vo/samp/tests/test_hub.py::test_SAMPHubServer_run_repeated
3.02s call lib.linux-x86_64-3.6/astropy/vo/samp/tests/test_hub_script.py::test_hub_script
2.96s call lib.linux-x86_64-3.6/astropy/units/tests/test_units.py::test_compose_fract
@saimn
saimn / pre-commit
Last active February 25, 2019 15:06
#!/bin/sh
#
# Git pre commit hook which find the next PR number and replace occurences of
# GUESSPR in the changelog
files_modified=`git diff --cached --name-only --diff-filter=ACM`
if [[ $files_modified == *"CHANGES.rst"* ]]; then
ghurl="https://api.github.com/repos/astropy/astropy/issues?state=all&sort=created&direction=desc&per_page=1"
echo "Fetching PR number from $ghurl"
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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.