yt streamlines and periodic boundaries
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. ]
Looking at the source code I don't think yt's streamline finder does any
periodic corrections. In principle it could but someone would need to make
the necessary modifications. If you're interested in doing that I think it
would be a valuable improvement.
If you're just looking to get whatever analysis task that you were trying
to do finished, then yes I think you might need to periodically mirror your
dataset.
-Nathan
On Thu, Mar 14, 2019 at 9:11 AM Yann Pfau-Kempf
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. ] _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Thanks for your quick response. I will first work around but I'll be in touch if I or someone else in our group gets to try and modify the source for this feature. Best regards, Yann On 14/03/2019 16:31, Nathan Goldbaum wrote:
Looking at the source code I don't think yt's streamline finder does any periodic corrections. In principle it could but someone would need to make the necessary modifications. If you're interested in doing that I think it would be a valuable improvement.
If you're just looking to get whatever analysis task that you were trying to do finished, then yes I think you might need to periodically mirror your dataset.
-Nathan
On Thu, Mar 14, 2019 at 9:11 AM Yann Pfau-Kempf
mailto:yann.kempf@helsinki.fi> wrote: 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. ]
_______________________________________________ yt-users mailing list -- yt-users@python.org mailto:yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org mailto:yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Nathan Goldbaum
-
Yann Pfau-Kempf