yt.visualization.fits_image module

FITSImageData Class

class yt.visualization.fits_image.FITSImageBuffer(data, fields=None, units=None, width=None, wcs=None)[source]

Bases: yt.visualization.fits_image.FITSImageData

close()
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
from_file(filename)

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
from_images(image_list)

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)
info(output=None)

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()
keys()
pop(key)

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)
update_header(field, key, value)

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()
writeto(fileobj, fields=None, clobber=False, **kwargs)

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.FITSImageData(data, fields=None, units=None, width=None, wcs=None)[source]

Bases: object

close()[source]
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)[source]

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
classmethod from_file(filename)[source]

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
classmethod from_images(image_list)[source]

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)[source]

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)[source]
info(output=None)[source]

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()[source]
keys()[source]
pop(key)[source]

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)[source]

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)[source]

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)[source]

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)[source]

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)[source]
update_header(field, key, value)[source]

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()[source]
writeto(fileobj, fields=None, clobber=False, **kwargs)[source]

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.FITSOffAxisProjection(ds, normal, fields, center='c', width=(1.0, 'unitary'), weight_field=None, image_res=512, data_source=None, north_vector=None, depth=(1.0, 'unitary'), method='integrate')[source]

Bases: yt.visualization.fits_image.FITSImageData

Generate a FITSImageData of an off-axis projection.

Parameters:
  • ds (Dataset) – This is the dataset object corresponding to the simulation output to be plotted.
  • normal (a sequence of floats) – The vector normal to the projection plane.
  • fields (string, list of strings) – The name of the field(s) to be plotted.
  • 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
  • weight_field (string) – The name of the weighting field. Set to None for no weight.
  • image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image.
  • 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.
  • method (string) –

    The method of projection. Valid methods are:

    “integrate” with no weight_field specified : integrate the requested field along the line of sight.

    “integrate” with a weight_field specified : weight the requested field by the weighting field and integrate along the line of sight.

    “sum” : This method is the same as integrate, except that it does not multiply by a path length when performing the integration, and is just a straight summation of the field along the given axis. WARNING: This should only be used for uniform resolution grid datasets, as other datasets may result in unphysical images.

  • data_source (yt.data_objects.data_containers.YTSelectionContainer, optional) – If specified, this will be the data source used for selecting regions to project.
close()
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
from_file(filename)

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
from_images(image_list)

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)
info(output=None)

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()
keys()
pop(key)

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)
update_header(field, key, value)

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()
writeto(fileobj, fields=None, clobber=False, **kwargs)

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.FITSOffAxisSlice(ds, normal, fields, center='c', width=None, image_res=512, north_vector=None)[source]

Bases: yt.visualization.fits_image.FITSImageData

Generate a FITSImageData of an off-axis slice.

Parameters:
  • ds (Dataset) – The dataset object.
  • normal (a sequence of floats) – The vector normal to the projection plane.
  • fields (string or list of strings) – The fields to slice
  • 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.

  • image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image.
  • 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.
close()
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
from_file(filename)

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
from_images(image_list)

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)
info(output=None)

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()
keys()
pop(key)

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)
update_header(field, key, value)

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()
writeto(fileobj, fields=None, clobber=False, **kwargs)

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.FITSProjection(ds, axis, fields, center='c', width=None, weight_field=None, image_res=None, **kwargs)[source]

Bases: yt.visualization.fits_image.FITSImageData

Generate a FITSImageData of an on-axis projection.

Parameters:
  • ds (Dataset) – The dataset object.
  • axis (character or integer) – The axis along which to project. One of “x”,”y”,”z”, or 0,1,2.
  • fields (string or list of strings) – The fields to project
  • weight_field (string) – The field used to weight 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.

  • image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. If not provided, it will be determined based on the minimum cell size of the dataset.
