astrojoni_tools package#

Subpackages#

Submodules#

astrojoni_tools.functions module#

astrojoni_tools.functions.add_up_channels(fitsfile: Path, velocity_start: float, velocity_end: float, path_to_output: str | None = '.', save_file: bool | None = True, suffix: str | None = '') ndarray[source]#

Add up slices of a p-p-v FITS cube along the velocity axis.

Parameters:
  • fitsfile (Path) – Path to FITS file.

  • velocity_start (float) – Start velocity from which to sum up channels.

  • velocity_end (float) – End velocity up to which data summed up.

  • path_to_output (str, optional) – Path to output where moment 1 map will be saved. By default, the subcube will be saved in the working directory.

  • save_file (bool, optional) – Whether moment 1 map should be saved as a file. Default is True.

  • suffix (str, optional) – Suffix of moment 1 filename.

Returns:

map_sum – Map of summed up channels.

Return type:

numpy.ndarray

astrojoni_tools.functions.calculateLength(filamentDatafile, distance, pix_size)[source]#
astrojoni_tools.functions.calculateLength_from_array(filamentData, distance, pix_size)[source]#
astrojoni_tools.functions.calculateLength_worldcoords(filamentDatafile, distance)[source]#
astrojoni_tools.functions.calculate_average_value_of_map(fitsfile: Path, pixel_array: List) Tuple[float, List][source]#

Calculate an average value given a 2-D FITS map and pixel coordinates. If NaN values are present at specific coordinates, these coordinates will be ignored.

Parameters:
  • fitsfile (path-like object or file-like object) – Path to FITS file to get average value from.

  • pixel_array (list) – List of tuples containing pixel coordinates [(y0,x0),(y1,x1),…] over which to average.

Returns:

  • value_average (float) – Averaged value.

  • pixel_list_without_nan_values (List) – List of tuples containing pixel coordinates [(y0,x0),(y1,x1),…] at which data contain finite values.

astrojoni_tools.functions.calculate_pixelArray_along_filament(filename, filamentdata, halfwidth_pc, distance_of_source)[source]#
astrojoni_tools.functions.calculate_spectrum(fitsfile: Path, pixel_array: List) Tuple[ndarray, List][source]#

Calculate an average spectrum given a p-p-v FITS cube and pixel coordinates. If NaN values are present at specific coordinates, these coordinates will be ignored.

Parameters:
  • fitsfile (Path) – Path to FITS file to get average spectrum from.

  • pixel_array (List) – List of tuples containing pixel coordinates [(y0,x0),(y1,x1),…] over which to average.

Returns:

  • spectrum_average (numpy.ndarray) – Averaged spectrum.

  • pixel_list_without_nan_values (List) – List of tuples containing pixel coordinates [(y0,x0),(y1,x1),…] at which data contain finite values.

astrojoni_tools.functions.channel_averaged(fitsfile: Path, velocity_start: float, velocity_end: float, path_to_output: str | None = '.', save_file: bool | None = True, suffix: str | None = '') ndarray[source]#

Average slices of a p-p-v FITS cube along the velocity axis.

Parameters:
  • fitsfile (path-like object or file-like object) – Path to FITS file.

  • velocity_start (float) – Start velocity from which to sum up channels.

  • velocity_end (float) – End velocity up to which data summed up.

  • path_to_output (str, optional) – Path to output where moment 1 map will be saved. By default, the subcube will be saved in the working directory.

  • save_file (bool, optional) – Whether moment 1 map should be saved as a file. Default is True.

  • suffix (str, optional) – Suffix of moment 1 filename.

Returns:

average_map – Map of averaged channels.

Return type:

numpy.ndarray

astrojoni_tools.functions.convert_jtok_huge_dataset(filename, suffix='')[source]#
astrojoni_tools.functions.convert_jybeam_to_kelvin(filename, path_to_output='.', suffix='')[source]#
astrojoni_tools.functions.estimate_cont_noise(data, inner_pct, outer_pct)[source]#
astrojoni_tools.functions.find_common_beam(filenames)[source]#
astrojoni_tools.functions.find_nearest(array: ndarray, value: float) int[source]#

Find the index of an element in an array nearest to a given value.

Parameters:
  • array (numpy.ndarray) – Input array to index.

  • value (float) – Value of the element to find the closest index for.

Returns:

idx – Index of the element with value closest to value.

Return type:

int

astrojoni_tools.functions.get_off_diagonal(name, offset=0)[source]#

