On 02/20/2013 12:24 PM, Kacper Kowalik wrote:
On 02/20/2013 11:09 AM, Francisco Ocaña González wrote:
Dear Eli,
Hi Paco!
I found a post about 3D data in YT , http://astrobiased.com/3d-data-vis-in-yt.html , very interesting. I am working with spectral cubes from PMAS Spectrograph (at 3.5m CAHA telescope). Thus, I tried to use it. I am newbie with python, but I was able to install everything :-)
Great to hear that!
However I get an error message when loading the data into yt's data structure (script http://paste.yt-project.org/show/3182/ ):
ERROR: ValueError: total size of new array must be unchanged [yt.frontends.stream.data_structures] astropy: [ERROR ] 2013-02-20 10:46:53,395 ValueError: total size of new array must be unchanged Traceback (most recent call last): File "3d_viewer.py", line 9, in <module> pf = load_uniform_grid(data, cube.shape, 9e16) File "/home/fog/YT/yt-x86_64/src/yt-hg/yt/frontends/stream/data_structures.py", line 490, in load_uniform_grid grid_dimensions = domain_dimensions.reshape(nprocs,3).astype("int32") ValueError: total size of new array must be unchanged
That happens due to the fact that load_uniform_grid expects that data has 3 dimensions, whereas the data from your fits has only 2. You can "fix" that by artificially adding one dimension by e.g. using numpy function "expand_dims". I've modified your script slightly:
Maybe I should add that image from that script won't be probably what you're looking for. You'll need to somehow convert 2D output from PMAS that you have there, to 3d array that is actual, spatial representation of your data. Forgive my ignorance, but I have no clue what PMAS actually gives as an output, so I won't be able to help there. Cheers, Kacper