Hello,
I am a new user of yt and I am specifically trying to use its streamline
capabilities. My script essentially does the same as the example below,
i.e. I load some data from numpy arrays and trace streamlines from a set
of seeds. It turns out that despite being set to being fully periodic
(the only option, otherwise yt tries to access data outside of the box)
the streamlines stop at the box edges.
Is there a trick to get actually periodic streamlines? Or should I work
around, replicate my array N times in each direction and fold the
coordinates to the original range afterwards by hand?
Thanks in advance for your help,
Best regards,
Yann Pfau-Kempf
University of Helsinki
------------------------------------------------------------------------
streamlength=30
Bx=np.ones((10,10,10))
By=np.ones((10,10,10))
Bz=np.ones((10,10,10))
data=dict(Bx=Bx,By=By,Bz=Bz)
streamline_seeds = np.array([0,0,0])
yt_dataset = yt.frontends.stream.load_uniform_grid(
data,
[10, 10, 10],
bbox=np.array([[0,10],
[0, 10],
[0, 10]]),
periodicity=[True, True, True])
streamlines_pos = yt.visualization.api.Streamlines(yt_dataset,
streamline_seeds, "Bx", "By", "Bz", length=streamlength, direction=1)
streamlines_neg = yt.visualization.api.Streamlines(yt_dataset,
streamline_seeds, "Bx", "By", "Bz", length=streamlength, direction=-1)
print streamlines_pos.streamlines[0], streamlines_neg.streamlines[0]
Output:
[[ 0. 0. 0. ]
[ 0.55872607 0.55872607 0.55872607]
[ 1.11745213 1.11745213 1.11745213]
[ 1.6761782 1.6761782 1.6761782 ]
[ 2.23490427 2.23490427 2.23490427]
[ 2.79363033 2.79363033 2.79363033]
[ 3.3523564 3.3523564 3.3523564 ]
[ 3.91108247 3.91108247 3.91108247]
[ 4.46980854 4.46980854 4.46980854]
[ 5.0285346 5.0285346 5.0285346 ]
[ 5.58726067 5.58726067 5.58726067]
[ 6.14598674 6.14598674 6.14598674]
[ 6.7047128 6.7047128 6.7047128 ]
[ 7.26343887 7.26343887 7.26343887]
[ 7.82216494 7.82216494 7.82216494]
[ 8.380891 8.380891 8.380891 ]
[ 8.93961707 8.93961707 8.93961707]
[ 9.49834314 9.49834314 9.49834314]
[10.05706921 10.05706921 10.05706921]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. 0. ]] code_length [[ 0. 0.
0. ]