Extract both a list of pixel coordinate tuples [(y0,x0),(y1,x1),…,(yn,xn)] and a tuple ((y0,y1,…,yn),(x0,x1,…,xn)) corresponding to off diagonal elements of a 2D numpy.ndarray

Parameters:
  • name (str) – Name of file.

  • offset (int) – y-axis offset from diagonal in units of pixels.

Returns:

  • pixel_coords (list) – List of pixel coordinates [(y0,x0),(y1,x1),…,(yn,xn)].

  • indices_np (tuple) – Tuple of pixel indices ((y0,y1,…,yn),(x0,x1,…,xn)) to index a numpy.ndarray.

astrojoni_tools.functions.get_slices(size, n)[source]#

Calculate slices in individual direction.

Parameters:
  • size (int) – Size of chunk.

  • n (int) – Number of chunks.

Returns:

slices – List of slices [slice(start,stop,step),…]

Return type:

list

astrojoni_tools.functions.getting_ready(string: str)[source]#
astrojoni_tools.functions.jansky_to_kelvin(frequency, theta_1, theta_2)[source]#
astrojoni_tools.functions.latitude_axes(name: Path) ndarray[source]#

Get latitude axis from FITS file.

Parameters:

name (Path) – Path to FITS file to get latitude axis from.

Returns:

velocity – Array of latitude axis.

Return type:

numpy.ndarray

astrojoni_tools.functions.longitude_axes(name: Path) ndarray[source]#

Get longitude axis from FITS file.

Parameters:

name (Path) – Path to FITS file to get longitude axis from.

Returns:

velocity – Array of longitude axis.

Return type:

numpy.ndarray

astrojoni_tools.functions.make_lv(filename, mode='avg', weights=None, noise=None, path_to_output='.', suffix='')[source]#

Create a longitude-velocity map from a datacube.

Parameters:
  • filename (str) – Path to file to create a longitude-velocity map from.

  • mode (str) –  Mode to compute the value of collapsed latitude axis. ‘avg’ is the arithmetic mean along the latitude axis. ‘max’ gives the maximum value along the latitude axis. ‘sum’ gives the sum along the latitude axis. ‘weighted’ gives a weighted arithmetic mean along the latitude axis. ‘freq’ (experimental) gives the most frequent value along the latitude axis. Useful for integer masks.

  • weights (str, optional) – Path to file containing weights. Needs to be of same shape as data of filename.

  • noise (float) – Noise to use as a threshold. Every pixel value below the noise will be masked.

  • path_to_output (str, optional) – Path to output where subcube will be saved. By default, the subcube will be saved in the working directory.

  • suffix (str, optional) – Suffix that is appended to output filename.

astrojoni_tools.functions.make_subcube(filename, cubedata=None, longitudes=None, latitudes=None, velo_range=None, path_to_output='.', suffix='', return_data=False, save_file=True, verbose=True)[source]#

Create a subcube from an existing SpectralCube (or 2D Projection) given some coordinate ranges.

Parameters:
  • filename (str) – Path to file to create a subcube from.

  • cubedata (None or SpectralCube or Projection, optional) – SpectralCube of data if data is already read in. This option avoids reading data into memory again.

  • longitudes (list) – List of coordinate range of first world coordinate axis.

  • latitudes (list) – List of coordinate range of second world coordinate axis.

  • velo_range (list) – List of velocity range of spectral coordinate axis.

  • path_to_output (str, optional) – Path to output where subcube will be saved. By default, the subcube will be saved in the working directory.

  • suffix (str, optional) – Suffix that is appended to output filename.

  • return_data (bool, optional) – Option to return data of the subcube. Default is False.

  • save_file (bool, optional) – Whether subcube should be saved as a file. Default is True.

  • verbose (bool, optional) – Option to print subcube info and save messages. Default is True.

astrojoni_tools.functions.make_subcube_from_region(filename, cubedata=None, regionfile=None, path_to_output='.', suffix='', return_data=False, save_file=True, verbose=True)[source]#

Create a subcube using DS9/CRTF regions. The minimal enclosing subcube will be extracted with a two-dimensional mask corresponding to the DS9/CRTF region.

Parameters:
  • filename (str) – Path to file to create a subcube from.

  • cubedata (None or SpectralCube or Projection, optional) – SpectralCube of data if data is already read in. This option avoids reading data into memory again.

  • regionfile (str) – Region file (.reg, .crtf) containing region.

  • path_to_output (str, optional) – Path to output where subcube will be saved. By default, the subcube will be saved in the working directory.

  • suffix (str, optional) – Suffix that is appended to output filename.

  • return_data (bool, optional) – Option to return data of the subcube. Default is False.

  • save_file (bool, optional) – Whether subcube should be saved as a file. Default is True.

  • verbose (bool, optional) – Option to print subcube info and save messages. Default is True.

