Closed bcaddy closed 1 week 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: @.***>
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:Stride:
controls the subsampling of the data plotted. The magnetic fields are subsampled with a stride, default 10, to speed up plotting. Settingstride=1
turns off subsampling. In my testing, a stride of 1 took 10-15s to plot and a stride of 10 took 300-400ms. Increasing the stride past 10 did not yield significant improvements though this will likely vary by datasetLine Density
controls the density of streamlines plotted, defaults to 1Line Color
sets the color of the streamline. Any color string that matplotlib would normally expect should workNote
Modifying the opacity of the streamlines is possible. Unfortunately, the
StreamplotSet
object thatmatplotlib.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
if not
Resolves #11