EISFitResult

class eispac.core.EISFitResult(wave=None, template=None, parinfo=None, func_name='multigaussian', data_units='unknown', radcal='unknown', empty=False)[source]

Bases: object

Object containing the results from fitting one or more EIS window spectra

Parameters:
  • wave (array_like) – Wavelength values of the data being fit. Used only to determine the correct dimensions for the output arrays.

  • template (dict) – Fit template parameters and metadata contained in the “template” attribute of an EISFitTemplate object.

  • parinfo (dict) – Fit parameter initial values and constraints in the format expectd by mpfit. Normally found in the ‘parinfo’ attribute of an EISFitTemplate object

  • func_name (str, optional) – String name of function that will be fit to the data. Must be one of the functions defined in the fitting_functions submodule. Default is “multigaussian”.

template

Full copy of the input template dictionary

Type:

dict

parinfo

Full copy of the input parinfo list

Type:

list of dicts

funcinfo

Function component information generated from the template dict

Type:

dict

n_pxls

Number of pixels along the y-axis

Type:

int

n_steps

Number of raster steps or sit-and-stare exposures in the observation

Type:

int

n_wave

Number of wavelength values in the window

Type:

int

n_gauss

Number of Guassian functions in the fit

Type:

int

n_poly

Number of terms in the polynomial background

Type:

int

func_name

Name of the function fit to the data

Type:

str

fit_func

Copy of the actual Python function named by ‘fit_func’

Type:

function

fit

Dictionary of output fit parameters

Type:

dict

Attributes Summary

radcal

Current radiometric calibration curve

Methods Summary

apply_radcal([input_radcal])

Apply a radiometric calibration curve (user-inputted or preflight)

calculate_velocity([component, rest_wave, ...])

Calculate the Doppler velocity for a selected gaussian component

get_aspect_ratio()

Return the data aspect ratio (y-scale/x-scale) as a float

get_fit_profile([component, coords, ...])

Calculate the fit intensity profile (total or component) at a location.

get_map([component, measurement])

Return an EISMap of either intensity, velocity, or width

get_params([component, param_name, coords, ...])

Extract parameters values by component number, name, or pixel coords

plot_fov(end_time[, color, lw, ls])

Return a patch of the raster FOV for plotting on an image.

remove_radcal()

Remove the applied radiometric calibration and convert data to counts

rot_fov(end_time)

Return pointing information for the raster rotated to the input time.

shift2wave(array[, wave])

Shift an array from this fit to the desired wavelength

Attributes Documentation

radcal

Current radiometric calibration curve

Methods Documentation

apply_radcal(input_radcal=None)[source]

Apply a radiometric calibration curve (user-inputted or preflight)

Parameters:

input_radcal (array_like, optional) – User-inputted radiometric calibration curve. If set to None, will use the preflight radcal curve from the .meta dict. Default is None

Returns:

output_fit – A new EISFitResult class instance containing the calibrated params

Return type:

EISFitResult class instance

calculate_velocity(component=0, rest_wave=None, update_results=True, **kwargs)[source]

Calculate the Doppler velocity for a selected gaussian component

Parameters:
  • component (int, optional) – Integer number of the fit gaussian. Default is 0 (first line in fit)

  • rest_wave (float or str, optional) – Rest wavelength value in units of [Angstrom]. If given a string, will check to see if it is a spectral line ID and, if it is, will try to extract the rest wavelength. If set to None, will use the initial value specified in the .parinfo dictionary. Default is None.

  • update_results (bool, optional) – If set to True, will update the .fit[‘vel’] and .fit[‘err_vel’] arrays in this. Default is True.

  • **kwargs (dict or keywords, optional) – Optional keywords to pass to eispac.instr.calc_velocity()

Returns:

  • velocity (numpy.ndarray) – Array of calculated Doppler velocities

  • rel_error (numpy.ndarray) – Array of relative error values for the velocities

get_aspect_ratio()[source]

Return the data aspect ratio (y-scale/x-scale) as a float

get_fit_profile(component=None, coords=None, num_wavelengths=None, wave_range='auto', use_mask=True)[source]

Calculate the fit intensity profile (total or component) at a location.

Parameters:
  • component (int or list, optional) – Integer number (or list of ints) of the functional component(s). If set to None, will return the total combined fit profile. Default is None.

  • coords (list or tuple, optional) – Array (Y, X) coordinates of the requested datapoint. If set to None, will instead return the profile at all locations. Default is None

  • num_wavelengths (int, optional) – Number of wavelength values to compute the fit intensity at. These values will be equally spaced and span the entire fit window. If set to None, will use the observed wavelength values. Default is None.

  • wave_range (list or array, optional) – List or array with two elements giving the wavelength range to use for calculating the intensity profile.

  • use_mask (bool, optional) – If set to True and num_wavelengths == None (i.e. intensity is computed at observed wavelength values), then apply the mask that was used for the fitting process to filter out bad data or observations outside of fit template range.

Returns:

get_map(component=0, measurement='intensity', **kwargs)[source]

Return an EISMap of either intensity, velocity, or width

Parameters:
  • component (int, optional) – Integer number of the fit gaussian. Default is 0 (first line in fit)

  • measurement (string, optional) – Measured parameter to create the map for. Choose from “intensity”, “velocity”, or “width”. Default is “intensity”

  • **kwargs (dict or keywords, optional) – Optional keywords to pass to EISMap

Returns:

output_map – EISMap of the requested measurement.

Return type:

EISMap class instance

get_params(component=None, param_name=None, coords=None, casefold=False)[source]

Extract parameters values by component number, name, or pixel coords

Parameters:
  • component (int or list, optional) – Integer number (or list of ints) of the functional component(s). If set to None, will return all parameters that match “param_name”. Default is None.

  • param_name (str, optional) – String name of the requested parameter. If set to None, will not filter based on paramater name. Default is None

  • coords (list or tuple, optional) – Array (Y, X) coordinates of the requested datapoint. If set to None, will instead return the parameters at all locations. Default is None

  • casefold (bool, optional) – If set to True, will ignore case when extracting parameters by name. Default is False.

Returns:

plot_fov(end_time, color='red', lw=1, ls='-')[source]

Return a patch of the raster FOV for plotting on an image.

Parameters:
  • end_time (any time format that can be parsed by parse_time) – Time at which the rotated EIS pointing is desired. Usually should be after the first observation in the EIS raster.

  • color (str, optional) – Color of the output rectangle. Default is “red”.

  • lw (int, optional) – Linewidth of the output rectangle. Default is 1.

  • ls (str, optional) – Line style of the output rectangle. Default is “-” (solid line).

Returns:

rect – Matplotlib Rectangle patch. Useful for plotting the EIS FOV on a context image taken with a different instrument.

Return type:

Rectangle

remove_radcal()[source]

Remove the applied radiometric calibration and convert data to counts

Returns:

output_cube – A new EISFitResult class instance containing the photon count data

Return type:

EISFitResult class instance

rot_fov(end_time)[source]

Return pointing information for the raster rotated to the input time.

Parameters:

end_time (any time format that can be parsed by parse_time) – Time at which the rotated EIS pointing is desired. Usually should be after the first observation in the EIS raster.

Returns:

fov – Dictionary with the estimated EIS raster center coords and FOV. This is calculated using the SunPy function solar_rotate_coordinate

Return type:

dict

shift2wave(array, wave=195.119)[source]

Shift an array from this fit to the desired wavelength