yt.visualization.fits_image module¶
- class yt.visualization.fits_image.FITSImageBuffer(data, fields=None, length_unit=None, width=None, img_ctr=None, wcs=None, current_time=None, time_unit=None, mass_unit=None, velocity_unit=None, magnetic_unit=None, ds=None, unit_header=None, **kwargs)[source]¶
Bases:
FITSImageData
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSImageData(data, fields=None, length_unit=None, width=None, img_ctr=None, wcs=None, current_time=None, time_unit=None, mass_unit=None, velocity_unit=None, magnetic_unit=None, ds=None, unit_header=None, **kwargs)[source]¶
Bases:
object
- change_image_name(old_name, new_name)[source]¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- convolve(field, kernel, **kwargs)[source]¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)[source]¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- 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.
- 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.
- 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://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_header(field, key, value)[source]¶
Update the FITS header for field with a key, value pair. If field == “all”, all headers will be updated.
- writeto(fileobj, fields=None, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSOffAxisProjection(ds, normal, fields, center='center', width=(1.0, 'unitary'), weight_field=None, image_res=512, data_source=None, north_vector=None, depth=(1.0, 'unitary'), method='integrate', length_unit=None, *, moment=1)[source]¶
Bases:
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.
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
center ('center', 'c', id of a global extremum, or array-like) –
The coordinate of the selection’s center. Defaults to the ‘center’, i.e. center of the domain.
Centering on the min or max of a field is supported by passing a tuple such as (‘min’, (‘gas’, ‘density’)) or (‘max’, (‘gas’, ‘temperature’). A single string may also be used (e.g. “min_density” or “max_temperature”), though it’s not as flexible and does not allow to select an exact field/particle type. With this syntax, the first field matching the provided name is selected. ‘max’ or ‘m’ can be used as a shortcut for (‘max’, (‘gas’, ‘density’)) ‘min’ can be used as a shortcut for (‘min’, (‘gas’, ‘density’))
One can also select an exact point as a 3 element coordinate sequence, e.g. [0.5, 0.5, 0] Units can be specified by passing in center as a tuple containing a 3-element coordinate sequence and string unit name, e.g. ([0, 0.5, 0.5], “cm”), or by passing in a YTArray. Code units are assumed if unspecified.
width (tuple or a float.) –
Width can have four different formats to support 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code 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.
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.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
moment (integer, optional) – for a weighted projection, moment = 1 (the default) corresponds to a weighted average. moment = 2 corresponds to a weighted standard deviation.
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSOffAxisSlice(ds, normal, fields, image_res=512, center='center', width=None, north_vector=None, length_unit=None)[source]¶
Bases:
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
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
center ('center', 'c', id of a global extremum, or array-like) –
The coordinate of the selection’s center. Defaults to the ‘center’, i.e. center of the domain.
Centering on the min or max of a field is supported by passing a tuple such as (‘min’, (‘gas’, ‘density’)) or (‘max’, (‘gas’, ‘temperature’). A single string may also be used (e.g. “min_density” or “max_temperature”), though it’s not as flexible and does not allow to select an exact field/particle type. With this syntax, the first field matching the provided name is selected. ‘max’ or ‘m’ can be used as a shortcut for (‘max’, (‘gas’, ‘density’)) ‘min’ can be used as a shortcut for (‘min’, (‘gas’, ‘density’))
One can also select an exact point as a 3 element coordinate sequence, e.g. [0.5, 0.5, 0] Units can be specified by passing in center as a tuple containing a 3-element coordinate sequence and string unit name, e.g. ([0, 0.5, 0.5], “cm”), or by passing in a YTArray. Code units are assumed if unspecified.
width (tuple or a float.) –
Width can have four different formats to support 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code units.
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.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSParticleOffAxisProjection(ds, normal, fields, image_res=512, center='c', width=None, depth=(1, '1'), weight_field=None, length_unit=None, deposition='ngp', density=False, field_parameters=None, data_source=None, north_vector=None)[source]¶
Bases:
FITSImageData
Generate a FITSImageData of an off-axis projection of a particle field.
- 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
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
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 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code 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. Defaults to the entire domain.
weight_field (string) – The field used to weight the projection.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
deposition (string, optional) – Controls the order of the interpolation of the particles onto the mesh. “ngp” is 0th-order “nearest-grid-point” method (the default), “cic” is 1st-order “cloud-in-cell”.
density (boolean, optional) – If True, the quantity to be projected will be divided by the area of the cells, to make a projected density of the quantity. Default: False
field_parameters (dictionary) – A dictionary of field parameters than can be accessed by derived fields.
data_source (yt.data_objects.data_containers.YTSelectionContainer, optional) – If specified, this will be the data source used for selecting regions to project.
origin (string) – The origin of the coordinate system in the file. If “domain”, then the center coordinates will be the same as the center of the image as defined by the center keyword argument. If “image”, then the center coordinates will be set to (0,0). Default: “domain”
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSParticleProjection(ds, axis, fields, image_res=512, center='center', width=None, depth=(1, '1'), weight_field=None, length_unit=None, deposition='ngp', density=False, field_parameters=None, data_source=None, *, origin='domain')[source]¶
Bases:
FITSImageData
Generate a FITSImageData of an on-axis projection of a particle field.
- 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
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
center ('center', 'c', 'left', 'l', 'right', 'r', id of a global extremum, or array-like) –
The coordinate of the selection’s center. Defaults to the ‘center’, i.e. center of the domain.
Centering on the min or max of a field is supported by passing a tuple such as (‘min’, (‘gas’, ‘density’)) or (‘max’, (‘gas’, ‘temperature’). A single string may also be used (e.g. “min_density” or “max_temperature”), though it’s not as flexible and does not allow to select an exact field/particle type. With this syntax, the first field matching the provided name is selected. ‘max’ or ‘m’ can be used as a shortcut for (‘max’, (‘gas’, ‘density’)) ‘min’ can be used as a shortcut for (‘min’, (‘gas’, ‘density’))
One can also select an exact point as a 3 element coordinate sequence, e.g. [0.5, 0.5, 0] Units can be specified by passing in center as a tuple containing a 3-element coordinate sequence and string unit name, e.g. ([0, 0.5, 0.5], “cm”), or by passing in a YTArray. Code units are assumed if unspecified.
The domain edges along the selected axis can be selected with ‘left’/’l’ and ‘right’/’r’ respectively.
width (tuple or a float.) –
Width can have four different formats to support 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code 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. Defaults to the entire domain.
weight_field (string) – The field used to weight the projection.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
deposition (string, optional) – Controls the order of the interpolation of the particles onto the mesh. “ngp” is 0th-order “nearest-grid-point” method (the default), “cic” is 1st-order “cloud-in-cell”.
density (boolean, optional) – If True, the quantity to be projected will be divided by the area of the cells, to make a projected density of the quantity. Default: False
field_parameters (dictionary) – A dictionary of field parameters than can be accessed by derived fields.
data_source (yt.data_objects.data_containers.YTSelectionContainer, optional) – If specified, this will be the data source used for selecting regions to project.
origin (string) – The origin of the coordinate system in the file. If “domain”, then the center coordinates will be the same as the center of the image as defined by the center keyword argument. If “image”, then the center coordinates will be set to (0,0). Default: “domain”
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSProjection(ds, axis, fields, image_res=512, center='center', width=None, weight_field=None, length_unit=None, *, origin='domain', moment=1, **kwargs)[source]¶
Bases:
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
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
center ('center', 'c', 'left', 'l', 'right', 'r', id of a global extremum, or array-like) –
The coordinate of the selection’s center. Defaults to the ‘center’, i.e. center of the domain.
Centering on the min or max of a field is supported by passing a tuple such as (‘min’, (‘gas’, ‘density’)) or (‘max’, (‘gas’, ‘temperature’). A single string may also be used (e.g. “min_density” or “max_temperature”), though it’s not as flexible and does not allow to select an exact field/particle type. With this syntax, the first field matching the provided name is selected. ‘max’ or ‘m’ can be used as a shortcut for (‘max’, (‘gas’, ‘density’)) ‘min’ can be used as a shortcut for (‘min’, (‘gas’, ‘density’))
One can also select an exact point as a 3 element coordinate sequence, e.g. [0.5, 0.5, 0] Units can be specified by passing in center as a tuple containing a 3-element coordinate sequence and string unit name, e.g. ([0, 0.5, 0.5], “cm”), or by passing in a YTArray. Code units are assumed if unspecified.
The domain edges along the selected axis can be selected with ‘left’/’l’ and ‘right’/’r’ respectively.
width (tuple or a float.) –
Width can have four different formats to support 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code units.
weight_field (string) – The field used to weight the projection.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
origin (string) – The origin of the coordinate system in the file. If “domain”, then the center coordinates will be the same as the center of the image as defined by the center keyword argument. If “image”, then the center coordinates will be set to (0,0). Default: “domain”
moment (integer, optional) – for a weighted projection, moment = 1 (the default) corresponds to a weighted average. moment = 2 corresponds to a weighted standard deviation.
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.
- class yt.visualization.fits_image.FITSSlice(ds, axis, fields, image_res=512, center='center', width=None, length_unit=None, *, origin='domain', **kwargs)[source]¶
Bases:
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
image_res (an int or 2-tuple of ints) – Specify the resolution of the resulting image. A single value will be used for both axes, whereas a tuple of values will be used for the individual axes. Default: 512
center ('center', 'c', 'left', 'l', 'right', 'r', id of a global extremum, or array-like) –
The coordinate of the selection’s center. Defaults to the ‘center’, i.e. center of the domain.
Centering on the min or max of a field is supported by passing a tuple such as (‘min’, (‘gas’, ‘density’)) or (‘max’, (‘gas’, ‘temperature’). A single string may also be used (e.g. “min_density” or “max_temperature”), though it’s not as flexible and does not allow to select an exact field/particle type. With this syntax, the first field matching the provided name is selected. ‘max’ or ‘m’ can be used as a shortcut for (‘max’, (‘gas’, ‘density’)) ‘min’ can be used as a shortcut for (‘min’, (‘gas’, ‘density’))
One can also select an exact point as a 3 element coordinate sequence, e.g. [0.5, 0.5, 0] Units can be specified by passing in center as a tuple containing a 3-element coordinate sequence and string unit name, e.g. ([0, 0.5, 0.5], “cm”), or by passing in a YTArray. Code units are assumed if unspecified.
The domain edges along the selected axis can be selected with ‘left’/’l’ and ‘right’/’r’ respectively.
width (tuple or a float.) –
Width can have four different formats to support 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’) specifies a width that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) specifies a width 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) specifies a width that has an x width of 0.2 and a y width of 0.3 in code units.
length_unit (string, optional) – the length units that the coordinates are written in. The default is to use the default length unit of the dataset.
origin (string) – The origin of the coordinate system in the file. If “domain”, then the center coordinates will be the same as the center of the image as defined by the center keyword argument. If “image”, then the center coordinates will be set to (0,0). Default: “domain”
- change_image_name(old_name, new_name)¶
Change the name of a FITS image.
- Parameters:
old_name (string) – The old name of the image.
new_name (string) – The new name of the image.
- close()¶
- convolve(field, kernel, **kwargs)¶
Convolve an image with a kernel, either a simple Gaussian kernel or one provided by AstroPy. Currently, this only works for 2D images.
All keyword arguments are passed to
convolve()
.- Parameters:
field (string) – The name of the field to convolve.
kernel (float, YTQuantity, (value, unit) tuple, or AstroPy Kernel object) – The kernel to convolve the image with. If this is an AstroPy Kernel object, the image will be convolved with it. Otherwise, it is assumed that the kernel is a Gaussian and that this value is the standard deviation. If a float, it is assumed that the units are pixels, but a (value, unit) tuple or YTQuantity can be supplied to specify the standard deviation in physical units.
Examples
>>> fid = FITSSlice(ds, "z", ("gas", "density")) >>> fid.convolve("density", (3.0, "kpc"))
- create_sky_wcs(sky_center, sky_scale, ctype=None, crota=None, cd=None, pc=None, wcsname='celestial', replace_old_wcs=True)¶
Takes a Cartesian WCS and converts it to one in a sky-based 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. Default: A “tangential” projection.
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.
wcsname (string, optional) – The name of the WCS to be stored in the FITS header.
replace_old_wcs (boolean, optional) – If True, the original WCS will be overwritten but first copied to a second WCS (“WCSAXESA”). If False, this new WCS will be placed into the second WCS.
- classmethod from_file(filename)¶
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)¶
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://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_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, overwrite=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.
overwrite (boolean) – Whether or not to overwrite a previously existing file. Default: False
**kwargs – Additional keyword arguments are passed to
writeto()
.