[yt-dev] Issue #1340: create_profile returns zero-value profile when input field is negative (yt_analysis/yt)
Suoqing Ji
issues-reply at bitbucket.org
Tue Mar 28 01:23:55 PDT 2017
New issue 1340: create_profile returns zero-value profile when input field is negative
https://bitbucket.org/yt_analysis/yt/issues/1340/create_profile-returns-zero-value-profile
Suoqing Ji:
The test script generates a particle dataset with negative velocities. Velocity profile created from this dataset is zero. This also causes problems in ``ParticlePlot``.
```
#!python
import yt
import numpy as np
n_particles = int(1e4)
ppx, ppy, ppz = np.random.normal(size=[3, n_particles])
pvx, pvy, pvz = - np.ones((3, n_particles))
data = {'particle_position_x': ppx,
'particle_position_y': ppy,
'particle_position_z': ppz,
'particle_velocity_x': pvx,
'particle_velocity_y': pvy,
'particle_velocity_z': pvz}
bbox = 1.1*np.array([[min(ppx), max(ppx)], [min(ppy), max(ppy)], [min(ppz), max(ppz)]])
ds = yt.load_particles(data, bbox=bbox)
ad = ds.all_data()
print (ad['particle_velocity_x'].max(),
ad['particle_velocity_x'].min())
profile = yt.create_profile(ad,
["particle_position_x", "particle_position_y"],
"particle_velocity_x",
weight_field=None)
print (profile["particle_velocity_x"].max(),
profile["particle_velocity_x"].min())
```
More information about the yt-dev
mailing list