AbsorberPlotter

class salsa.AbsorberPlotter(ds_filename, ray_filename, ion_name='H I', ftype='gas', cut_region_filters=None, slice_field=None, absorber_fields=[], north_vector=[0, 0, 1], center_gal=None, wavelength_center=None, wavelength_width=30, velocity_width=3000, wavelength_res=0.1, velocity_res=10, use_spectacle=False, plot_spectacle=False, spectacle_defaults=None, spectacle_res=None, plot_spice=False, absorber_min=None, frac=0.8, num_dense_min=None, num_dense_max=None, markers=True, mark_plot_args=None, figure=None)

Bases: salsa.absorber_extractor.AbsorberExtractor

Create’s plot to easily see where absorbers are found along the light ray both directly and through resulting spectra. Uses absorber extractor as base class.

Parameters
  • ds_filename (str or YT dataset) – Either Path/name of the dataset to be loaded or the dataset itself

  • ray_filename (str or Trident ray) – Path/name of the hdf5 ray file to be loaded or the ray already loaded

  • ion_name (string, optional) – Name of the ion to extract absorbers of and plot Default: “H I”

  • cut_region_filters (list of str, optional) – a list of filters defined by the way you use Cut Regions in YT

  • slice_field (string, optional) – Field to plot in slice plot. defaults to ion_name’s number density

  • absorber_fields (list of strings, optional) – Additional ions to include in plots/Spectra, enter as list.

  • north_vector (array type, optional) – vector used to fix the orientation of the slice plot defaults to z-axis

  • center_gal (array type, optional) – center of galaxy in code_length. if None, then defaults to domain_center

  • wavelength_center (float, optional) – Wavelength to center spectrum plot on. defaults to the stringest known spectral line of ion_name. in units of Angstrom

  • wavelength_width (float, optional) – sets the wavelength range of the spectrum plot. defaults to 300 Angstroms

  • velocity_width (float, optional) – sets the velocity range in spectrum plot in units of km/s

  • wavelegnth_res (float, optional) – width of wavelength bins in spectrum plot. default 0.1 Angstrom

  • velocity_res (float, optional) – width of velocity bins in spectrum plot. default 10 km/s

  • use_spectacle (bool, optional) – Choose whether to use spectacle fit to compute col dense

  • plot_spectacle (bool, optional) – chooses whether individual absorption lines found by spectacle are plotted

  • spectacle_res (double, optional) – Set minimum resolution that spectacle will attempt to fit lines to. If None, default to velocity_res

  • plot_spice (bool, optional) – Sets whether the intervals found by the SPICE method are plotted on the number density plot

  • absorber_min (float, optional) – Minimum Log Column Density that will be used to define an absorber. If None, defaults to either default for specific ion or 13 Default: None

  • frac (float, optional) – Parameter defining what fraction of the number density is being accounted for in each iteration of the SPICE method. Must be a number between 0 and 1. Default: 0.8

  • num_dense_min (float, optional) – Sets the lower limit for the number density plot. If None, defaults to 0.01 times the median number density

  • num_dense_max (float, optional) – Sets the upper limit for the number density plot. If None, defaults to 100 times the median number density

  • markers (bool, optional) – whether to include markers on light ray and number density plot

  • mark_plot_args (dict, optional) –

    set the property of markers if they are to be plotted. optional settings are:

    marker_spacing: determines how far apart markers are in kpc.

    marker_shape: shape of marker see matplotlib for notation

    marker_cmap: colormap used to differentiate markers any other property that can be passer to matplotlib scatter

  • figure (matplotlib figure, optional) – where the multi_plot will be plotted. creates one if none is specified.

Notes

ion names should be in following notaion: neutral Hydrogen–>”H I”, 5-times ionized Oxygen –> “O VI”

Methods Summary

add_annotations([plot])

Adds ray and marker annotations to slice plot

close()

close all opened files

create_multi_plot([outfname, markers, cmap])

combines the slice plot, number density plot, and spectrum plot into one image.

create_slice([cmap, height, width])

Create a slice in the Dataset along the path of the ray.

plot_lambda_space([ax])

Use trident to plot the absorption spectrum of the ray.

plot_num_density(ax_num_dense[, ax_prop2, …])

Plots the number density at different lengths along the ray

plot_vel_space([ax, annotate_column_density])

Use trident to plot the absorption spectrum of the ray in velocity space.

zoom(factor)

Zoom into the slice by specified factor

Methods Documentation

add_annotations(plot=True)

Adds ray and marker annotations to slice plot

Parameters

plot (bool) – Whether to annotate ray/markers to the slice plot or to just calculate the marker positions for placing on los_velocity plot

close()

close all opened files

create_multi_plot(outfname=None, markers=True, cmap='magma')

combines the slice plot, number density plot, and spectrum plot into one image.

Parameters
  • outfname (str , optional) – the file name/path in which to save the file defaults to being unsaved. Default: None

  • markers (bool, optional) – adds markers to slice plot and number density to aid analysis between those plots. Default: True

  • cmap (Colormap, optional) – the color map to use for the slice plot. Default: magma

Returns

  • fig (matplotlib figure:) – figure multi_plot is drawn on

  • axes (matplotlib axes) – axes the three lower plots are drawn on

create_slice(cmap='magma', height=None, width=None)

Create a slice in the Dataset along the path of the ray. Choose to keep the Z direction maintained.

Parameters

cmap (str) – the colormap to use for the slice. Default: ‘magma’

Returns

slice – Slice with ray annotated

Return type

yt SlicePlot

plot_lambda_space(ax=None)

Use trident to plot the absorption spectrum of the ray. Plot in wavelegnth (lambda) space. Not formatted to be used in spectacle fitting

Parameters

ax (matplotlib axis) – axis in which to draw the spectra plot

Returns

  • wavelength (YT array) – Array of wavelength values of the generated spectra (in km/s)

  • flux (YT array) – Array of the normalized flux values of the generated spectra

plot_num_density(ax_num_dense, ax_prop2=None, prop2_name='velocity_los', prop2_units=None, plot_kwargs={})

Plots the number density at different lengths along the ray

Parameters
  • ax_num_dense (matplotlib axis) – axis in which to draw the number density plot

  • ax_prop2 (matplotlib axis, optional) – axis in which to draw the second field. if None, no plot is made Default: None

  • prop2_name (str,optional) – Field to plot in second plot. Default:’velocity_los’

  • prop2_units (str, optional) – The units to use in the second field. Defaults: None

  • plot_kwargs (dict, optional) – A Dictionary of plot kwargs to be passed to the pyplot.plot function. Default: {}

plot_vel_space(ax=None, annotate_column_density=True)

Use trident to plot the absorption spectrum of the ray in velocity space. Compute column densities with spectacle fits.

Parameters
  • ax (matplotlib axis object, optional) – an axis in which to draw the velocity plot. If None, no plot is not drawn. Default: None

  • annotate_column_density (bool, optional) – if True, add a textbox reporting the calculated col densities by each method to the plot. Default: True

Returns

  • velocity (YT array) – Array of velocity values of the generated spectra (in km/s)

  • flux (YT array) – Array of the normalized flux values of the generated spectra

zoom(factor)

Zoom into the slice by specified factor

Parameters

factor (float) – factor by which to zoom in using yt’s zoom mehtod