Unfortunately, I think this requires the file I'm using to reproduce (attached). I'm also not sure if the problem lies in yt or SpectralCube, since the yt object is created by the SpectralCubeto_yt() method.
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue.
Bug report
Bug summary
When calling
sc.show()
on a scene composed of aSpectralCube
object with a non-square face, the call fails with anIndexError
.Code for reproduction
Unfortunately, I think this requires the file I'm using to reproduce (attached). I'm also not sure if the problem lies in
yt
orSpectralCube
, since theyt
object is created by theSpectralCube
to_yt()
method.FITS file
I failed to reproduce this with just a normal data volume with a non-square face:
Maybe I didn't try hard enough, or this kind of MWE doesn't exercise the failing code?
Actual outcome
Error message:
```python yt : [WARNING ] 2024-02-03 11:08:56,206 Cannot find time yt : [INFO ] 2024-02-03 11:08:56,209 Detected these axes: RA---SIN DEC--SIN FREQ yt : [WARNING ] 2024-02-03 11:08:56,226 No length conversion provided. Assuming 1 = 1 cm. yt : [WARNING ] 2024-02-03 11:08:56,229 Assuming 1.0 = 1.0 s yt : [WARNING ] 2024-02-03 11:08:56,232 Assuming 1.0 = 1.0 g yt : [INFO ] 2024-02-03 11:08:56,288 Parameters: current_time = 0.0 yt : [INFO ] 2024-02-03 11:08:56,289 Parameters: domain_dimensions = [120 24 188] yt : [INFO ] 2024-02-03 11:08:56,290 Parameters: domain_left_edge = [0.5 0.5 0.5] yt : [INFO ] 2024-02-03 11:08:56,291 Parameters: domain_right_edge = [120.5 24.5 188.5] yt : [INFO ] 2024-02-03 11:08:56,292 Parameters: cosmological_simulation = 0 yt : [INFO ] 2024-02-03 11:08:56,302 Adding field flux to the list of fields. yt : [INFO ] 2024-02-03 11:08:56,386 Rendering scene (Can take a while). yt : [INFO ] 2024-02-03 11:08:56,388 Creating volume --------------------------------------------------------------------------- IndexError Traceback (most recent call last) File ~/.local/lib/python3.10/site-packages/IPython/core/formatters.py:344, in BaseFormatter.__call__(self, obj) 342 method = get_real_method(obj, self.print_method) 343 if method is not None: --> 344 return method() 345 return None 346 else: File ~/github/yt/yt/visualization/volume_rendering/scene.py:987, in Scene._repr_png_(self) 985 def _repr_png_(self): 986 if self._last_render is None: --> 987 self.render() 988 png = self._last_render.write_png( 989 filename=None, sigma_clip=self._sigma_clip, background="black" 990 ) 991 self._sigma_clip = None File ~/github/yt/yt/visualization/volume_rendering/scene.py:225, in Scene.render(self, camera) 223 assert camera is not None 224 self._validate() --> 225 bmp = self.composite(camera=camera) 226 self._last_render = bmp 227 return bmp File ~/github/yt/yt/visualization/volume_rendering/scene.py:598, in Scene.composite(self, camera) 595 im = source.zbuffer.rgba 597 for _, source in self.transparent_sources: --> 598 im = source.render(camera, zbuffer=opaque) 599 opaque.rgba = im 601 # rotate image 180 degrees so orientation agrees with e.g. 602 # a PlotWindow plot File ~/github/yt/yt/visualization/volume_rendering/render_source.py:131, in validate_volume.Expected outcome
yt
renders the cube, just as it does for cubes with square faces.Version Information
astropy
yt
is installed from source.