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
In [1]: from astropy import wcs
In [2]: from astropy.io import fits
In [3]: hdulist = fits.open('../../../CFHTLS_T06/DEEP/CFHTLS_D-85_u_022559-042940_T0006.fits')
In [4]: w = wcs.WCS(hdulist[0].header)
In [5]: w.printwcs()
WCS Keywords
In [1]: from astropy import wcs
In [2]: from astropy.io import fits
In [3]: hdulist = fits.open('XMMLSS_00-nd-int.fits')
In [4]: w = wcs.WCS(hdulist[0].header)
In [5]: w.to_header()
Out[5]:
@saimn
saimn / setup.py
Created December 13, 2012 08:34
setup.py for pyexiv2
from setuptools import setup, find_packages, Extension
version = "0.3.3"
setup(
name="pyexiv2",
version=version,
url='http://tilloy.net/dev/pyexiv2/',
author='Olivier Tilloy',
author_email='[email protected]',
import codecs
from fabric.api import local
import os
DEST_PATH = 'kimsufi:saimon.org'
# ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
def clean():
local('rm -r _build')
import io
from PIL import Image
from PIL import TiffImagePlugin
im = Image.open('tmp/test/in/1900-1910/00/joey.jpg')
exif = im._getexif()
data = im.info["exif"]
file = io.BytesIO(data[6:])
head = file.read(8)
@saimn
saimn / No error - Code
Last active August 29, 2015 14:10
FITS Verify error
from astropy.io import fits
from astropy.wcs import WCS
hdu = fits.open('muse/CoreLib-1.1.12/data/obj/image.fits.gz')
header = hdu[0].header
print header
wcs = WCS(header)
@saimn
saimn / gist:7471a06f96be0d6a285b
Created February 17, 2015 14:50
Sqlite-browser traceback
Traceback (most recent call last):
File "/home/simon/lib/virtualenvs/db/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/home/simon/lib/virtualenvs/db/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/simon/lib/virtualenvs/db/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/simon/lib/virtualenvs/db/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/simon/lib/virtualenvs/db/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
@saimn
saimn / Carte-Carburants.ipynb
Last active August 29, 2015 14:27
Map of fuel prices in France
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pyregion
from astropy.table import Table
from pyregion.parser_helper import Shape
def table_to_region(table, outfile, racol='ra', deccol='dec', color='green'):
if isinstance(table, (str, unicode)):
table = Table.read(table)
if isinstance(color, (str, unicode)):
@saimn
saimn / ascii_write_bench-master.ipynb
Last active February 24, 2016 22:34
Astropy fast reader - write benchmark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.