Skip to content

Instantly share code, notes, and snippets.

View barentsen's full-sized avatar

Geert Barentsen barentsen

View GitHub Profile
@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 / gist:bacd4360fb31e7456d659d07b014e834
Created June 21, 2016 09:01
How to get clickshare working on Ubuntu 16.04
sudo apt install libresample1
wget http://mirrors.kernel.org/ubuntu/pool/universe/liba/libav/libavutil52_9.18-0ubuntu0.14.04.1_amd64.deb
sudo dpkg -i libavutil52_9.18-0ubuntu0.14.04.1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/liba/libav/libswscale2_9.18-0ubuntu0.14.04.1_amd64.deb
sudo dpkg -i libswscale2_9.18-0ubuntu0.14.04.1_amd64.deb
wget https://www.dropbox.com/s/gg2i5wszrqkhzy8/clickshare_01.07.01-79_amd64.deb?dl=0#
sudo dpkg -i clickshare_01.07.01-79_amd64.deb
@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 / ga2equ.py
Created April 12, 2012 14:47
Conversion of galactic to equatorial coordinates (J2000.0)
from math import *
import numpy as np
def ga2equ(ga):
"""
Convert Galactic to Equatorial coordinates (J2000.0)
(use at own risk)
Input: [l,b] in decimal degrees
Returns: [ra,dec] in decimal degrees
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.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barentsen
barentsen / interpret-kepler-quality-flags.py
Last active February 15, 2019 21:42
Convert the 'QUALITY' column in Kepler/K2 target pixel and light curve files into a list of human-readable flag strings.
"""
Example function to convert the 'QUALITY' column in Kepler/K2 target pixel
and lightcurve files into a list of meaningful strings.
"""
# The meaning of the various flags are described in the Kepler Archive Manual
KEPLER_QUALITY_FLAGS = {
"1": "Attitude tweak",
"2": "Safe mode",
"4": "Coarse point",