Skip to content

Instantly share code, notes, and snippets.

View barentsen's full-sized avatar

Geert Barentsen barentsen

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barentsen
barentsen / lightkurve-to-timeseries-demo.ipynb
Created March 25, 2019 19:33
lightkurve-to-timeseries-demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barentsen
barentsen / example-coordinate-conversion.py
Created March 28, 2017 21:26
Simple example for conversion from pixel (x,y) to celestial (ra,dec) using astropy
"""Example conversion from pixel coordinates to ra/dec."""
from astropy.io import fits
from astropy.wcs import WCS
x, y = 250, 250
f = fits.open('f242_e0_c98.fits')
mywcs = WCS(f[0].header)
ra, dec = mywcs.all_pix2world([[x, y]], 0)[0]
@barentsen
barentsen / plot-astropy-benchmarks-by-python-version.py
Created January 8, 2017 18:32
Compares the performance of AstroPy between different versions of Python (2.7 vs 3.x).
"""Compares the performance of AstroPy between different versions of Python (2.7 vs 3.x).
This script reads AstroPy's benchmarking output (cf. github.com/astropy/astropy-benchmarks.git)
as generated by the airspeed velocity benchmarking package (cf. asv.readthedocs.io).
It then compares & plots the median execution time for different Python versions.
This script was hacked together as part of the Hack Day at the 229th American Astronomical
Society (AAS) meeting held in Grapevine, Texas. (Twitter: #hackaas #aas229.)
The output of this script is shown in the following tweet:
@barentsen
barentsen / First-try-at-PSF-fitting-of-TESS-data-using-Astropy-Photutils.ipynb
Last active November 2, 2016 16:29
First try at PSF fitting of TESS data using Astropy Photutils
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barentsen
barentsen / compute-galactic-plane-coordinates.py
Created September 20, 2016 17:32
Compute the ICRS Right Ascension (ra) and Declination (dec) coordinates for the entire Galactic Plane.
"""Compute ra and dec for the Galactic Plane.
This script computes the ICRS Right Ascension (ra) and Declination (dec)
coordinates for the entire Galactic Plane and writes them to a csv file.
"""
import numpy as np
import pandas as pd
from astropy.coordinates import SkyCoord
galactic_longitudes = np.arange(start=0, stop=360, step=0.1)
@barentsen
barentsen / c9-superstamp-polygons.json
Created September 16, 2016 20:50
c9-superstamp-polygons.json
{
"channels": {
"31": {
"dec": [
-28.031356156487746,
-27.755350022942594,
-28.854298809320532,
-29.131659330859346,
-28.031356156487746
],