Monday, August 22, 2016

AIA Response Summary

This is my final blog post for GSoC. It contains a summary of the work that has been completed over the summer, and some points of how to extend this module further.

Project Goal: A SunPy AIA response module that includes temperature and wavelength response functions that will utilize ChiantiPy and the CHIANTI database.

Main PR Links:

Project Abstract:

Solar physics uses the CHIANTI atomic physics database to obtain properties about various elements and ionisation states. By using observed elemental abundances and ionization states, one can use CHIANTI to obtain synthetic spectra of solar plasma of various features which informs a response function used by the observational instruments themselves. This response function is vital to understanding observations.

The Atmospheric Imaging Assembly (AIA) is a multi-wavelength imager on the Solar Dynamics Observatory, specifically looking at the solar corona to understand magnetic processes.

This program uses SunPy and ChiantiPy  to calculate two response functions that infer plasma properties like temperature and density for the AIA:
  • Wavelength response functions: calculate the amount of flux per wavelength measured by AIA
  • Temperature response functions: calculate the sensitivity of light from the plasma per temperature measured by AIA

    Major Resources:

    Project based on Research Paper - Boerner et al. (2012)
    SunPy -  Sunpy User Guide

    To Run the Reponse Module:

    >>>  from sunpy.instr.aia import Response
    >>> path = 'path/to/ssw/aia/response/data.genx'
    >>> channel_list = [94,131,171,193,211,304,335] 
    >>> response = Response(path_to_genx_dir = path, version = 6, channel_list = channel_list)

    This starts the Response module, and then can be used to calculate and look at the wavelength response or the temperature response of the instrument.  

    To look at the calibration of one part of the instrument, one can use a simple loop for multiple channels, or like this for one channel:
    >>> primary_mirror = response.get_channel_data(94)['primary_mirror_reflectance']
    >>> secondary_mirror = response.get_channel_data(94)['secondary_mirror_reflectance']
    >>> total_reflectance = primary_mirror + secondary_mirror

    The transmittance , reflectance, quantum efficiency, and ccd contamination plotted versus the wavelengths (response.get_channel_data(94)['wavelength_range']) will return calibration plots. 

    To view an instrument response, the Effective area vs wavelength is one of the more important features as this defines the wavelength response for each channel. For that, just calculate the response, and then use the attribute for each channel. Using the values from a .genx file is recommended for best results, but a calculated effective area is available.

    >>> response.calculate_effective_area(94, use_genx_effarea = True)
    Similarly, the temperature response can be calculated and then called as an attribute. The function takes into account the contribution from each ion transition in small wavelength ranges. Due to using ChiantiPy, the population of a datatable is necessary and is expensive in terms of time. 

    >>> response. calculate_temperature_response(94)

    This function returns a dictionary giving the wavelength and response values that can be used to plot the function on a log-log scale. Alternate temperatures can be provided using the temperature_array keyword. 

    Final Thoughts:


    This project has incorporated many programs (SunPy, SSW, ChiantiPy) and many new ideas. I'm very proud to have constructed the response functions. With these implemented, it provides a way to do calibration using the instrument properties. However, many of the struggles in the project have been from understanding everything that was implemented in the SSW version of these functions, and as a result, many more features could still be added as explained in the next section. I'm very happy with the overall product and feel it is a good base (as I had hoped it would be starting out). A special thanks to my advisor’s Will Barnes and Drew Leonard. They have always been very supportive during this process and provided invaluable advice and direction.

    Next Steps:


    1. The program sunpy/instr/tests/ has housed all of my initial testing parameters that were not implemented in this project. This will need to be flushed out as additional features are implemented.
    2. SunPy could benefit from a general .genx reader. This was discussed in the developer meetings for this project. Currently, I have implemented a program with this module called This can be removed with the addition of a general .genx reader.
    3. SunPy could also benefit from having a defined file storage application. Currently, the temperature response in this code requires the user to calculate a datatable to store for future use. With a file storage application, this could be stored ahead of time, allowing for quick calculations as needed. 
    4. One additional feature that could be implemented is the ability to alter density in the temperature response. Currently, it is the constant 1e+9, but the ability to have this as an array of density = various pressures * temperature would allow for more generalization.
    5. The temperature response creates an ion datatable if one is not already created. This feature would greatly benefit from a way in ChiantiPy to search the transitions that happen in small wavelength ranges without having to create an ion object for each ion. The only way that I found was to use the ion.Intensity to see which transitions occur, but having to make an ion  object for each ion takes a long time.

    Thanks GSoC for this opportunity!


Tuesday, August 2, 2016

Temperature Response Functions


The AIA instrument on the Solar Dynamics Observatory doesn't have any spectroscopic abilities so it has no way to calibrate the data directly. My projects wavelength response and temperature response function are necessary to infer plasma properties like temperature and density using this instruement. Essentially, the temperature response function calculates the sensitivity of light from the plasma at specific wavelengths and temperatures as measured by the AIA. 

These plots are reproductions of those found in Boerner et al. (2012) . Figure 11 in this paper utilized initial calibrations of AIA.  I use last posts wavelength response function (that utilize instrument information as found in Version 6 of SSW data files) to obtain this new function:

Temperature Response Functions

This displays the temperature response for all six extreme ultra violet channels (EUV) observed with the AIA instrument vs Temperature on a log 10 scale. It is calculated by multiplying the wavelength response function times an ion contribution function, and then iterating through all of the wavelengths in the desired region.

The wavelength response function that I previously implemented tell the efficiency of the optics around each instruments channels wavelength center. The new and difficult part of this function was implementing the contribution function of each ion. This is where I've utilyzed ChiantiPy. This python package accesses CHIANTI, an 'Atomic Database for Spectroscopic Diagnostics of Astrophyiscal Plasmas'. As well as having a large range of atomic elements, this code analyses each ion to get attributes such as ionization, intensity of various lines, and emission measurements. The contribution function in ChiantiPy uses these  parameters and is strongly peaked in temperature. With it, we can gauge the sensitivity of light from the plasma seen by the AIA instrument as a function of wavelength and temperature.

Temperature Response Per Channel VS Temperature  

 Channels: 94, 131, 171, 193, 211, 304, 335
Temperature is on a log base 10 scale

The values for these response functions are still a bit higher than anticipated. At first, I tried incorporating the plate scale of the instrument to see if this helped, but unless I also multiply by an assumed density, the units for this do not match to the expected result. 

Finishing up Goals:

  1.  I edited ChiantiPy so that the contribution function would not plot. This allowed me to obtain the values for multiple ions at a time. Unfortunately, this means that I am needing this to be added to ChiantiPy on github if this code is going to be implemented into Sunpy on github. The issue I ran into with this is that I had been editing a lot of my version of ChiantiPy while I was testing out different methods. I plan reinstalling the github version, inserting my changes in just the contribution function, and submitting a pull request asap!
  2. One change that was recommended in the SunPy developer meeting last week is to make a dataframe containing the ion contributions. This will speed up the process if it can be read each time instead of calculating them each time. I think this is a great idea and am in the midst of implementing it.
  3. I'd like to make this code as general as possible. This means adding more keywords so the user can specify their own temperature, density, ions, etc. 
  4. Documentation! This is something I've taken time to read up on more this week because I recognize how wonderful convention can be when making code more readable. It is a process that I am still working through.