Dear yt folks,
I am trying to visualize some RAMSES MHD simulation data. The simulation is for gravitationally collapsing gas looking at star formation. I'm looking to obtain projection and slice plots and then annotate the magnetic fields onto the resulting image.
I'm on Mac OS X 10.9.5
I'm using conda 4.3.18
My version of yt is: 3.3.5-py27_0
and python 2.7.12
All of what I believe is the relevant code:
pf = yt.load('output_00284/info_00284.txt')
sp = pf.h.sphere(part_center, (zoom_width + 0.5, "pc"))
L = sp.quantities.angular_momentum_vector()
p = yt.OffAxisSlicePlot(pf, L, 'density', center=part_center, width =(zoom_width, "pc"))
p.annotate_magnetic_field()
p.save('test.png')
The error:
yt.utilities.exceptions.YTPlotCallbackError: annotate_magnetic_field callback failed with the following error: Could not find field '('all', 'magnetic_field_x')' in info_00284.
If I load the field list for the data set, I can see that the B field data is there, but under 'ramses', not 'all'
('ramses', 'x-Bfield-left'),
('ramses', 'x-Bfield-right'),
('ramses', 'x-velocity'),
('ramses', 'y-Bfield-left'),
('ramses', 'y-Bfield-right'),
('ramses', 'y-velocity'),
('ramses', 'z-Bfield-left'),
('ramses', 'z-Bfield-right'),
Is there a way to pass these fields to annotate_magnetic_field? Or a manner in which I can have this information load in the field ('all', 'magnetic_field_')
I should also note that I can create and save the plots with no issues, so long as I do not try to annotate the magnetic fields.
Cheers, Daniel Murray Graduate student at University of Wisconsin Milwaukee
On Tue, May 23, 2017 at 12:59 PM, Daniel William Murray dwmurray@uwm.edu wrote:
Dear yt folks,
I am trying to visualize some RAMSES MHD simulation data. The simulation is for gravitationally collapsing gas looking at star formation. I'm looking to obtain projection and slice plots and then annotate the magnetic fields onto the resulting image.
I'm on Mac OS X 10.9.5
I'm using conda 4.3.18
My version of yt is: 3.3.5-py27_0
and python 2.7.12
All of what I believe is the relevant code:
pf = yt.load('output_00284/info_00284.txt')
sp = pf.h.sphere(part_center, (zoom_width + 0.5, "pc"))
L = sp.quantities.angular_momentum_vector()
p = yt.OffAxisSlicePlot(pf, L, 'density', center=part_center, width = (zoom_width, "pc"))
p.annotate_magnetic_field()
p.save('test.png')
The error:
yt.utilities.exceptions.YTPlotCallbackError: annotate_magnetic_field callback failed with the following error: Could not find field '('all', 'magnetic_field_x')' in info_00284.
If I load the field list for the data set, I can see that the B field data is there, but under 'ramses', not 'all'
('ramses', 'x-Bfield-left'),
('ramses', 'x-Bfield-right'),
('ramses', 'x-velocity'),
('ramses', 'y-Bfield-left'),
('ramses', 'y-Bfield-right'),
('ramses', 'y-velocity'),
('ramses', 'z-Bfield-left'),
('ramses', 'z-Bfield-right'),
Is there a way to pass these fields to annotate_magnetic_field? Or a manner in which I can have this information load in the field ('all', 'magnetic_field_')
Hi Daniel,
You can't use annotate_magnetic_field for this (at least right now, there are some fixes we could make to the Ramses frontend to make this work, see below), since the "universal" yt field names for the magnetic field are not defined for your dataset. That said, annotate_magnetic_field is just a thin wrapper around annotate_quiver and annotate_cquiver (the former is for axis-aligned slices, the latter for off-axis slices). We can use that fact to make a workaround for your issue.
To get this to work you will first need to define the x and y components of the magnetic field in the plane of the off-axis slice. Next, once this field is defined, you will need to call plot.annotate_cquiver() (the version of the quiver callback that works with "cutting" planes, e.g. off-axis slices:
plot.annotate_cquiver('cutting_magx', 'cutting_magy')
You will need to define these two fields based on your x, y, and z B-field fields.
If these field names are "standard" field names for the magnetic field in Ramses simulations, then you could add these fields to the known_other_fields tuple defined on the RAMSESFieldInfo class. It's very likely we would accept this change if you made a pull request on github.
Hope that this clears things up,
Nathan
>
I should also note that I can create and save the plots with no issues, so long as I do not try to annotate the magnetic fields.
Cheers, Daniel Murray Graduate student at University of Wisconsin Milwaukee
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org