astrojoni_tools.functions.md_header_2d(hdr)[source]#

Get 2D header from FITS file.

Parameters:

hdr (path-like object or file-like object or ~astropy.io.fits.Header) – Path to FITS file to get header from or Header object itself.

Returns:

header_2d – Header object without third axis.

Return type:

~astropy.io.fits.Header

astrojoni_tools.functions.moment_0(filename: Path, velocity_start: float | None = None, velocity_end: float | None = None, noise: float | None = None, path_to_output: str | None = '.', save_file: bool | None = True, output_noise: bool | None = True, suffix: str | None = '')[source]#

Calculate the zeroth moment of a p-p-v FITS cube.

Parameters:
  • filename (Path) – Path to FITS file.

  • velocity_start (float) – Start velocity from which to integrate.

  • velocity_end (float) – End velocity up to which data are integrated.

  • noise (float, optional) – Noise value of p-p-v data. If noise is given, noise of the zeroth moment will be calculated.

  • path_to_output (str, optional) – Path to output where moment 0 map will be saved. By default, the subcube will be saved in the working directory.

  • save_file (bool) – Whether moment 0 map should be saved as a file. Default is True.

  • output_noise (bool) – Whether moment 0 noise should be stored in a .txt file. Default is True.

  • suffix (str) – Suffix of moment 0 filename.

Returns:

moment_0_map – Zeroth moment map.

Return type:

numpy.ndarray

astrojoni_tools.functions.moment_1(filename: Path, velocity_start: float, velocity_end: float, path_to_output: str | None = '.', save_file: bool | None = True, suffix: str | None = '')[source]#

Calculate the intensity-weighted mean velocity (first moment) of a p-p-v FITS cube.

Parameters:
  • filename (Path) – Path to FITS file.

  • velocity_start (float) – Start velocity from which to integrate.

  • velocity_end (float) – End velocity up to which data are integrated.

  • path_to_output (str, optional) – Path to output where moment 1 map will be saved. By default, the subcube will be saved in the working directory.

  • save_file (bool) – Whether moment 1 map should be saved as a file. Default is True.

  • suffix (str, optional) – Suffix of moment 1 filename.

Returns:

moment_1_map – First moment map.

Return type:

numpy.ndarray

astrojoni_tools.functions.pixel_annulus_calculation(fitsfile, longitude, latitude, r_in, r_out)[source]#
astrojoni_tools.functions.pixel_box_calculation(fitsfile: Path, longitude: float, latitude: float, a: float, b: float)[source]#

Given central coordinates, size of box, and fitsfile, return array with the corresponding pixels.

Parameters:
  • longitude (float) – [deg]

  • latitude (float) – [deg]

  • a (total size of longitude,latitude box in arcsec)

  • b (total size of longitude,latitude box in arcsec)

Returns:

pixel_array – List of pixel coordinates within the box [(x1,y1), (x2,y2), …]

Return type:

list

astrojoni_tools.functions.pixel_circle_calculation(fitsfile: Path, xcoord: ndarray | float, ycoord: ndarray | float, r: float) Tuple[List, Tuple][source]#

Extract both a list of pixels [(y0,x0),(y1,x1),…] and a tuple ((y0,y1,…),(x0,x1,…)) corresponding to the circle region with central coordinates xcoord, ycoord, and radius r.

Parameters:
  • fitsfile (Path) – Path to FITS file.

  • xcoord (numpy.ndarray | float) – x-coordinate of central pixel in units given in the header.

  • ycoord (numpy.ndarray | float) – y-coordinate of central pixel in units given in the header.

  • r (float) – Radius of region in units of arcseconds.

Returns:

  • pixel_coords (List) – List of pixel coordinates [(y0,x0),(y1,x1),…].

  • indices_np (Tuple) – Tuple of pixel indices ((y0,y1,…),(x0,x1,…)) to index a numpy.ndarray.

astrojoni_tools.functions.pixel_circle_calculation_px(fitsfile: Path, x: ndarray | float, y: ndarray | float, r: float) Tuple[List, Tuple][source]#

Extract both a list of pixels [(y0,x0),(y1,x1),…] and a tuple ((y0,y1,…),(x0,x1,…)) corresponding to the circle region with central pixels x, y, and radius r.

