Skip to content

Instantly share code, notes, and snippets.

@mfouesneau
mfouesneau / pymcPL.ipynb
Created May 26, 2017 09:31
Trying PyMC3 on power-law distributions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mfouesneau
mfouesneau / vizier_sed.py
Created January 24, 2017 16:26
VizieR photometry tool interface
try: # python 3
from io import BytesIO
from http.client import HTTPConnection
except ImportError: # python 2
from StringIO import StringIO as BytesIO
from httplib import HTTPConnection
from astropy.table import Table
@mfouesneau
mfouesneau / dstn.sql
Last active September 29, 2016 21:31
Gaia ADQL multiple position extraction
SELECT TOP 5 source_id,ra,dec,phot_g_mean_mag,astrometric_excess_noise_sig FROM gaiadr1.gaia_source WHERE
CONTAINS(POINT('ICRS',gaiadr1.gaia_source.ra,gaiadr1.gaia_source.dec),CIRCLE('ICRS',18.69290, -0.00109,0.002777777777777778))=1
or
CONTAINS(POINT('ICRS',gaiadr1.gaia_source.ra,gaiadr1.gaia_source.dec),CIRCLE('ICRS',229.47509, 0.82868,0.002777777777777778))=1
or
CONTAINS(POINT('ICRS',gaiadr1.gaia_source.ra,gaiadr1.gaia_source.dec),CIRCLE('ICRS',229.46491, -0.79320,0.002777777777777778))=1
or
CONTAINS(POINT('ICRS',gaiadr1.gaia_source.ra,gaiadr1.gaia_source.dec),CIRCLE('ICRS',14.21622, 0.00584,0.002777777777777778))=1
@mfouesneau
mfouesneau / knn_interp.py
Created February 27, 2015 12:34
KDTree+RbF interpolator
import numpy as np
from scipy.spatial import cKDTree
from bary import RbfInterpolator
class KDTreeInterpolator(object):
"""
KDTreeInterpolator(points, values)
Nearest-neighbours (barycentric) interpolation in N dimensions.
@mfouesneau
mfouesneau / ezrc
Last active August 29, 2015 14:07
ezrc mpl rc update quickly
def ezrc(fontSize=22., lineWidth=2., labelSize=None, tickmajorsize=10,
tickminorsize=5, figsize=(8, 6)):
"""
Define params to make pretty fig for slides and papers
"""
from pylab import rc, rcParams
if labelSize is None:
labelSize = fontSize + 5
rc('figure', figsize=figsize)
rc('lines', linewidth=lineWidth)