suncasa.eovsa.eovsa_dspec

Module Contents

Functions

get_dspec(filename[, doplot, vmax, vmin, norm, cmap])

Reads and optionally plots an EOVSA Dynamic Spectrum from a FITS file.

suncasa.eovsa.eovsa_dspec.get_dspec(filename, doplot=False, vmax=None, vmin=None, norm=None, cmap=None)[source]

Reads and optionally plots an EOVSA Dynamic Spectrum from a FITS file.

This function reads a FITS file containing EOVSA dynamic spectrum data, returning the data as a dictionary. If requested, it also generates a plot of the dynamic spectrum.

Parameters:
  • filename (str) – Path and name of the EOVSA dynamic spectrum FITS file to read.

  • doplot (bool, optional) – If True, generates a plot of the dynamic spectrum. Default is False.

  • vmin (float, optional) – Minimum value for the color scale. Ignored if norm is provided. Default is None, which autoscales.

  • vmax (float, optional) – Maximum value for the color scale. Ignored if norm is provided. Default is None, which autoscales.

  • norm (matplotlib.colors.Normalize or None, optional) – Normalization for the color scale of the plot. If None, a linear scaling is used. Default is None.

  • cmap (str or matplotlib.colors.Colormap, optional) – Colormap for the dynamic spectrum plot. Can be a colormap name or an instance. Default is None, which uses the default colormap.

Returns:

A dictionary containing the dynamic spectrum data (spectrogram), frequency axis (spectrum_axis in GHz), and time axis (time_axis in modified Julian date).

Return type:

dict

Example

from suncasa.eovsa import eovsa_dspec as ds
from astropy.time import Time
from matplotlib.colors import LogNorm

# Read EOVSA Dynamic Spectrum FITS file <filename>
filename = 'EOVSA_TPall_20170713.fts'
s = ds.get_dspec(filename, doplot=True, cmap='gist_heat', norm=LogNorm(vmax=2.1e3, vmin=40))

# To access the data in the spectrogram object, use
spec = s['spectrogram']  # Array of amplitudes in SFU, of size nfreq,ntimes
fghz = s['spectrum_axis']  # Array of frequencies in GHz, of size nfreq
tim = Time(s['time_axis'], format='mjd')   # Array of UT times in astropy.time object, of size ntimes