yt.frontends.fits.misc module¶
- class yt.frontends.fits.misc.PlotWindowWCS(pw)[source]¶
Bases:
object
Use AstroPy’s WCSAxes class to plot celestial coordinates on the axes of a on-axis PlotWindow plot. See http://docs.astropy.org/en/stable/visualization/wcsaxes/ for more details on how it works under the hood. This functionality requires a version of AstroPy >= 1.3.
- Parameters:
pw (on-axis PlotWindow instance) – The PlotWindow instance to add celestial axes to.
- yt.frontends.fits.misc.create_spectral_slabs(filename, slab_centers, slab_width, **kwargs)[source]¶
Given a dictionary of spectral slab centers and a width in spectral units, extract data from a spectral cube at these slab centers and return a FITSDataset instance containing the different slabs as separate yt fields. Useful for extracting individual lines from a spectral cube and separating them out as different fields.
Requires the SpectralCube (https://spectral-cube.readthedocs.io/en/latest/) library.
All keyword arguments will be passed on to the FITSDataset constructor.
- Parameters:
filename (string) – The spectral cube FITS file to extract the data from.
slab_centers (dict of (float, string) tuples or YTQuantities) – The centers of the slabs, where the keys are the names of the new fields and the values are (float, string) tuples or YTQuantities, specifying a value for each center and its unit.
slab_width (YTQuantity or (float, string) tuple) – The width of the slab along the spectral axis.
Examples
>>> slab_centers = { ... "13CN": (218.03117, "GHz"), ... "CH3CH2CHO": (218.284256, "GHz"), ... "CH3NH2": (218.40956, "GHz"), ... } >>> slab_width = (0.05, "GHz") >>> ds = create_spectral_slabs( ... "intensity_cube.fits", slab_centers, slab_width, nan_mask=0.0 ... )
- yt.frontends.fits.misc.ds9_region(ds, reg, obj=None, field_parameters=None)[source]¶
Create a data container from a ds9 region file. Requires the regions package (https://astropy-regions.readthedocs.io/) to be installed.
- Parameters:
ds (FITSDataset) – The Dataset to create the region from.
reg (string) – The filename of the ds9 region, or a region string to be parsed.
obj (data container, optional) – The data container that will be used to create the new region. Defaults to ds.all_data.
field_parameters (dictionary, optional) – A set of field parameters to apply to the region.
Examples
>>> ds = yt.load("m33_hi.fits") >>> circle_region = ds9_region(ds, "circle.reg") >>> print(circle_region.quantities.extrema("flux"))