EmissionCubeMixin

class modspectra.EmissionCubeMixin[source]

Bases: object

Methods Summary

ad(bd) Calculates corresponding ellipse semi-major axis value given a semi-minor axis b
extract_beam([coordinate, longitude, …]) Returns 2 ‘np.array’ of the spectrum averaged across a beam closest to the specified location as [velocity], [data]
extract_spectrum(longitude, latitude) Returns 2 ‘np.array’ of the spectrum closest to the specified location as [velocity], [data]
lv_contour(latitude[, swap_axes, fig, …]) Plot contours of a Longitude-Velocity slice of the data at the specified latitude
lv_plot(latitude[, swap_axes, fig, …]) Plot a Longitude-Velocity slice of the data at the specified latitude
xy_ellipse_patch() Returns a ‘~matplotlib.patches.Ellipse’ artist object of the Elliptical Disk in the xy plane

Methods Documentation

ad(bd)[source]

Calculates corresponding ellipse semi-major axis value given a semi-minor axis b

extract_beam(coordinate=None, longitude=None, latitude=None, radius=<Quantity 0.5 deg>, reduce_cube=False)[source]

Returns 2 ‘np.array’ of the spectrum averaged across a beam closest to the specified location as [velocity], [data]

Parameters:

coordinate: ‘’astropy.coord.SkyCoord’, must be keyword

Specifies coordinate to center the beam

longitude: ‘Quantity or number’, optional, must be keyword

Longitude to extract nearest spectrum from (in Galactic Coordinates) if not a Quantity, default is u.deg Ignored if coordinate is provided

latitude: ‘Quantity or number’, optional, must be keyword

Latitude to extract nearest spectrum from (in Galactic Coordinates) if not a Quantity, default is u.deg Ignored if coordinate is provided

radius: ‘Quantity or number’, optional, must be keyword

radius of beam, default of 0.5 degrees (WHAM Beam Size) if not a Quantity, default is u.deg

reduce_cube: ‘bool’, optional, must be keyword

if True, will reduce overall cube size before extracting beam Useful because subcube_from_ds9_region loads full cube into memory

Returns:

spectrum: ‘spectral_cube spectrum’

extract_spectrum(longitude, latitude)[source]

Returns 2 ‘np.array’ of the spectrum closest to the specified location as [velocity], [data]

Parameters:

longitude: ‘Quantity or number’

Longitude to extract nearest spectrum from (in Galactic Coordinates) if not a Quantity, default is u.deg

latitude: ‘Quantity or number’

Latitude to extract nearest spectrum from (in Galactic Coordinates) if not a Quantity, default is u.deg

lv_contour(latitude, swap_axes=False, fig=None, frame_class=<class 'astropy.visualization.wcsaxes.frame.RectangularFrame'>, aspect='auto', cmap='Reds', levels=(0.1, 0.4, 1.8, 3.8, 7.0, 11.0, 16.0, 24.0), invert_xaxis=False, invert_yaxis=False, spectral_unit=Unit("km / s"), **kwargs)[source]

Plot contours of a Longitude-Velocity slice of the data at the specified latitude

Parameters:

latitude: ‘Quantity or int’

Latitude to extract slice from if ‘int’ then index value to slice at

swap_axes: ‘bool’, optional, must be keyword

if True, swaps x and y axs Default is Longitude on y-axis and Velocity on x-axis

fig: ‘~matplotlib.pyplot.figure’, optional, must be keyword

if provided, axis will be added to this figure instance

frame_class: ‘astropy.visualization.wcsaxes.frame’, optional, must be keyword

if provided, specifies astropy frame to use for Plot, such as EllipticalFrame

aspect: ‘str’, optional, must be keyword

aspect keyword to pass into ‘matplotlib.plt.contour’

orientation: ‘str’, optional, must be keyword

keyword to pass into ‘matplotlib.plt.colorbar’

vmin: ‘number’, optional, must be keyword

min value to show - keyword to pass into ‘matplotlib.plt.imshow’

vmax: ‘number’, optional, must be keyword

max value to show - keyword to pass into ‘matplotlib.plt.imshow’ cmap keyword to pass into ‘matplotlib.plt.contour’

levels: ‘list’, optional, must be keyword

contour levels to plot or number of contours to plot passed to ‘matplotlib.plt.contour’

invert_xaxis: ‘bool’, optional, must be keyword

if True, will invert xaxis

invert_yaxis: ‘bool’, optional, must be keyword

if True, will invert yaxis

spectral_unit: ‘astropy.units’, optional, must be keyword

if provided, convert spectral axis to these units

lv_plot(latitude, swap_axes=False, fig=None, frame_class=<class 'astropy.visualization.wcsaxes.frame.RectangularFrame'>, orientation='vertical', vmin=0.5, vmax=500.0, norm=<matplotlib.colors.LogNorm object>, cmap='YlGnBu_r', invert_xaxis=False, invert_yaxis=False, spectral_unit=Unit("km / s"), over_contour=False, levels=5, cmap_contour='Reds', subpad=0.8, contour_options={}, **kwargs)[source]

Plot a Longitude-Velocity slice of the data at the specified latitude

Parameters:

latitude: ‘Quantity or int’

Latitude to extract slice from if ‘int’ then index value to slice at

swap_axes: ‘bool’, optional, must be keyword

if True, swaps x and y axes Default is Longitude on y-axis and Velocity on x-axis

fig: ‘~matplotlib.pyplot.figure’, optional, must be keyword

if provided, axis will be added to this figure instance

frame_class: ‘astropy.visualization.wcsaxes.frame’, optional, must be keyword

if provided, specifies astropy frame to use for Plot, such as EllipticalFrame

aspect: ‘str or int’, optional, must be keyword

aspect keyword used for ‘matplotlib.pyplot.imshow’

orientation: ‘str’, optional, must be keyword

orientation of colorbar, keyword passed to ‘matplotlib.pyplot.colorbar’

vmin: ‘number’, optional, must be keyword

min intensity to plot, keyword passed to ‘matplotlib.pyplot.imshow’

vmax: ‘number’, optional, must be keyword

max intensity to plot, keyword passed to ‘matplotlib.pyplot.imshow’

norm: ‘matplotlib.colors.’, optional, must be keyword

norm to pass into ‘matplotlib.plt.imshow’ for color scaling

cmap: ‘str’, optional, must be keyword

cmap keyword to pass into ‘matplotlib.plg.imshow’

invert_xaxis: ‘bool’, optional, must be keyword

if True, will invert xaxis

invert_yaxis: ‘bool’, optional, must be keyword

if True, will invert yaxis

spectral_unit: ‘astropy.units’, optional, must be keyword

if provided, convert spectral axis to these units

over_contour: ‘EmissionCube’, or ‘SpectralCube’, or bool, optional, must be keyword

if provided, will overplot contours of this cube on image if True, will overplot contours from self

levels: ‘list’, optional, must be keyword

contour levels to plot or number of contours to plot passed to ‘matplotlib.plt.contour’

cmap: ‘str’, optional, must be keyword

cmap keyword to pass into ‘matplotlib.plt.contour’

contour_options: ‘dict’, optional, must be keyword

additional keywords to pass into ‘matplotlib.plt.contour’

subpad: ‘number’, optional, must be keyword

passed to fig.subplot_adjust useful for placing colorbar better

xy_ellipse_patch()[source]

Returns a ‘~matplotlib.patches.Ellipse’ artist object of the Elliptical Disk in the xy plane

Warning: Currently does not account for any alpha or beta tilt values…