Skip to content

Instantly share code, notes, and snippets.

View ehsteve's full-sized avatar
πŸ‘‹

Steven Christe ehsteve

πŸ‘‹
View GitHub Profile
@ehsteve
ehsteve / latis.py
Created April 16, 2020 12:59
LISIRD python script
import pandas as pd
import requests
from io import StringIO
datasets = [line.rstrip("\n") for line in open("datasets.dat")]
i = 2
url = f"http://lasp.colorado.edu/lisird/latis/dap/{datasets[i]}.csv?format_time(yyyy-MM-dd'T'HH:mm:ss.SSS)"
d = "time>=2005-05-05T12:00&time<2006-05-05T12:00"
from sunpy.util.scraper import Scraper, TIME_CONVERSIONS
import datetime
import re
from sunpy.time import TimeRange, parse_time
tr = TimeRange('2019/05/12 00:50', '2019/05/12 01:40')
url = 'https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes/goes16/l2/data/suvi-l2-ci284/2019/04/05/'
fname = 'dr_suvi-l2-ci284_g16_s20190405T122400Z_e20190405T122800Z_v1-0-0.fits'
search_pattern = "https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes/goes16/"
@ehsteve
ehsteve / lasco_with_stars.py
Created April 11, 2019 17:54
An example of how to plot stars on a lasco image
import sunpy.map
import matplotlib.pyplot as plt
from astropy.coordinates import SkyCoord
from sunpy.coordinates import frames
import astropy.units as u
from astropy.time import Time
# image from helioviewer
f = '/Users/sdchris1/Library/Containers/com.apple.Preview/Data/Downloads/2000_02_27__07_42_05_810__SOHO_LASCO_C3_white-light.jp2'
@ehsteve
ehsteve / new_sunpy_objects.md
Last active January 13, 2017 14:39
A new organization for SunPy objects

This document describes a new way to organize in a self-consistent way SunPy objects.

Spatial Temporal Spectral Note
SpaceSeries (1d spatial data, e.g. slice from a map) do not exist
SpaceSequence (slit spectrogram where x is main axis) do not exist
GenericMap GenericTimeSeries GenericSpectrum Base object, X is name of the instrument
MapCollection (renames current CompositeMap) TimeSeriesCollection SpectrumCollection a collection of data usually taken at the same time but by different instruments
MapSequence (replaces current MapCube, Mapcubed would subclass this) TimeSeriesSequence (ex. spectrogram where t is main axis) SpectrumSequence (ex. spectrogram where freq/energy is main exist) a series of related measurements such as as a function of time (MapSequence) or a function of energy (TimeSeriesSequence)
class oneDimensionalData( NDData ):
"""A barebone class to handle one-dimensional data.
Examples of dims;
def __init__(self, x, y, yerr, meta, unit, dims):
self.data = y
self.uncertainty = yerr
self.meta = meta
self.unit = unit
@ehsteve
ehsteve / gist:48bd796083b9030817a899f84ce2dce6
Created June 1, 2016 23:38
spd2016 - intro to quantities
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
List
* diecut ready
* circle round

Keybase proof

I hereby claim:

  • I am ehsteve on github.
  • I am schriste (https://keybase.io/schriste) on keybase.
  • I have a public key whose fingerprint is 7DA7 E902 A5BF 3A21 4DBE 6E4B 258F BDE8 FC23 E104

To claim this, I am signing this object:

@ehsteve
ehsteve / pysetters.py
Created September 28, 2015 12:33
python setters
from collections import namedtuple
Pair = namedtuple('Pair', 'x y')
def afunction(x, y):
return [x + y, x - y]
class Test(object):
def __init__(self):
self._a = Pair(1, 2)
@ehsteve
ehsteve / gist:033a558bd1df7bf56ddf
Created June 23, 2015 14:24
pip install --upgrade wcsaxes
pip install --upgrade wcsaxes
Collecting wcsaxes
Using cached wcsaxes-0.4.tar.gz
Collecting astropy (from wcsaxes)
Downloading astropy-1.0.3.tar.gz (7.6MB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 7.6MB 36kB/s
Requirement already up-to-date: matplotlib in ./anaconda/lib/python2.7/site-packages (from wcsaxes)
Requirement already up-to-date: numpy>=1.6.0 in ./anaconda/lib/python2.7/site-packages (from astropy->wcsaxes)
Requirement already up-to-date: six>=1.4 in ./anaconda/lib/python2.7/site-packages (from matplotlib->wcsaxes)
Collecting python-dateutil (from matplotlib->wcsaxes)