Sunday, July 10, 2016

 AIA Instrument Wavelength Response Working!

 

The past few weeks started with success in getting code that worked up to a gain calculation, and then was followed with working through bugs while I implemented changes to restructure the code and calculating the gain.

 

 

  Newly Implemented Response.py Code Features:

  • .genx properties now saved to Astropy QTable structure to utilize storage of data type and units.
  •  Effective Area function now can load for the whole wavelength range or for just the channel specified
  • Instrument Wavelength response outputs values close to what we expect!

 Table Structure:

 

Previously, I was storing the information gathered from .genx files in a dataframe. This worked, but we wanted a way to store units and data types with the actual values as well. This is possible with a new and exciting thing called Astropy Table structures. (Okay, new and exciting to me.) But, figuring out the best method for filling these was difficult. Here is what worked:

First, I made a table:

> table = QTable(names = array_of_property_names , dtype = array_of_data_types)

Initially, I was trying to fill a whole column of channel data (the inverse axis of what is now implemented). This worked fine, but there isn't a way to save different data type values in one column. So, I filled the table row by row with an array for each channel where each element was a value corresponding to the property in the column name.

> table.add_row(array_of_channel_properties)


I also added in a Column after the table was filled. This effectively inserted the channel names for each row to be used as an index.


> C = Table.Column(data=channel_list, name='channel', dtype=int)
> table.add_column(C, index = 0)
> table.add_index(['channel'])

One issue that came up was that any np.ndarray that was stored in the array would not be loaded into the row as I was requesting.  I found a  way around this was to list the data type for these as 'object'. Then, when they are read in to the program as one object, I simply iterated through them and restored the elements as a np.array. 


 Gain Calculations:


The last post displayed instrument calibration plots. Of those, the effective area function is the most important because it gives us an idea as to how the instrument is responding at wavelengths where we see strong emission spectra from solar features. The values obtained at these wavelengths are multiplied by the wavelength dependent gain of the ccd system to get a wavelength response function, as defined by Boerner et al. (2012). Sounds so simple, but it has taken a while to nail down.

Initially, I used the entire wavelength range for each channel to calculate the Effective Area and then plotted them around specific wavelengths. When I went to use these values for calculating gain, they turned out to be tiny (eg 10^ -12)! After some research, I divided this by the plate scale to get a reasonable number, but it still was off. 

As it turns out, I had found a hidden bug. Any arrays loaded in from ssw packages contain properties of the AIA instrument, and cover some wavelength range. I found that the index of these arrays at the value that corresponded to a desired wavelength was not the same as the wavelength number (which was a subtle but quick assumption on my part). After changing the way the arrays were indexed (to correspond to the desired wavelength),  I obtained nice values from the Effective Area function and worked on calculating the gain of the system. 

Here is a chart listing the wavelength response values for each channel:





Wavelength Response



SSW imported Eff-area Eff-area function Eff-area function

Boerner Table 2 SSW imported gain Table 2 Gain Table 6 ccd gain
channel Reference calculated response calculated response calculated response
94 0.664 0.572 0.617 0.524
131 1.785 1.87 1.933 1.714
171 3.365 3.257 3.389 2.987
193 1.217 1.79 1.906 1.642
211 1.14 1.101 1.184 1.01
304 0.041 0.038 0.0413 0.035
335 0.027 0.0255 0.026 0.023

Notes:
Column 2 lists the values we expect from this function.
Column 3 is the calculation using only SSW imported values. 
Column 4 is how I tested the effective area function - by using the gain provided by the reference table 2 in Boerner 2012. 
Column 5 are the values obtained using my own gain calculation using the ccd instrument gain.

 Voila! With these values, the wavelength response function is complete! 

 

Now, my mentors and myself will need to decide which is the best to use moving forward, and as a preview, the next blog will be a detailed report on the next function..... Emissivity!

***