Skip to content

Instantly share code, notes, and snippets.

View dpshelio's full-sized avatar
🌴
On vacation

David Pérez-Suárez dpshelio

🌴
On vacation
View GitHub Profile
@dpshelio
dpshelio / corona_history.py
Created March 12, 2016 02:02
what's the number of images perspacecraft per instrument per detector per month
import datetime
import calendar
from itertools import product
import json
from sunpy.net import vso
def add_months(sourcedate, months):
month = sourcedate.month - 1 + months
year = int(sourcedate.year + month / 12 )
@dpshelio
dpshelio / helio_all2helio_bits.sh
Created February 28, 2016 12:55
Breaking a git repository into multiple ones for each folder
git clone git@github.com:helio-vo/helio.git helio-all
cd helio-all
for i in $(find ./ -not -name '.*' -type d -maxdepth 1); do cp -r ../helio-all \.${i}; cd \.${i}; git filter-branch --prune-empty --subdirectory-filter ${i} -- --all; cd ../helio-all; done
cd ..
for i in $(find ./ -type d -maxdepth 1'); do cd ${i//.\/}; git remote set-url origin git@github.com:helio-vo/${i//.\/}; git push --all origin; cd .. ; done
@dpshelio
dpshelio / EISpy_examples.ipynb
Last active December 10, 2015 14:29
EIS fitting and stuff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dpshelio
dpshelio / AstropyUnits.ipynb
Last active October 28, 2015 15:11
Astropy units being used
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dpshelio
dpshelio / Downloading_data_sunpy.ipynb
Last active October 23, 2015 15:52
download data from sunpy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dpshelio
dpshelio / diffrot.py
Last active August 29, 2015 14:27 — forked from Cadair/gist:5893586
How to compensate for differential rotation in the default sunpy image. This is based upon a combination of pr/452 and pr/482 my branch for which can be found here: https://github.com/Cadair/sunpy/tree/map_refactor_diff_rot
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 21:31:58 2013
@author: stuart
"""
import numpy as np
from datetime import timedelta
@dpshelio
dpshelio / pixel.py
Created July 27, 2015 09:48
Problem when wcsaxes is on, the plot uses pixel coordinates on the image, no degrees or arcsecs.
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from skimage.measure import find_contours
import sunpy.map
xsub = 400 * u.arcsec + 75 * ([-1, 1] * u.arcsec)
ysub = 300 * u.arcsec + 50 * ([-1, 1] * u.arcsec)
map01 = sunpy.map.Map('./hmi.m_45s.2010.08.10_12_01_30_TAI.magnetogram.fits').submap(xsub, ysub)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dpshelio
dpshelio / idl.startup
Last active August 29, 2015 14:13
SSW from bash
device, true_color = 24
device, decomposed = 0
device, retain = 2
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from astropy.wcs import WCS
from astropy.io import fits
from wcsaxes import WCSAxes
import sunpy.map
from sunpy.net import vso