yt-project / yt

Main yt repository
http://yt-project.org
Other
455 stars 272 forks source link

Orion ghot zones not generating correctly #414

Closed yt-fido closed 7 years ago

yt-fido commented 11 years ago

Originally reported by: astrofrog (Bitbucket: astrofrog, GitHub: astrofrog)


When trying to make an all-sky column density map following the example in the docs, I get an exception. My script is:

#!python

from yt.mods import load
import yt.visualization.volume_rendering.camera as camera

pf = load('models/plt01096')
Nside = 32
cam = camera.HEALpixCamera([0., 0., 0.], 0.2, Nside, pf=pf, log_fields=[False])
bitmap = cam.snapshot()

and the exception is

  File "allsky.py", line 7, in <module>
    bitmap = cam.snapshot()
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.4dev-py2.7-macosx-10.7-x86_64.egg/yt/visualization/volume_rendering/camera.py", line 669, in snapshot
    self.volume.initialize_source()
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.4dev-py2.7-macosx-10.7-x86_64.egg/yt/utilities/amr_kdtree/amr_kdtree.py", line 668, in initialize_source
    vcd = current_node.grid.get_vertex_centered_data(field,smoothed=True,no_ghost=self.no_ghost).astype('float64')
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.4dev-py2.7-macosx-10.7-x86_64.egg/yt/data_objects/grid_patch.py", line 495, in get_vertex_centered_data
    na.add(new_field, cg[field][1: ,1: ,1: ], new_field)
ValueError: operands could not be broadcast together with shapes (25,25,25) (26,25,25) (25,25,25) 

yt-fido commented 9 years ago

Original comment by chummels (Bitbucket: chummels, GitHub: chummels):


Removing milestone: 2.4 (automated comment)

yt-fido commented 11 years ago

Original comment by astrofrog (Bitbucket: astrofrog, GitHub: astrofrog):


@MatthewTurk - sorry for the delay in getting back to you! I just updated to the latest version, and the code above that used to fail works properly now, so this can be closed.

yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Hi Tom,

Can you check, now that Andrew Myers ( @atmyers ) has taken a shot at addressing this?

https://bitbucket.org/yt_analysis/yt/pull-request/275/reading-in-dds-for-each-grid-from-the

-Matt

yt-fido commented 11 years ago

Original comment by astrofrog (Bitbucket: astrofrog, GitHub: astrofrog):


I changed the name of the simulation to the problematic one and ran the script. The issue is that there is a length limit for pastebin, so it only goes to ~1000 lines. I'll email you the full file.

http://paste.yt-project.org/show/2641/

yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Tom, could you run this script and pastebin the output?

http://paste.yt-project.org/show/2639/

yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Hi Tom,

Okay, thanks -- the issue is the ghost zone generation. The faster way to get this problem to arrive would be to find the grid in question and call "retrieve_ghost_zones" on it. This usually shows up because of floating point roundoff errors shifting the size of the field during the cascading refinement from lower levels. I'm not able to replicate this on the Orion test data we have here, so I will follow up with the Orion frontend coordinator to see if he can replicate it.

yt-fido commented 11 years ago

Original comment by astrofrog (Bitbucket: astrofrog, GitHub: astrofrog):


I just tried updating to the latest version and I'm getting the same exception. The exact version I'm using is:

$ hg summary
parent: 6221:76eb9d59b2ec tip

and the exception is:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    bitmap = cam.snapshot()
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.5dev-py2.7-macosx-10.7-x86_64.egg/yt/visualization/volume_rendering/camera.py", line 816, in snapshot
    self.volume.initialize_source()
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.5dev-py2.7-macosx-10.7-x86_64.egg/yt/utilities/amr_kdtree/amr_kdtree.py", line 670, in initialize_source
    vcd = current_node.grid.get_vertex_centered_data(field,smoothed=True,no_ghost=self.no_ghost).astype('float64')
  File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.5dev-py2.7-macosx-10.7-x86_64.egg/yt/data_objects/grid_patch.py", line 492, in get_vertex_centered_data
    na.add(new_field, cg[field][1: ,1: ,1: ], new_field)
ValueError: operands could not be broadcast together with shapes (25,25,25) (26,25,25) (25,25,25) 
yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Ah, right, it isn't embedded in it if installed as opposed to developed. Well, hopefully it is all cleared up in the development branch -- if this continues to be a problem after the next time you upgrade, please ping again and we'll address it ASAP. Thanks!

yt-fido commented 11 years ago

Original comment by astrofrog (Bitbucket: astrofrog, GitHub: astrofrog):


Here's the version/path information:

$ yt instinfo

yt module located at:
    /Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/yt-2.4dev-py2.7-macosx-10.7-x86_64.egg
yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Great, glad to hear it. If you do get a chance to check the version, that'd be greatly appreciated. The ghost zone generation code has been a sore spot for a bit, and I'd like to know if it's what's currently in the dev branch.

yt-fido commented 11 years ago

Original comment by astrofrog (Bitbucket: astrofrog, GitHub: astrofrog):


Thanks! The no_ghost=True workaround worked.

yt-fido commented 11 years ago

Original comment by Matt Turk (Bitbucket: MatthewTurk, GitHub: MatthewTurk):


Hi Tom, thanks for reporting this. The issue looks like it's actually with how vertex-centered data are obtained. A quick fix would be to specify no_ghost = True to your instantiation of the camera. Which version of the code are you running? (yt instinfo)