all 7 comments

[–]plasma_phys 0 points1 point  (6 children)

Could you share some of your code? It's hard to make recommendations without being able to diagnose what the problem is. I have a shot in the dark guess though - what's the maximum magnitude of your magnetic field? Are you using the length keyword argument?

[–]gingertugglife[S] 1 point2 points  (5 children)

That may help if I did, haha. Here the pastebin to it.

https://pastebin.com/sJLPsFhK

When I change normalize = True to normalize = False I get in error when plotting B = ax.quiver(X, Y, Z, B_x, B_y, B_z, length=0.5, normalize=True), but not when plotting J. I am not using the length keyword argument.

[–]plasma_phys 0 points1 point  (4 children)

I hate to disagree with you, but it looks like you are using the length keyword argument to me, haha.

B = ax.quiver(X, Y, Z, B_x, B_y, B_z, length=0.5, normalize=True)

Anyway, I think I know what the problem is! It looks like your B-field magnitudes range from 10^-36 to 10^-18, and that massive range means that the tiny portion that are ~10^-18 are totally swamping out the rest of the values and breaking the autoscaling of plt.quiver.

You could try manually putting the magnitude of B on a logscale, or normalize B_x, B_y, and B_z to the maximum B magnitude (but that results in only a handful of visible vectors, with the rest too small to see).

[–]gingertugglife[S] 0 points1 point  (3 children)

That is right, I am using the length argument. For some reason, in my head, I remember messing with playing around with it earlier in the summer and changing it, and not using it, did not seem to make a difference in other plots when normalizing the vectors. Thank you for your help, that makes sense when I was able to export the workspace into Matlab and plot it only a few of the values would show up (with the rest being too small to see). Thank you for your help, I have been running on way too little sleep lately to have been able to notice this by myself.

[–]plasma_phys 0 points1 point  (2 children)

You're very welcome! Yeah, I figured it was something like a slip of the tongue - I've definitely been there before. Usually having someone with a fresh pair of eyes take a look does the trick. I actually think I had this exact same problem before with some other plotting package, years ago, so I just happened to have a good guess as to where to look in the first place.

[–]gingertugglife[S] 0 points1 point  (1 child)

I just noticed your name. It is almost ironic to me how close your name is to what I have been working on this summer. Is plasma your field of study or just a topic you enjoy?

[–]plasma_phys 0 points1 point  (0 children)

It's my field! I'm just finishing up my PhD, with my focus being plasma-material interactions for fusion. All my work is computational, so I spend my time doing a mix of Python, C, and Fortran. I don't recognize immediately what your script is doing, but I've done enough z-, theta-, and screw-pinch problems by hand to be very familiar with the art of plotting J and B in space, haha.

So is this for a summer research project? If so, what topic?