EmissionCube

class modspectra.EmissionCube(data=None, wcs=None, meta=None, mask=None, fill_value=nan, header=None, allow_huge_operations=False, beam=None, wcs_tolerance=0.0, resolution=None, vel_resolution=None, L_range=None, B_range=None, D_range=None, alpha=None, beta=None, theta=None, bd_max=None, Hz=None, z_sigma_lim=None, dens0=None, velocity_factor=None, vel_0=None, el_constant1=None, el_constant2=None, vel_disp=None, vmin=None, vmax=None, visualize=False, redden=None, flaring=None, flaring_radial=None, min_bd=None, species=None, T_gas=None, LSR_options={}, galcen_options={}, return_all=False, LB82=False, defaults=False, create=False, memmap=False, da_chunks_xyz=None, LBD_output_in=None, LBD_output_keys_in=None, model_header=None, DK19=False, case=None, **kwargs)[source]

Bases: modspectra.EmissionCubeMixin, spectral_cube.spectral_cube.SpectralCube

Synthetic Emission cube container

Parameters:

data: ‘ndarray’, optional, if set, skips cube creation

Data cube values

wcs: ‘astropy.wcs.WCS’, optional, if set, skips cube creation

WCS info

meta: ‘dict’, optional, if set, skips cube creation

Metadata

mask: ‘ndarray’, optional, must be keyword

Masking info

fill_value: ‘number’, optional, must be keyword

Values to fill for missing data

header: ‘dict’

FITS header

allow_huge_operations: ‘bool’

from SpectralCube

beam: ‘’

from SpectralCube

wcs_tolerance: ‘number’

from SpectralCube

resolution: ‘tuple or list’

Defines LBD Resolution of grid, must be shape (3)

vel_resolution: ‘int’

Velocity axis resolution

L_range: ‘list, tuple, Quantity’

Range of longitude in degrees to create grid [low, high]

B_range: ‘list, tuple, Quantity’

Range of latitude in degrees to create grid [low, high]

D_range: ‘list,tuple,Quantity’

Range of Distances in kpc to create grid [near, far]

alpha: ‘number, Quantity’

First Tilt Angle of Disk

beta: ‘number, Quantity’

Second Tilt Angle of Disk 90 degrees - beta is the inclination

theta: ‘number, Quantity’

Third tilt Angle of Disk for allignment of major axis with line of sight

bd_max: ‘number, Quantity’

Max size of Ellipse along minor axis Default in units of kpc

Hz: ‘number, Quantity’

Vertical Scale height of Disk Default in units of kpc

z_sigma_lim: ‘number’

sigma cuttoff to stop solving Ellipse equation for for z above a specified scale height threshold

dens0: ‘number, Quantity’

Density at midplane of Elliptical Disk Default units of cm^-3

velocity_factor: ‘number’

Constant used to define velocity field in Burton & Liszt model

vel_0: ‘number’

Max velocity of Elliptical orbit Corresponds to velocity of outermost orbit on semi-minor axis Default unit of km/s

el_constant1: ‘number’

First parameter for defining ellipse

el_constant2: ‘number’

second parameter for defining ellipse

vel_disp: ‘number, Quantity’

Velocity dispersion of the gas in units of km/s (if not Quantity)

vmin: ‘number, Quantity’

Min Velocity to create in grid in units of km/s (if not Quantity)

vmax: ‘number, Quantity’

Max Velocity to create in grid in units of km/s (if not Quantity)

visualize: ‘bool’, optional, must be keyword

if using dask, returns dask visualization map

redden: ‘bool’, optional, must be keyword

if True, apply extinction corrections to emission using 3D dustmaps of Marshall et al. (2006) implemented via the dustmaps and extinction python packages

flaring: ‘bool, number’, optional, must be keyword

if False, disk has a constant scale height if a number, then sets the flaring parameter, F_z, as described in Krishnarao, Benjamin, Haffner (2019)

flaring_radial: ‘bool’, optional, must be keyword

if flaring is present then

if False (default), flaring of scale height is a function of bd, the semi minor axis if True, flaring of scale height is a function of r, the cyclindrical radius coordinate in the TiltedDisk Frame

min_bd: ‘number’, optional, must be keyword

sets the minimum value of the semi minor axis to allow Used to make a ring, rather than a disk structure

species: ‘str’, optional, must be keyword of either ‘hi’ or ‘ha’