Parameters:
  • fitsfile (Path) – Path to FITS file.

  • x (numpy.ndarray or float) – Central x pixel.

  • y (numpy.ndarray or float) – Central y pixel.

  • r (float) – Radius of region in units of arcseconds.

Returns:

  • pixel_array (List) – List of pixel coordinates [(y0,x0),(y1,x1),…].

  • indices_np (Tuple) – Tuple of pixel indices ((y0,y1,…),(x0,x1,…)) to index a numpy.ndarray.

astrojoni_tools.functions.pixel_ellipse_annulus_calculation(center_x, center_y, x_in, x_out, y_in, y_out)[source]#

Extract both a list of pixels [(y0,x0),(y1,x1),…,(yn,xn)] and a tuple ((y0,y1,…,yn),(x0,x1,…,xn)) corresponding to the ellipse annulus region with central coordinates center_x, center_y, and inner and outer semimajor/semiminor axes x_in, x_out/ y_in, y_out (or the other way around).

Parameters:
  • center_x (int) – x-coordinate of central pixel in pixel units.

  • center_y (int) – y-coordinate of central pixel in pixel units.

  • x_in (int) – inner semimajor/minor axis of region along x-axis in pixel units.

  • x_out (int) – outer semimajor/minor axis of region along x-axis in pixel units.

  • y_in (int) – inner semimajor/minor axis of region along y-axis in pixel units.

  • y_out (int) – outer semimajor/minor axis of region along y-axis in pixel units.

Returns:

  • pixel_coords (list) – List of pixel coordinates [(y0,x0),(y1,x1),…,(yn,xn)].

  • indices_np (tuple) – Tuple of pixel indices ((y0,y1,…,yn),(x0,x1,…,xn)) to index a numpy.ndarray.

astrojoni_tools.functions.pixel_to_world(fitsfile: Path, x: float, y: float, ch: float | None = 0.0)[source]#

Convert pixel coordinates to world coordinates from a FITS file.

Parameters:
  • fitsfile (str) – Path to FITS file to get coordinates from.

  • x (float) – Pixel coordinate on the x-axis of the FITS file.

  • y (float) – Pixel coordinate on the y-axis of the FITS file.

  • ch (float, optional) – Velocity channel to convert (default is 0.).

Returns:

result – Returns the world coordinates. If the input was a single array and origin, a single array is returned, otherwise a tuple of arrays is returned.

Return type:

numpy.ndarray

astrojoni_tools.functions.rebin(a, newshape)[source]#

Rebin an array to a new shape.

astrojoni_tools.functions.reproject_cube(filename, template, axes='spatial', path_to_output='.', suffix='', allow_huge_operations=False, datatype='regular')[source]#
astrojoni_tools.functions.save_fits(filename_basis: Path, data: ndarray, header, suffix: str | None = '_new', path_to_output: str | None = '.', **kwargs)[source]#

Save FITS file with given filename + suffix at a given location.

Parameters:
  • filename_basis (Path) – Path to FITS file to use as a basis for the new filename.

  • data (numpy.ndarray) – Data to save under the new filename.

  • header (~astropy.io.fits.Header) – Header object that is associated with data. If None, a header of the appropriate type is created for the supplied data.

  • suffix (str, optional) – Suffix to append to new filename. Default is ‘_new’.

  • path_to_output (str) – Path to output where FITS will be saved.

  • **kwargs – Additional arguments are passed to astropy.io.fits.writeto().

astrojoni_tools.functions.smooth_1d(x, window_len=11, window='hanning')[source]#

smooth the data using a window with requested size. input:

x: the input signal window_len: the dimension of the smoothing window; should be an odd integer window: the type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’

flat window will produce a moving average smoothing.

output:

the smoothed signal

astrojoni_tools.functions.smooth_2(spectrum)[source]#
astrojoni_tools.functions.smooth_ave(spectrum)[source]#

spectrum has to be of shape (N, 2)

astrojoni_tools.functions.spatial_smooth(filename, beam=None, major=None, minor=None, pa=0, path_to_output='.', suffix='', allow_huge_operations=False, datatype='regular', save_file=True, **kwargs)[source]#

Smooth an image or cube channel by channel with a 2D Gaussian.

