Skip to content

mwvgroup/Surface-Brightness

Repository files navigation

Calculating Near and Far UV Surface Brightness for Local Environments of Supernovae

Project Description:

Using observations from Galex, we calculate the near and far UV surface brightness of variously sized regions surrounding supernova locations. We do this for supernova considered by Friedman et al. 2015, Rigault et al. 2015, and a number of supernova observed by the MWV research group. Results are found by summing over the photon counts from int type .fits files and removing the background signal given by the corresponding skybg files. For more information on these file types, a summary of Galex data products can be found on the Galex website.

For the Rigault 2015 supernova we consider a 2kpc radius region around each SN location. For Friedman 2015 and group observed supernova, we consider 1 kpc radius region along with a 5 kpc radius region for comparison with Kelly et al. 2015. These values are chosen so that results can be compared against the previously mentioned publications.

Code Overview:

Reproducing results

Results for each group of supernova are generated by separate .ipynb files . Each of these files begins by importing a surface_brightness class from surface_brightness.py. This class handles the calculation of flux and surface brightness values along with the generation of output plots (this class and how it works is described in more detail later on). To reproduce the results in this repository, changes only have to be made to the appropriate .ipynb file. Begin by setting the value of parameters located after the comment #Input / Output Information. These parameters include:

  • input_data_table : The file path of a .csv file containing the names, locations, and redshifts for each supernova of interest.

  • fits_directory : A directory containing .fits files used to calculate surface brightness values. The script will automatically search through all sub directories. To change this behavior, alter surface_brightness.py following the comment #Create a list of files to perform photometry on.

  • output_file_name : A keyword to be contained in the output file names. File extensions will be added on automatically.

  • sn_col_name : The name of the column containing supernova names from input_data_table

  • redshift_col_name : The name of the column containing redshift values from input_data_table

  • ra_col_name : The name of the column containing right ascension values from input_data_table

  • dec_col_name : The name of the column containing declination values from input_data_table

These steps hold for reproducing any of the results in this repository. The remainder of the code should run without any further changes. For referance, .fits files used to generate the results in this repository have been uploaded to Marduk at /home/depot/WIYN/GALEX/fits files/. Detailed comments are contained within each .py and .ipynd file to provide a step by step outline on how the code works.

Initiating a surface_brightness class

When creating a new surface_brightness instance, two arguments are provided:

brightness = surface_brightness(cord_dict={}, red_dict={})

The first argument is a dictionary of supernova coordinates stored as SkyCord objects {'SN name' : SkyCord}. The second is a dictionary of redshifts for each supernova stored as floats {'SN name' : redshift}. If the keys in both dictionaries do not match, a ValueError will be raised. After a surface_brightness class has been initiated, both dictionaries can be modified by changing the .cord_dict and .red_dict attributes respectively.

The create_tables Method

.create_tables(uv_type, directory, radius, print_progress=False)

The create_tables method begins by walking through the directory directory and building a list of .fits files to be analyzed. If uv_type is set equal to 'NUV' then only .fits files with 'nd-int' in their name will be added to the list. Similarly, if uv_type is set equal to 'FUV' only files with 'fd-int' are considered. These strings distinguish .fits files with observations in the near or far UV and are included by Galex in most of their data products.

Using coordinates from .cord_dict, each .fits file is checked for an observed supernova. If one or more supernova are found, photometry is performed at the supernova location using the photutils package. The radius of the aperture used to perform photometry is given in kpc by the radius argument. For large amounts of .fits files, this method can take a few minutes to run. If you want a visual measure of progress, setting print_progress equal to True will cause the method to print out the path of the current .fits file being processed.

Using photometry results from the int files, the corresponding flux, luminosity, and surface brightness values are calculated and added to a data table. If more than one .fits file contains a given supernova, only the surface brightness value with the smallest error is included. If an issue arises during the photometry process, the file path and issue are added to a second table. This table acts as a log for files that are either missing exp type check files, or do not have a supernova in their field of view. The create_tables method returns these two tables as a list [data table, log table].

The create_plots method

.create_plots(data_table, uv_type, radius)

The create_plots function uses data returned by the create_tables method to create logarithmic plots of surface brightness vs redshift. It will create one plot in units of (erg s-1 A-1 arcsec^-2) and a second in (erg s-1 A-1 kpc^-2). To use the create_plots method, pass the first table returned by the create_tables method as data_table. The arguments uv_type and radius are used to parse the table and apply the appropriate labels to the output plots. uv_type should be set equal to either 'NUV' or 'FUV' depending on the type of observations contained in data_table. radius should be set equal to the radius of the aperture used in kpc. These plots are saved to the working directory as "radius kpc uv_type plot (arcsec).pdf" and "radius kpc uv_type plot (kpc).pdf".

###Important features

The int type .fits files used in this project contain a circular collection of pixels corresponding to the observing telescope's field of view (here is an example image). All pixels outside this field of view are assigned a value of 0. When performing photometry, if the returned photometry value is 0 there is no immediate way of knowing if the corresponding supernova (and by extension the photometry aperture) is within the field of view. For such cases the script will perform photometry on a secondary check file. By default, the check file used is an exp type .fits file where zero valued pixels only occur outside the field of view. If performing photometry on the check file yields a non-zero value, then the aperture is deemed to be within the telescope's field of view.

Calculating Surface brightness from Photometry values

Given a photometry value photom, the corresponding flux is given in (erg sec-1 cm-2 Å-1) by a conversion factor flux_conv

flux = flux_conv * photom 

This conversion factor is given by the Galex website as 2.06 x 10-16 for near UV observations and 1.40 x 10-15 for the far UV. The Luminosity is given by the flux times the surface area. Using the WMAP9 cosmology,

from astropy.cosmology import WMAP9 as cosmo
import numpy as np

ldist = cosmo.luminosity_distance(redshift).cgs.value
lum = flux * 4 * np.pi * (ldist**2) 

To find surface brightness in the desired units, we convert from units of kpc^-2 to armin^-2 and then from arcmin^-2 to arcsec^-2

arcmin = cosmo.kpc_comoving_per_arcmin(redshift).value**2 
sbrightness = lum * arcmin / 3600

About

Surface Brightness Calculations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published