Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
image_axes = ['x', 'y']
if axes is None:
if cube.wcs.naxis is not 2:
missing_axis = cube.missing_axis
slice_list = []
axis_index = []
index = 0
for i, bool_ in enumerate(missing_axis):
if not bool_:
slice_list.append(image_axes[index])
index += 1
else:
slice_list.append(1)
if index is not 2:
raise ValueError("Dimensions of WCS and data don't match")
axes = wcsaxes_compat.gca_wcs(cube.wcs, slices=slice_list)
plot = axes.imshow(cube.data, **kwargs)
return plot
Parameters
----------
offset: `int` or `float`
The offset from the primary wavelength to plot. If it's an int it
will plot the nth wavelength from the primary; if it's a float then
it will plot the closest wavelength. If the offset is out of range,
it will plot the primary wavelength (offset 0)
axes: `astropy.visualization.wcsaxes.core.WCSAxes` or `None`:
The axes to plot onto. If None the current axes will be used.
style: 'imshow' or 'pcolormesh'
The style of plot to be used. Default is 'imshow'
"""
if axes is None:
axes = wcsaxes_compat.gca_wcs(self.axes_wcs, slices=("x", "y", offset))
data = self._choose_wavelength_slice(offset)
if data is None:
data = self._choose_wavelength_slice(0)
if style == 'imshow':
plot = axes.imshow(data, **kwargs)
elif style == 'pcolormesh':
plot = axes.pcolormesh(data, **kwargs)
return plot
Parameters
----------
offset: `int` or `float`
The offset from the initial x value to plot. If it's an int it
will plot slice n from the start; if it's a float then
it will plot the closest x-distance. If the offset is out of range,
it will plot the primary wavelength (offset 0)
axes: `astropy.visualization.wcsaxes.core.WCSAxes` or None:
The axes to plot onto. If None the current axes will be used.
style: 'imshow' or 'pcolormesh'
The style of plot to be used. Default is 'imshow'
"""
if axes is None:
axes = wcsaxes_compat.gca_wcs(self.axes_wcs, slices=("x", offset, "y"))
data = self._choose_x_slice(offset)
if data is None:
data = self._choose_x_slice(0)
if style == 'imshow':
plot = axes.imshow(data, **kwargs)
elif style == 'pcolormesh':
plot = axes.pcolormesh(data, **kwargs)
return plot