Specifies whether emission cube will be neutral (HI 21-cm) gas or ionized (H-Alpha) gas emission Defaults to HI netural gas

T_gas: ‘number, Quantity’, optional, must be keyword

Temperature of neutral HI 21-cm emitting gas in Kelvin Defaults to 120 K

LSR_options: ‘dictionary’, optional, must be keyword

Dictionary of **kwargs to pass into :class:’~astropy.coordinates.GalacticLSR’

galcen_options: ‘dictionary’, optional, must be keyword

set galcen_options to be passed to coordinate frames

return_all: ‘bool’, optional, must be keyword

if True, will return all output components used for diagnosing issues most information can be determined / converted from initial 3 output elements only other useful bit is bd_grid - may incorporate into default output in future

LB82: ‘bool’, optional, must be keyword

if True, will create a default cube with the exact parameters of Liszt & Burton (1982) if any parameters are already set, they will be used instead

defaults: ‘bool’

if True, will use detaulf resolution and other information to create object

create: ‘bool’

if True, will create cube using provided parameters *Important* must be True to create a cube, otherwise will assume it is

loading/initiating cube from provided data

memmap: ‘bool’

if true, will create cube using memory mapping via dask Note: Currently does not work properly with species = ‘ha’

da_chunks_xyz: ‘number’, optional, must be keyword

if memmap, this sets the default chunksize to be used for dask arrays

LBD_output_in: ‘Dictionary’, optional, must be keyword

provide LBD output information to save in EmissionCube class only used if EmissionCube is from a model created by this package

LBD_output_keys_in: ‘list, str’, optional, must be keyword

provide keys tot he entries of LBD_output_in only used if EmissionCube is from a model created by this package

model_header: ‘fits.header’

Provide header to gather model parameters and information only used if EmissionCube is from a model created by this package

DK19: ‘bool’

if true, will will create default H-Alpha cube with parameters of (Krishnarao et al. 2019) if any parameters are already set, they will be used instead

Returns:

SpectralCube BaseClass with EmissionCube container Class

Methods Summary

create_DK19() Quick Create a DK19 H-Alpha emisison cube as described in Krishnarao, Benjamin, Haffner (2019)
create_DK19_spectrum(radius[, l_resolution, …]) Quick Create a DK19 H-Alpha emisison spectrum for a given SkyCoord direction and beam radius
create_LB82() Quick Create a DK19 H-Alpha emisison cube as described in Krishnarao, Benjamin, Haffner (2019)
read(file[, model]) Read a spectral cube from a file.
write(filename[, overwrite, format, model]) Write the spectral cube to a file.

Methods Documentation

create_DK19()[source]

Quick Create a DK19 H-Alpha emisison cube as described in Krishnarao, Benjamin, Haffner (2019)

Parameters:**kwargs: passed to EmissionCube.__init
create_DK19_spectrum(radius, l_resolution=10, b_resolution=10, distance_resolution=200, **kwargs)[source]

Quick Create a DK19 H-Alpha emisison spectrum for a given SkyCoord direction and beam radius

Parameters:

coordinate: ‘`astropy.coordinates.SkyCoord’

central coordinate to compute spectrum

radius: ‘Quantity or number’

Beam radius to compute spectrum over assumes u.deg if number

l_resolution: ‘number’, optional, must be keyword

resolution across longitude dimension

b_resolution: ‘number’, optional, must be keyword

resolution across latitude dimension

distance_resolution: ‘number’, optional, must be keyword

resolution across distance dimension

create_LB82()[source]

Quick Create a DK19 H-Alpha emisison cube as described in Krishnarao, Benjamin, Haffner (2019)

Parameters:**kwargs: passed to EmissionCube.__init
classmethod read(file, model=False)[source]

Read a spectral cube from a file.

If the file contains Stokes axes, they will automatically be dropped. If you want to read in all Stokes informtion, use read() instead.

Parameters:

filename : str

The file to read the cube from

format : str

The format of the file to read. (Currently limited to ‘fits’ and ‘casa_image’)

hdu : int or str

For FITS files, the HDU to read in (can be the ID or name of an HDU).

kwargs : dict

If the format is ‘fits’, the kwargs are passed to open().

write(filename, overwrite=False, format=None, model=False)[source]

Write the spectral cube to a file.

Parameters:

filename : str

The path to write the file to

format : str

The format of the file to write. (Currently limited to ‘fits’)

overwrite : bool

If True, overwrite filename if it exists