Parameters:
  • filename (str) – Path to file to smooth.

  • beam (~radio_beam.Beam) – Beam of the target resolution.

  • major (~astropy.units.Quantity) – The FWHM major axis. Has to be specified if no beam is given.

  • minor (~astropy.units.Quantity) – The FWHM minor axis. If not specified, will be assumed to be equal to major.

  • pa (~astropy.units.Quantity) – The beam position angle.

  • path_to_output (str, optional) – Path to output where smoothed file will be saved. By default, the subcube will be saved in the working directory.

  • suffix (str, optional) – Suffix that is appended to output filename.

  • allow_huge_operations (bool, optional) – Option to read in files of size >1gb. Default is False.

  • datatype (str, optional) – Allows the user to perform smoothing on whole file at once (‘regular’) or to write file channel by channel (‘large’). Default is ‘regular’.

  • save_file (bool) – Option to write smoothcube to file. Only applies if datatype=’regular’. If datatype is set to ‘large’, the smoothcube will always be written to a file. Default is `True.

  • **kwargs – Additional keyword arguments are passed to spectral_cube.SpectralCube.convolve_to() and the convolution function astropy.convolution.convolve().

Returns:

smoothcube – Only returned if datatype=’regular’.

Return type:

~spectral_cube.SpectralCube or ~spectral_cube.Projection

astrojoni_tools.functions.spectral_smooth(filename, target_resolution=None, path_to_output='.', suffix='', allow_huge_operations=False, datatype='regular', chunks=20, save_file=True, **kwargs)[source]#

Smooth a cube spectrally.

Parameters:
  • filename (str) – Path to file to smooth.

  • target_resolution (~astropy.units.Quantity) – Target resolution of spectrally smoothed data.

  • path_to_output (str, optional) – Path to output where smoothed file will be saved. By default, the subcube will be saved in the working directory.

  • suffix (str, optional) – Suffix that is appended to output filename.

  • allow_huge_operations (bool, optional) – Option to read in files of size >1gb. Default is False.

  • datatype (str, optional) – Allows the user to perform smoothing on whole file at once (‘regular’) or to write file channel by channel (‘large’). Default is ‘regular’.

  • chunks (int) – Number of chunks data will be divided into if datatype=’large’. Default is 20.

  • save_file (bool) – Option to write smoothcube to file. Only applies if datatype=’regular’. If datatype is set to ‘large’, the smoothcube will always be written to a file. Default is `True.

  • **kwargs – Additional keyword arguments are passed to spectral_cube.SpectralCube.spectral_smooth().

Returns:

smoothcube – Only returned if datatype=’regular’.

Return type:

~spectral_cube.SpectralCube or ~spectral_cube.Projection

astrojoni_tools.functions.velocity_axes(name: Path) ndarray[source]#

Get velocity axis from FITS file.

Parameters:

name (Path) – Path to FITS file to get velocity axis from.

Returns:

velocity – Array of velocity axis.

Return type:

numpy.ndarray

astrojoni_tools.functions.world_to_pixel(fitsfile: Path, longitude: float, latitude: float, velocity: float | None = 0.0) ndarray[source]#

Convert world coordinates to pixel coordinates from a FITS file.

Parameters:
  • fitsfile (Path) – Path to FITS file to get coordinates from.

  • longitude (float) – World coordinate value along the x-axis of the FITS file, e.g. longitude.

  • latitude (float) – World coordinate value along the y-axis of the FITS file, e.g. latitude.

  • velocity (float, optional) – Velocity value to convert (default is 0.).

Returns:

result – Returns the pixel coordinates. If the input was a single array and origin, a single array is returned, otherwise a tuple of arrays is returned.

Return type:

numpy.ndarray

astrojoni_tools.ism module#

astrojoni_tools.ism.calculate_gal_radius_from_distance(distance, longitude, latitude, R_sun=8.15)[source]#

Compute the Galactocentric distance of a source given its distance from the sun, Galactic longitude, Galactic latitude, and the Galactocentric distance of the sun.

Parameters:
  • distance (float or numpy.ndarray) – Heliocentric distance of the source [kpc].

  • longitude (float or numpy.ndarray) – Galactic longitude of the source [deg].

  • latitude (float or numpy.ndarray) – Galactic latitude of the source [deg].

  • R_sun (float, optional) – The Galactocentric distance of the sun [kpc]. The default is R_sun=8.15 (Reid et al. 2019).

Returns:

R_gal_distance – The Galactocentric distance of the source [kpc].

Return type:

float or numpy.ndarray

astrojoni_tools.ism.hi_coldens(t_s, tau, dv)[source]#

Compute the column density of atomic hydrogen (HI) given a spin temperature, optical depth and velocity resolution element.

