PrincetonUniversity / Iseult

Python plotting program for Tristan-MP
https://princetonuniversity.github.io/Iseult/
GNU General Public License v3.0
7 stars 7 forks source link

Add Magnetic Streamlines to Field and Density Plots #33

Closed bcaddy closed 1 week ago

bcaddy commented 2 weeks ago

Summary

This PR adds the option to overlay magnetic streamlines (streamplots) over the Field and Density plots. In the respective settings panels for those two plot types there is a new Streamline Settings: section that controls the presence of streamlines along with the following options:

Note

Modifying the opacity of the streamlines is possible. Unfortunately, the StreamplotSet object that matplotlib.axes.Axes.streamplot returns is not as fully featured as returned objects from most other plotting functions. As a result setting the opacity is non-trivial and bears the chance of impacting other elements of the plot, though that is unlikely in this particular application. If there's a need to add an opacity option I can do so.

Cloning Instructions

if you already have that repo cloned locally then

$ cd path/to/bob-iseult
$ git fetch origin
$ git checkout --track origin/master-streamplot

if not

$ git clone git@github.com:bcaddy/Iseult.git bob-iseult
$ cd bob-iseult
$ git checkout --track origin/master-streamplot

Resolves #11

ntoles commented 2 weeks ago

Yes, Python flips Fortran arrays. .

On Fri, Aug 30, 2024 at 10:50 AM bcaddy @.***> wrote:

@.**** commented on this pull request.

In src/streamlines.py https://github.com/PrincetonUniversity/Iseult/pull/33#discussion_r1738843500 :

  • stride = panel.GetPlotParam("streamlines_stride")
  • line_density = panel.GetPlotParam("streamlines_density")
  • line_color = panel.GetPlotParam("streamlines_color")
  • Grab the data, use aliases to make it easier to work with

  • if fields == "bxby":
  • bx_name, by_name = "bx", "by"
  • elif fields == "bybz":
  • bx_name, by_name = "by", "bz"
  • elif fields == "bxbz":
  • bx_name, by_name = "bx", "bz"
  • else:
  • raise ValueError(
  • f"Improper fields value of {fields} passed to draw_streamlines. "
  • )
  • bx = panel.parent.DataDict[bx_name][0, ::stride, ::stride]

Just to clarify, Iseult uses numpy's column major ordering ([x,y,z]) not Fortran's row major ordering right? ([z,y,x]). I now Tristan uses the latter but numpy defaults to the former.

— Reply to this email directly, view it on GitHub https://github.com/PrincetonUniversity/Iseult/pull/33#discussion_r1738843500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASJ7FGWNQSJIC7P5IPYGFDZUCBE5AVCNFSM6AAAAABNLAVFWKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDENZSGYZDANJYGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>