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
@astrofrog
astrofrog / sampy_send.py
Created March 4, 2011 20:46
Broadcast a table from Python over SAMP
from sampy import *
import time
import urllib
myhub = SAMPHubProxy()
myhub.connect()
client = SAMPClient(myhub)
@astrofrog
astrofrog / spherical_distance.py
Created May 15, 2012 13:44
spherical distance on sky
import numpy as np
def distance(ra1, dec1, ra2, dec2):
return np.degrees(np.arccos(np.sin(np.radians(dec1))
* np.sin(np.radians(dec2))
+ np.cos(np.radians(dec1))
* np.cos(np.radians(dec2))
* np.cos(np.radians(ra1) - np.radians(ra2))))
def distance_approx(ra1, dec1, ra2, dec2):
@phn
phn / part1.rst
Created July 5, 2012 17:15
Astropython.org PyFits tutorial

PyFITS: FITS files in Python

In this article, we provide examples of using the python module PyFITS for working with FITS data. We first go through a brief

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ycopin
ycopin / taylorDiagram.py
Last active August 9, 2024 14:25
Taylor diagram for python/matplotlib [ 10.5281/zenodo.5548061 ]
#!/usr/bin/env python
# Copyright: This document has been placed in the public domain.
"""
Taylor diagram (Taylor, 2001) implementation.
Note: If you have found these software useful for your research, I would
appreciate an acknowledgment.
"""
@taldcroft
taldcroft / 10-startup.py
Last active September 10, 2017 01:28
IPython startup magic
# ~/.ipython/profile_default/startup/10-mystartup.py
import numpy as np
ip = get_ipython()
def import_astropy(self, arg):
ip.ex('import astropy')
ip.ex('print(astropy.__version__)')
ip.ex('from astropy.io import ascii')