yt.analysis_modules.sunyaev_zeldovich.projection module

Projection class for the Sunyaev-Zeldovich effect. Requires SZpack (at least version 1.1.1) to be downloaded and installed:

http://www.chluba.de/SZpack/

For details on the computations involved please refer to the following references:

Chluba, Nagai, Sazonov, Nelson, MNRAS, 2012, arXiv:1205.5778 Chluba, Switzer, Nagai, Nelson, MNRAS, 2012, arXiv:1211.3206

class yt.analysis_modules.sunyaev_zeldovich.projection.SZProjection(ds, freqs, mue=1.143, high_order=False)[source]

Bases: object

Initialize a SZProjection object.

Parameters:
  • ds (Dataset) – The dataset
  • freqs (array_like) – The frequencies (in GHz) at which to compute the SZ spectral distortion.
  • mue (float, optional) – Mean molecular weight for determining the electron number density.
  • high_order (boolean, optional) – Should we calculate high-order moments of velocity and temperature?

Examples

>>> freqs = [90., 180., 240.]
>>> szprj = SZProjection(ds, freqs, high_order=True)
has_key(key)[source]
items()[source]
keys()[source]
off_axis(L, center='c', width=(1.0, 'unitary'), depth=(1.0, 'unitary'), nx=800, nz=800, north_vector=None, no_ghost=False, source=None)[source]

Make an off-axis projection of the SZ signal.

Parameters:
  • L (array_like) – The normal vector of the projection.
  • center (A sequence of floats, a string, or a tuple.) – The coordinate of the center of the image. If set to ‘c’, ‘center’ or left blank, the plot is centered on the middle of the domain. If set to ‘max’ or ‘m’, the center will be located at the maximum of the (‘gas’, ‘density’) field. Centering on the max or min of a specific field is supported by providing a tuple such as (“min”,”temperature”) or (“max”,”dark_matter_density”). Units can be specified by passing in center as a tuple containing a coordinate and string unit name or by passing in a YTArray. If a list or unitless array is supplied, code units are assumed.
  • width (tuple or a float.) –

    Width can have four different formats to support windows with variable x and y widths. They are:

    format example
    (float, string) (10,’kpc’)
    ((float, string), (float, string)) ((10,’kpc’),(15,’kpc’))
    float 0.2
    (float, float) (0.2, 0.3)

    For example, (10, ‘kpc’) requests a plot window that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) requests a window that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along the y axis. In the other two examples, code units are assumed, for example (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3 in code units. If units are provided the resulting plot axis labels will use the supplied units.

  • depth (A tuple or a float) – A tuple containing the depth to project through and the string key of the unit: (width, ‘unit’). If set to a float, code units are assumed
  • nx (integer, optional) – The dimensions on a side of the projection image.
  • nz (integer, optional) – Deprecated, this is still in the function signature for API compatibility
  • north_vector (a sequence of floats) – A vector defining the ‘up’ direction in the plot. This option sets the orientation of the slicing plane. If not set, an arbitrary grid-aligned north-vector is chosen.
  • no_ghost (bool, optional) – Optimization option for off-axis cases. If True, homogenized bricks will extrapolate out from grid instead of interpolating from ghost zones that have to first be calculated. This can lead to large speed improvements, but at a loss of accuracy/smoothness in resulting image. The effects are less notable when the transfer function is smooth and broad. Default: True
  • source (yt.data_objects.data_containers.YTSelectionContainer, optional) – If specified, this will be the data source used for selecting regions to project.

Examples

>>> L = np.array([0.5, 1.0, 0.75])
>>> szprj.off_axis(L, center="c", width=(2.0, "Mpc"))
on_axis(axis, center='c', width=(1, 'unitary'), nx=800, source=None)[source]

Make an on-axis projection of the SZ signal.

Parameters:
  • axis (integer or string) – The axis of the simulation domain along which to make the SZprojection.
  • center (A sequence of floats, a string, or a tuple.) – The coordinate of the center of the image. If set to ‘c’, ‘center’ or left blank, the plot is centered on the middle of the domain. If set to ‘max’ or ‘m’, the center will be located at the maximum of the (‘gas’, ‘density’) field. Centering on the max or min of a specific field is supported by providing a tuple such as (“min”,”temperature”) or (“max”,”dark_matter_density”). Units can be specified by passing in center as a tuple containing a coordinate and string unit name or by passing in a YTArray. If a list or unitless array is supplied, code units are assumed.
  • width (tuple or a float.) –

    Width can have four different formats to support windows with variable x and y widths. They are:

    format example
    (float, string) (10,’kpc’)
    ((float, string), (float, string)) ((10,’kpc’),(15,’kpc’))
    float 0.2
    (float, float) (0.2, 0.3)

    For example, (10, ‘kpc’) requests a plot window that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) requests a window that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along the y axis. In the other two examples, code units are assumed, for example (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3 in code units. If units are provided the resulting plot axis labels will use the supplied units.

  • nx (integer, optional) – The dimensions on a side of the projection image.
  • source (yt.data_objects.data_containers.YTSelectionContainer, optional) – If specified, this will be the data source used for selecting regions to project.

Examples

>>> szprj.on_axis("y", center="max", width=(1.0, "Mpc"), source=my_sphere)
shape
values()[source]
write_fits(filename, sky_scale=None, sky_center=None, overwrite=True, **kwargs)[source]

Export images to a FITS file. Writes the SZ distortion in all specified frequencies as well as the mass-weighted temperature and the optical depth. Distance units are in kpc, unless sky_center and scale are specified.

Parameters:
  • filename (string) – The name of the FITS file to be written.
  • sky_scale (tuple) – Conversion between an angle unit and a length unit, if sky coordinates are desired, e.g. (1.0, “arcsec/kpc”)
  • sky_center (tuple, optional) – The (RA, Dec) coordinate in degrees of the central pixel. Must be specified with sky_scale.
  • overwrite (boolean, optional) – If the file already exists, do we overwrite?
  • keyword arguments are passed to (Additional) –

:param writeto().:

Examples

>>> # This example just writes out a FITS file with kpc coords
>>> szprj.write_fits("SZbullet.fits", overwrite=False)
>>> # This example uses sky coords
>>> sky_scale = (1., "arcsec/kpc") # One arcsec per kpc
>>> sky_center = (30., 45., "deg")
>>> szprj.write_fits("SZbullet.fits", sky_center=sky_center, sky_scale=sky_scale)
write_hdf5(filename)[source]

Export the set of S-Z fields to a set of HDF5 datasets.

Parameters:filename (string) – This file will be opened in “write” mode.

Examples

>>> szprj.write_hdf5("SZsloshing.h5")
write_png(filename_prefix, cmap_name=None, axes_units='kpc', log_fields=None)[source]

Export images to PNG files. Writes the SZ distortion in all specified frequencies as well as the mass-weighted temperature and the optical depth. Distance units are in kpc.

Parameters:filename_prefix (string) – The prefix of the image filenames.

Examples

>>> szprj.write_png("SZsloshing")
yt.analysis_modules.sunyaev_zeldovich.projection.generate_beta_par(L)[source]
yt.analysis_modules.sunyaev_zeldovich.projection.setup_sunyaev_zeldovich_fields(ds)[source]