magnetic fields with particle data
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
All, I have output from an SPH code including magnetic fields for each particle. I see there are no specific fields for MHD data related to particles. For example, I have data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag } and then want to plot mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc')) But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ? Siegfried
![](https://secure.gravatar.com/avatar/519d491fa9fe7dfd0caf0f0a9c2ca61e.jpg?s=120&d=mm&r=g)
Hi Siegfried, This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function. I think if you access the field as ('io', 'magnetic_field_divergence'), It should work. By the way, are you using the yt-4.0 branch for this? You probably should in this case. Best, John ZuHone From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> Sent: Tuesday, May 26, 2020 10:58 AM To: yt-users@python.org Subject: [yt-users] magnetic fields with particle data All, I have output from an SPH code including magnetic fields for each particle. I see there are no specific fields for MHD data related to particles. For example, I have data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag } and then want to plot mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc')) But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ? Siegfried
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
I was Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
I was able to upgrade to version 3.6.0 using pip install yt --upgrade. The code returns a message: SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields: [('io', 'magnetic_field_divergence')] Did you mean to use ParticlePlot or plot a deposited particle field instead? I think it should be 'deposit'. Siegfried Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was
Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
![](https://secure.gravatar.com/avatar/519d491fa9fe7dfd0caf0f0a9c2ca61e.jpg?s=120&d=mm&r=g)
So what you’re doing is probably better done with yt-4.0. The main difference is that in yt 3.x we handle SPH data by depositing fields onto an octree mesh, but I doubt that this is a good way to visualize magnetic field data. In yt-4.0 we handle SPH data at the particle level without the deposition. I would recommend cloning yt from github at http://github.com/yt-project/yt and installing using the yt-4.0 branch. If you need help with this, let us know! From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> Reply-To: Discussion of the yt analysis package <yt-users@python.org> Date: Tuesday, May 26, 2020 at 11:41 AM To: Discussion of the yt analysis package <yt-users@python.org> Subject: [yt-users] Re: magnetic fields with particle data I was able to upgrade to version 3.6.0 using pip install yt --upgrade. The code returns a message: SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields: [('io', 'magnetic_field_divergence')] Did you mean to use ParticlePlot or plot a deposited particle field instead? I think it should be 'deposit'. Siegfried Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>>: I was Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com<mailto:jzuhone@gmail.com>>: Hi Siegfried, This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function. I think if you access the field as ('io', 'magnetic_field_divergence'), It should work. By the way, are you using the yt-4.0 branch for this? You probably should in this case. Best, John ZuHone From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>> Sent: Tuesday, May 26, 2020 10:58 AM To: yt-users@python.org<mailto:yt-users@python.org> Subject: [yt-users] magnetic fields with particle data All, I have output from an SPH code including magnetic fields for each particle. I see there are no specific fields for MHD data related to particles. For example, I have data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag } and then want to plot mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc')) But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ? Siegfried _______________________________________________ yt-users mailing list -- yt-users@python.org<mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org<mailto:yt-users-leave@python.org> https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
I can indeed use some help in how to obtain the yt-4.0 branch. If I install it a conda environment, will I get it automatically ? Siegfried Op di 26 mei 2020 om 17:55 schreef John Zuhone <jzuhone@gmail.com>:
So what you’re doing is probably better done with yt-4.0. The main difference is that in yt 3.x we handle SPH data by depositing fields onto an octree mesh, but I doubt that this is a good way to visualize magnetic field data. In yt-4.0 we handle SPH data at the particle level without the deposition.
I would recommend cloning yt from github at http://github.com/yt-project/yt and installing using the yt-4.0 branch. If you need help with this, let us know!
*From: *Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Reply-To: *Discussion of the yt analysis package <yt-users@python.org> *Date: *Tuesday, May 26, 2020 at 11:41 AM *To: *Discussion of the yt analysis package <yt-users@python.org> *Subject: *[yt-users] Re: magnetic fields with particle data
I was able to upgrade to version 3.6.0 using pip install yt --upgrade.
The code returns a message:
SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields:
[('io', 'magnetic_field_divergence')]
Did you mean to use ParticlePlot or plot a deposited particle field instead?
I think it should be 'deposit'.
Siegfried
Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was
Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
![](https://secure.gravatar.com/avatar/519d491fa9fe7dfd0caf0f0a9c2ca61e.jpg?s=120&d=mm&r=g)
Hi Siegfried, I would try this method: pip install numpy Cython pip install git+https://github.com/yt-project/yt@yt-4.0 Best, John From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> Reply-To: Discussion of the yt analysis package <yt-users@python.org> Date: Tuesday, May 26, 2020 at 12:17 PM To: Discussion of the yt analysis package <yt-users@python.org> Subject: [yt-users] Re: magnetic fields with particle data I can indeed use some help in how to obtain the yt-4.0 branch. If I install it a conda environment, will I get it automatically ? Siegfried Op di 26 mei 2020 om 17:55 schreef John Zuhone <jzuhone@gmail.com<mailto:jzuhone@gmail.com>>: So what you’re doing is probably better done with yt-4.0. The main difference is that in yt 3.x we handle SPH data by depositing fields onto an octree mesh, but I doubt that this is a good way to visualize magnetic field data. In yt-4.0 we handle SPH data at the particle level without the deposition. I would recommend cloning yt from github at http://github.com/yt-project/yt and installing using the yt-4.0 branch. If you need help with this, let us know! From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>> Reply-To: Discussion of the yt analysis package <yt-users@python.org<mailto:yt-users@python.org>> Date: Tuesday, May 26, 2020 at 11:41 AM To: Discussion of the yt analysis package <yt-users@python.org<mailto:yt-users@python.org>> Subject: [yt-users] Re: magnetic fields with particle data I was able to upgrade to version 3.6.0 using pip install yt --upgrade. The code returns a message: SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields: [('io', 'magnetic_field_divergence')] Did you mean to use ParticlePlot or plot a deposited particle field instead? I think it should be 'deposit'. Siegfried Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>>: I was Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com<mailto:jzuhone@gmail.com>>: Hi Siegfried, This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function. I think if you access the field as ('io', 'magnetic_field_divergence'), It should work. By the way, are you using the yt-4.0 branch for this? You probably should in this case. Best, John ZuHone From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>> Sent: Tuesday, May 26, 2020 10:58 AM To: yt-users@python.org<mailto:yt-users@python.org> Subject: [yt-users] magnetic fields with particle data All, I have output from an SPH code including magnetic fields for each particle. I see there are no specific fields for MHD data related to particles. For example, I have data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag } and then want to plot mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc')) But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ? Siegfried _______________________________________________ yt-users mailing list -- yt-users@python.org<mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org<mailto:yt-users-leave@python.org> https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com> _______________________________________________ yt-users mailing list -- yt-users@python.org<mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org<mailto:yt-users-leave@python.org> https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com<mailto:siegfriedvanaverbeke@gmail.com>
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
The installation works well in this way. Siegfried Op wo 27 mei 2020 om 03:41 schreef John Zuhone <jzuhone@gmail.com>:
Hi Siegfried,
I would try this method:
pip install numpy Cython pip install git+https://github.com/yt-project/yt@yt-4.0
Best,
John
*From: *Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Reply-To: *Discussion of the yt analysis package <yt-users@python.org> *Date: *Tuesday, May 26, 2020 at 12:17 PM *To: *Discussion of the yt analysis package <yt-users@python.org> *Subject: *[yt-users] Re: magnetic fields with particle data
I can indeed use some help in how to obtain the yt-4.0 branch. If I install it a conda environment, will I get it automatically ?
Siegfried
Op di 26 mei 2020 om 17:55 schreef John Zuhone <jzuhone@gmail.com>:
So what you’re doing is probably better done with yt-4.0. The main difference is that in yt 3.x we handle SPH data by depositing fields onto an octree mesh, but I doubt that this is a good way to visualize magnetic field data. In yt-4.0 we handle SPH data at the particle level without the deposition.
I would recommend cloning yt from github at http://github.com/yt-project/yt and installing using the yt-4.0 branch. If you need help with this, let us know!
*From: *Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Reply-To: *Discussion of the yt analysis package <yt-users@python.org> *Date: *Tuesday, May 26, 2020 at 11:41 AM *To: *Discussion of the yt analysis package <yt-users@python.org> *Subject: *[yt-users] Re: magnetic fields with particle data
I was able to upgrade to version 3.6.0 using pip install yt --upgrade.
The code returns a message:
SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields:
[('io', 'magnetic_field_divergence')]
Did you mean to use ParticlePlot or plot a deposited particle field instead?
I think it should be 'deposit'.
Siegfried
Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was
Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
Is there a tutorial on using the yt-4.0 version for visualizing particle based data ? Siegfried Op wo 27 mei 2020 om 17:08 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
The installation works well in this way.
Siegfried
Op wo 27 mei 2020 om 03:41 schreef John Zuhone <jzuhone@gmail.com>:
Hi Siegfried,
I would try this method:
pip install numpy Cython pip install git+https://github.com/yt-project/yt@yt-4.0
Best,
John
*From: *Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Reply-To: *Discussion of the yt analysis package <yt-users@python.org> *Date: *Tuesday, May 26, 2020 at 12:17 PM *To: *Discussion of the yt analysis package <yt-users@python.org> *Subject: *[yt-users] Re: magnetic fields with particle data
I can indeed use some help in how to obtain the yt-4.0 branch. If I install it a conda environment, will I get it automatically ?
Siegfried
Op di 26 mei 2020 om 17:55 schreef John Zuhone <jzuhone@gmail.com>:
So what you’re doing is probably better done with yt-4.0. The main difference is that in yt 3.x we handle SPH data by depositing fields onto an octree mesh, but I doubt that this is a good way to visualize magnetic field data. In yt-4.0 we handle SPH data at the particle level without the deposition.
I would recommend cloning yt from github at http://github.com/yt-project/yt and installing using the yt-4.0 branch. If you need help with this, let us know!
*From: *Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Reply-To: *Discussion of the yt analysis package <yt-users@python.org> *Date: *Tuesday, May 26, 2020 at 11:41 AM *To: *Discussion of the yt analysis package <yt-users@python.org> *Subject: *[yt-users] Re: magnetic fields with particle data
I was able to upgrade to version 3.6.0 using pip install yt --upgrade.
The code returns a message:
SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields:
[('io', 'magnetic_field_divergence')]
Did you mean to use ParticlePlot or plot a deposited particle field instead?
I think it should be 'deposit'.
Siegfried
Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was
Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
![](https://secure.gravatar.com/avatar/9c814bb0cc7b822c6370860beeb5437e.jpg?s=120&d=mm&r=g)
Also this doesn't work. Siegfried Op di 26 mei 2020 om 17:57 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was able to upgrade to version 3.6.0 using pip install yt --upgrade. The code returns a message:
SlicePlot, ProjectionPlot, and OffAxisProjectionPlot can only plot fields that are defined on a mesh, but received the following particle fields:
[('io', 'magnetic_field_divergence')]
Did you mean to use ParticlePlot or plot a deposited particle field instead?
I think it should be 'deposit'.
Siegfried
Op di 26 mei 2020 om 17:55 schreef Siegfried Vanaverbeke < siegfriedvanaverbeke@gmail.com>:
I was
Op di 26 mei 2020 om 17:19 schreef <jzuhone@gmail.com>:
Hi Siegfried,
This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function.
I think if you access the field as ('io', 'magnetic_field_divergence'), It should work.
By the way, are you using the yt-4.0 branch for this? You probably should in this case.
Best,
John ZuHone
*From:* Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> *Sent:* Tuesday, May 26, 2020 10:58 AM *To:* yt-users@python.org *Subject:* [yt-users] magnetic fields with particle data
All,
I have output from an SPH code including magnetic fields for each particle.
I see there are no specific fields for MHD data related to particles. For example, I have
data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag }
and then want to plot
mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc'))
But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ?
Siegfried _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: siegfriedvanaverbeke@gmail.com
participants (3)
-
John Zuhone
-
jzuhone@gmail.com
-
Siegfried Vanaverbeke