In [ ]:
 

Getting at Data

Both SunPy and Astropy have utilities for downloading data for your delectation. They are simple and easy to use, however increasing levels of computing will allow a great deal of personalisation and selection. Let us begin with SunPy

Aquiring Data with SunPy

VS0

This is the main interface which SunPy to search for and find solar data. VSO stands for the Virtual Solar Observatory, a service which presents a homogenous interface to heterogenous data set.

So what do we need?

In [2]:
 

This is your client object. This is effectively the intermediary between yourself and the treasure chest of solar data available. You query VSO, then VSO querys all data providers which fit the limiations you imposed during your search command. The VSO client also handles the particulars of dowloading the data onto your machiene.

Making a query

Lets kick off with an example, lets ask the veteran of solar imaging, SoHO for some EIS data, between the dates of between January 1st and 2nd, 2001,

In [ ]:
 

qr is a Python list of response onjects, each one a record that the VSO has found.

In [ ]:
 

Break it down

So we can pass many attributes to the VSO, in this case we started with time

 vso.attrs.Time('2001/1/1','2001/1/2')

Start and end times for the query as strings, any date/time function can be understood by SunPy's parse_time function e.g. the datetime onjects we will look at later. Next we give it the instrument we want:

 vso.attrs.Instrument('eit') 

You don't have to pass it an instrument, the client will find all available missions in the parameter you've defined if you like. Next, wavelength:

 vso.attrs.Wave(14.2*u.nm, 12.3*u.nm)

We pass it a min and max wavelength. This has to be an astropy units quantity (in SI for the love of coffee). If you don't you will get an error.

For a full list of attributes that vso can take use `help(vso.attrs):

In [4]:
 

So we can use multiple instument queries and define get smaller sample times but narrowing down the query:

In [ ]:
 

HEK

The Heliophysics Event Knowledgebase (HEK) is a repository of feature and event information about the Sun. Entries are generated both by automated algorithms and human observers.

We need to set up HEK in a similar way to VSO

In [ ]:
 

Creating a very similar client as we saw with VSO above.

Given that HEK is a database of solar events of interest, the query has different requirements to VSO. It needs start and end times, and an event type. Again time objects can be defined as datetime objects or correctly formatted strings.

Event types are specified as uppercase two letter strings found on the HEK website

In [ ]:
 

Notice that the HEK query is extremely similar to the VSO query style, with our attributes defined accordingly.

Instead of returning a list, HEK returns a list of dictionary objects. Each entry in the dictionary sis a pair of key-value pairs that exactly correspond to the parameters. We can return the key words using:

In [ ]:
 

Remember, the HEK query we made returns all the flares in the time-range stored in the HEK, regardless of the feature recognition method. The HEK parameter which stores the the feature recognition method is called “frm_name”. Using list comprehensions (which are very cool), it is easy to get a list of the feature recognition methods used to find each of the flares in the result object, for example:

In [ ]:
 

This way we can avoid troublesome doubling up of results. We can do the same help(hek.attrs) command as VSO to fins out further options.

Aquiring data with AstroQuery

Astroquery supports a plethora of services, all of which follow roughly the same API (application program interface). In its simplest for the API involves queries based on coordinates or object names e.g. using SIMBAD:

In [ ]:
 

In this case the query is looking at a specific set of coordinates

In [ ]:
 

These methods can be expanded to all the following modules

  • SIMBAD Queries (astroquery.simbad)
  • IRSA Dust Extinction Service Queries (astroquery.irsa_dust)
  • NED Queries (astroquery.ned)
  • Splatalogue Queries (astroquery.splatalogue)
  • IRSA Image Server program interface (IBE) Queries (astroquery.ibe)
  • IRSA Queries (astroquery.irsa)
  • UKIDSS Queries (astroquery.ukidss)
  • MAGPIS Queries (astroquery.magpis)
  • NRAO Queries (astroquery.nrao)
  • Besancon Queries (astroquery.besancon)
  • NIST Queries (astroquery.nist)
  • NVAS Queries (astroquery.nvas)
  • GAMA Queries (astroquery.gama)
  • ESO Queries (astroquery.eso)
  • Atomic Line List (astroquery.atomic)
  • ALMA Queries (astroquery.alma)
  • Skyview Queries (astroquery.skyview)
  • NASA ADS Queries (astroquery.nasa_ads)
  • HEASARC Queries (astroquery.heasarc)