-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add magnetic field example #3058
Conversation
Very nice! When I run your example block locally, I get (beside the plot)
|
I have that occur locally as well. Recommend a follow up to clean this up. Same with the data being between 0-255. That was really frustrating. |
Codecov Report
@@ Coverage Diff @@
## main #3058 +/- ##
=======================================
Coverage 95.74% 95.74%
=======================================
Files 96 96
Lines 20422 20431 +9
=======================================
+ Hits 19553 19562 +9
Misses 869 869 |
Co-authored-by: Andras Deak <adeak@users.noreply.github.com>
This is awesome @akaszynski ! I will have to try this with a more complex model, such as the SEG salt model: https://emsig.xyz/emg3d-gallery/gallery/models/SEG-EAGE_3D_salt_model.html |
How did you store the |
These examples were generated from the following script: If you have a submission, I'd love for them to be stored at pyvista/vtk-data. |
Interesting.
|
I'll have to use that in the future, though a direct tie in with pyvista seems possible if you ever wanted to be able to directly plot the fields. |
That could be cool. Currently I have, consciously, no plotting routines implemented in Besides volume plot would, of course, stream plots be very interesting for electromagnetic fields.
Also cool: https://www.youtube.com/watch?v=EPxNdESwQP0 |
Ended up going with magpylib for now. There were issues with grid alignment with |
Hm. Interesting. |
I'd like to have both. I'll open an issue in |
@prisae, I think my issue is I'm not implementing it correctly. I'll fix it to: grid.write_vtk(
'efield',
models={
'efield_fx': abs(grid.average_edge_x_to_cell * efield.fx.ravel('F')),
'efield_fy': abs(grid.average_edge_y_to_cell * efield.fz.ravel('F')),
'efield_fz': abs(grid.average_edge_z_to_cell * efield.fy.ravel('F')),
},
) Docs are down at the moment, see emsig/emg3d#308. |
That looks good @akaszynski . The fields indeed live on the corresponding edges. So if you want to use them together it is the easiest to move them to cell centers first. |
This will have to miss this release, and I'd like to make sure we get |
Co-authored-by: Tetsuo Koyama <tkoyama010@gmail.com>
…yvista/pyvista into doc/volume_plotting_emag
Recommending splitting this up into two PRs to get this merged. This PR will incorporate the @prisae, if you can get me a vtk dataset that I can use as a vtk file, I'll be able to generate that streamline example. Please post an issue and I can add it. I'm super busy at the moment and can't investigate this further, but I would love to include another example. |
@tkoyama010, would appreciate another review when you get a chance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds two new example datasets generated from emg3d - Minimum working example. @prisae, your stuff is awesome, and I've been wanting to plot magnetic fields for a month now.
ezgif.com-gif-maker.1.mp4
Bonus
add_volume
.Notes
It was entirely not obvious that the scalars had to be between 0 and 255 for this to work. We should either provide more examples or perhaps a warning when the scalars are
np.uint8
, or ideally both. Volumetric plots are too cool to not have this spelled out.