close()
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
from_file(filename)

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
from_images(image_list)

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)
info(output=None)

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()
keys()
pop(key)

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)
update_header(field, key, value)

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()
writeto(fileobj, fields=None, clobber=False, **kwargs)

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.FITSSlice(ds, axis, fields, center='c', width=None, image_res=None, **kwargs)[source]

Bases: yt.visualization.fits_image.FITSImageData

Generate a FITSImageData of an on-axis slice.

Parameters:
  • ds (Dataset) – The dataset object.
  • axis (character or integer) – The axis of the slice. One of “x”,”y”,”z”, or 0,1,2.
  • fields (string or list of strings) – The fields to slice
  • 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.

  • image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. If not provided, it will be determined based on the minimum cell size of the dataset.
close()
create_sky_wcs(sky_center, sky_scale, ctype=['RA---TAN', 'DEC--TAN'], crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)

Takes a Cartesian WCS and converts it to one in a celestial coordinate system.

Parameters:
  • sky_center (iterable of floats) – Reference coordinates of the WCS in degrees.
  • sky_scale (tuple or YTQuantity) – Conversion between an angle unit and a length unit, e.g. (3.0, “arcsec/kpc”)
  • ctype (list of strings, optional) – The type of the coordinate system to create.
  • crota (2-element ndarray, optional) – Rotation angles between cartesian coordinates and the celestial coordinates.
  • cd (2x2-element ndarray, optional) – Dimensioned coordinate transformation matrix.
  • pc (2x2-element ndarray, optional) – Coordinate transformation matrix.
  • replace_old_wcs (boolean, optional) – Whether or not to overwrite the default WCS of the FITSImageData instance. If false, a second WCS will be added to the header. Default: True.
from_file(filename)

Generate a FITSImageData instance from one previously written to disk.

Parameters:filename (string) – The name of the file to open.
from_images(image_list)

Generate a new FITSImageData instance from a list of FITSImageData instances.

Parameters:image_list (list of FITSImageData instances) – The images to be combined.
get_data(field)

Return the data array of the image corresponding to field with units attached. Deprecated.

has_key(key)
info(output=None)

Summarize the info of the HDUs in this FITSImageData instance.

Note that this function prints its results to the console—it does not return a value.

Parameters:output (file, boolean, optional) – A file-like object to write the output to. If False, does not output to a file and instead returns a list of tuples representing the FITSImageData info. Writes to sys.stdout by default.
items()
keys()
pop(key)

Remove a field with name key and return it as a new FITSImageData instance.

set_unit(field, units)

Set the units of field to units.

set_wcs(wcs, wcsname=None, suffix=None)

Set the WCS coordinate information for all images with a WCS object wcs.

to_aplpy(**kwargs)

Use APLpy (http://aplpy.github.io) for plotting. Returns an aplpy.FITSFigure instance. All keyword arguments are passed to the aplpy.FITSFigure constructor.

to_glue(label='yt', data_collection=None)

Takes the data in the FITSImageData instance and exports it to Glue (http://www.glueviz.org) for interactive analysis. Optionally add a label. If you are already within the Glue environment, you can pass a data_collection object, otherwise Glue will be started.

update_all_headers(key, value)
update_header(field, key, value)

Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.

values()
writeto(fileobj, fields=None, clobber=False, **kwargs)

Write all of the fields or a subset of them to a FITS file.

Parameters:
  • fileobj (string) – The name of the file to write to.
  • fields (list of strings, optional) – The fields to write to the file. If not specified all of the fields in the buffer will be written.
  • clobber (boolean, optional) – Whether or not to overwrite a previously existing file. Default: False
  • other keyword arguments are passed to the writeto (All) –
  • of astropy.io.fits.HDUList. (method) –
class yt.visualization.fits_image.UnitfulHDU(hdu)[source]

Bases: object

data
yt.visualization.fits_image.assert_same_wcs(wcs1, wcs2)[source]
yt.visualization.fits_image.construct_image(ds, axis, data_source, center, width=None, image_res=None)[source]
yt.visualization.fits_image.sanitize_fits_unit(unit)[source]