
Dear Eli, 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 :-) 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 I have uploaded the cube to: http://bolidox.fis.ucm.es/~alex/YT_cube/ . FITS seems to be quite ok according to the FITS validator. And the 'cube' object is well loaded, I guess. Have you had this problem? Cheers, Paco Ocaña

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: http://bpaste.net/show/78501/ I hope it'll work for you. Cheers, Kacper

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

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:
I hope it'll work for you. Cheers, Kacper I was able to view the data just fine in e.g. ds9, there's nothing wrong with it. ds9 even handles 3D cubes these days. but to me it looks like this data is unsuitable for yt. Perhaps the 984
On 02/20/2013 06:24 AM, Kacper Kowalik wrote: positions along the Y axis of this fits image can be re-arranged in an RA-DEC grid, and create a real 3D cube, something like a 30 x 30 x 2000, perhaps along the lines Kacper has tried out, but the fits file does not contain this information how to do that, in fact the FITS header is criminally close to being useless. There's no WCS to speak of. More seriously, before interesting things can be seen, the data need to be calibrated. lines extracted, fitted, and you could perhaps see some interesting structures in doppler-velocity space. I would look at IRAF to handle this, they have lots of tools to handle such spectra. peter
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Paco, I think you'll have a bit of luck if once you do: cube = fits.getdata('UCM2317_v300_com_sum.FC_AMC.fits') you then reshape it to be 3D. It may actually work to do something like: cube.shape = 27, 328, 247 or some permutation of number that multiply to give you the same final cell count. I am just guessing at what these dimensions are based on the original shape. You may have to manually re-arrange the data if the order gets messed up. If you end up having luck loading it up, please let us know. We are very new to having observational astronomers load up their data, so I can't promise it will be a smooth process, but definitely fun to try out! Cheers, Sam On Wed, Feb 20, 2013 at 6:58 AM, Peter Teuben <teuben@astro.umd.edu> wrote:
On 02/20/2013 06:24 AM, 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: http://bpaste.net/show/78501/
I hope it'll work for you. Cheers, Kacper
I was able to view the data just fine in e.g. ds9, there's nothing wrong with it. ds9 even handles 3D cubes these days. but to me it looks like this data is unsuitable for yt. Perhaps the 984 positions along the Y axis of this fits image can be re-arranged in an RA-DEC grid, and create a real 3D cube, something like a 30 x 30 x 2000, perhaps along the lines Kacper has tried out, but the fits file does not contain this information how to do that, in fact the FITS header is criminally close to being useless. There's no WCS to speak of. More seriously, before interesting things can be seen, the data need to be calibrated. lines extracted, fitted, and you could perhaps see some interesting structures in doppler-velocity space. I would look at IRAF to handle this, they have lots of tools to handle such spectra.
peter
_______________________________________________ yt-users mailing listyt-users@lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
Francisco Ocaña González
-
Kacper Kowalik
-
Peter Teuben
-
Sam Skillman