%matplotlib inline import numpy as np import matplotlib.pyplot as plt import sunpy sunpy.system_info() print sunpy.AIA_171_IMAGE import sunpy.map aiamap = sunpy.map.Map(sunpy.AIA_171_IMAGE) aiamap aiamap.data aiamap.data.max() aiamap.data.std() aiamap.data.min() aiamap.meta aiamap.meta.keys() aiamap.meta.get('rsun_obs') print(aiamap.date, aiamap.coordinate_system, aiamap.detector, aiamap.dsun) aiamap.scale aiamap.yrange aiamap.xrange aiasub = aiamap.submap([-250,50],[-550,-250]) aiasub.xrange, aiasub.yrange fig, ax = plt.subplots(1, figsize=(7,7)) im = aiasub.plot(axes=ax, vmin=100, vmax=aiasub.data.max()) ax = aiasub.draw_grid(grid_spacing=5) cbar = plt.colorbar() compmap = sunpy.map.Map(sunpy.AIA_171_IMAGE, sunpy.RHESSI_IMAGE, composite=True) levels = np.arange(0,50,5) print(levels) compmap.set_levels(1, levels, percent=True) compmap.set_alpha(1,0.5) compmap.set_colors(1, 'Reds_r') ax = plt.subplot() compmap.plot() ax.axis([200, 600, -600, -200]) plt.show() from sunpy.spectra.sources.callisto import CallistoSpectrogram tstart, tend = "2011-06-07T06:00:00", "2011-06-07T07:45:00" callisto = CallistoSpectrogram.from_range("BIR", tstart, tend) callisto.peek(vmin = 0) callisto_nobg = callisto.subtract_bg() callisto_nobg.peek(vmin = 0) callisto_nobg.peek(vmin = 0, vmax = 40) callisto.data import sunpy.lightcurve evelc = sunpy.lightcurve.EVELightCurve.create('2014/01/01') evelc.data fig = plt.figure() ax = evelc.data['XRS-B proxy'].plot() plt.show() ax = evelc.data['17.1ESP'].plot() evelc.meta from pandas import isnull evelc.data['17.1ESP'][evelc.data['17.1ESP'] == -1] evelc.data['17.1ESP'][evelc.data['17.1ESP'] == -1] = np.nan evelc.data.replace(-1, np.nan) evelc.data['17.1ESP'][evelc.data['17.1ESP'] == -1] import pandas as pd pd.__version__ ax = evelc.data['17.1ESP'].plot() from sunpy.sun import constants as sun sun.mass type(sun.mass) print(sun.mass) (sun.mass/sun.volume).cgs sun.find('age') sun.value('age'), sun.unit('age') from sunpy.net import vso client = vso.VSOClient() tstart, tend = '2011/6/7 05:30', '2011/6/7 6:30' lasco_query = client.query(vso.attrs.Time(tstart, tend), vso.attrs.Instrument('lasco')) lasco_query.num_records() lasco_query.show() pathformat = '/Users/schriste/sunpy/data/{file}.fits' results = client.get(lasco_query, path = pathformat) instrument_condition = ( vso.attrs.Instrument('lasco') | vso.attrs.Detector('cor1') ) coronagraphs = client.query(vso.attrs.Time(tstart, tend), instrument_condition) coronagraphs.num_records() coronagraphs.show() from sunpy.net import hek client = hek.HEKClient() tstart, tend = '2011/08/09 00:00:00', '2011/08/10 00:00:00' result = client.query(hek.attrs.Time(tstart,tend), hek.attrs.EventType('FL')) # ’FL’ indicates flare len(result) result result = client.query(hek.attrs.Time(tstart, tend), hek.attrs.EventType('FL'), hek.attrs.FRM.Name=='SSW Latest Events') len(result) result = client.query(hek.attrs.Time(tstart, tend), hek.attrs.EventType('FL'), (hek.attrs.Event.Coord1>50) or (hek.attrs.FL.PeakFlux>1000.0)) len(result) from sunpy.net import hek2vso h2v = hek2vso.H2VClient() vso_results = h2v.translate_and_query(result[0]) h2v.vso_client.get(vso_results[0]).wait() from sunpy import wcs wcs.convert_hg_hpc(10, 53) wcs.convert_hpc_hg(100.49, 767.97) wcs.convert_hpc_hg(-1500, 0) wcs.convert_hpc_hcc(-300, 400, z=True)