Parameters:
  • t_s (float or numpy.ndarray) – Spin temperature of HI gas [K].

  • tau (float or numpy.ndarray) – Optical depth of HI gas.

  • dv (float or numpy.ndarray) – Velocity resolution element [km/s].

Returns:

n_HI – Column density of HI [cm-2].

Return type:

float or numpy.ndarray

astrojoni_tools.ism.radial_velocity(l, r, rotvel=220.0, v0=220.0, r0=8.5)[source]#

Compute the radial velocity of circular motion around the Galactic center.

Parameters:
  • l (float or numpy.ndarray) – Galactic longitude in degrees.

  • r (float) – Galactocentric distance of source in units of kiloparsec.

  • rotvel (float or numpy.ndarray) – Value of rotation velocity at distance r in units of sun’s orbital velocity v0 (absolute value would be rotvel*v0).

  • v0 (float) – Rotational velocity of the sun in units of km/s. Default is v0=220.

  • r0 (float) – Galactocentric distance of sun in units of kiloparsec. Default is r0=8.5.

Returns:

vrad – The radial velocity given the rotation velocity at distance r and longitude l.

Return type:

float or numpy.ndarray

astrojoni_tools.ism.rotation_curve(r, r0=8.5, a1=1.00767, a2=0.0394, a3=0.00712)[source]#

Compute the rotational velocity at distance r from the Galactic center. This rotational velocity is computed according to the Brand&Blitz (1993) rotation curve.

Parameters:
  • r (float) – Galactocentric distance of source in units of kiloparsec.

  • r0 (float) – Galactocentric distance of sun in units of kiloparsec. Default is r0=8.5.

  • a1 (float) – Fit parameter of the Brand&Blitz rotation curve.

  • a2 (float) – Fit parameter of the Brand&Blitz rotation curve.

  • a3 (float) – Fit parameter of the Brand&Blitz rotation curve.

Returns:

v_over_v0 – The rotational velocity at distance r from the Galactic center in units of the sun’s rotational velocity, which is 220 km/s in this model.

Return type:

float

astrojoni_tools.ism.t_hisa_max(p, t_on, t_off, t_cont)[source]#

Compute the maximum spin temperature of HI self-absorbing gas that would still give a solution to the optical depth computation. This limit is reached if the optical depth is set to infty.

Parameters:
  • p (float or numpy.ndarray) – Background fraction of HI gas that induces self-absorption.

  • t_on (float or numpy.ndarray) – Brightness temperature of HI gas if self-absorption is present.

  • t_off (float or numpy.ndarray) – Brightness temperature of HI gas if self-absorption were absent.

  • t_cont (float or numpy.ndarray) – Brightness of continuum emission.

Returns:

t_spin_max – Maximum spin temperature of HI self-absorbing gas.

Return type:

float or numpy.ndarray

astrojoni_tools.ism.tau_hisa(t_hisa, p, t_on, t_off, t_cont)[source]#

Compute the optical depth of HI self-absorption given a HISA spin temperature, background fraction, on and off brightness, and the continuum brightness.

Parameters:
  • t_hisa (float or numpy.ndarray) – Spin temperature of cold HI gas that produces self-absorption.

  • p (float or numpy.ndarray) – Background fraction of HI gas that induces self-absorption.

  • t_on (float or numpy.ndarray) – Brightness temperature of HI gas if self-absorption is present.

  • t_off (float or numpy.ndarray) – Brightness temperature of HI gas if self-absorption were absent.

  • t_cont (float or numpy.ndarray) – Brightness of continuum emission.

Returns:

tau_hisa – Optical depth of HI self-absorbing gas.

Return type:

float or numpy.ndarray

astrojoni_tools.ism.thermal_linewidth(t_kin, mu=1.27)[source]#

Compute the thermal linewidth of a chemical species.

Parameters:
  • t_kin (float or numpy.ndarray) – Gas kinetic temperature [Kelvin].

  • mu (float or numpy.ndarray) –  Mean molecular weight. Default is ‘1.27’ [atomic hydrogen]. Another prominent example is: ‘2.34’ [carbon monoxide].

Returns:

thermal_lw – The thermal linewidth of the gas given in units of sigma [km/s]. To convert to FWHM: thermal_lw * np.sqrt(8*np.log(2)).

Return type:

float or numpy.ndarray

astrojoni_tools.load_spiral_arm module#

astrojoni_tools.plotting module#

Module contents#

exception astrojoni_tools.UnsupportedPythonError[source]#

Bases: Exception