[yt-users] ProfileND binning
bh11e
bh11e at my.fsu.edu
Sun Apr 17 15:47:14 PDT 2016
Hi,
I'm creating 1D profiles with as much bins as the top grid zones along the same axis:
ProfilePlot( ds.all_data(), 'z', field_name, weight_field=weight_field_name,
x_log=False, y_log={field_name:False},
n_bins=ds.domain_dimensions[2] )
i.e. each bin should include a 1-zone thick slice of the top grid. All profiles created this way end up with the first and the last bins equal to zero. Am I not doing something wrong? Or is it because the bins' boundaries are created to be centered on the grid zones, This way the end grid zones fall on a bin boundary and are being filtered by the following lines :
profiles.py:
class ProfileND:
...
def _filter(self, bin_fields):
...
for (mi, ma), data in zip(self.bounds, bin_fields):
filter &= (data > mi)
filter &= (data < ma)
...
The rightmost zone seems to be filtered out a second time by the np.digitize call in the following code:
profiles.py:
class Profile1D:
....
def _bin_chunk(self, chunk, fields, storage):
...
bin_ind = np.digitize(bf_x, self.x_bins) - 1
...
Above the 'right' argument to digitize is not being set and defaults to False (see: http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.digitize.html)
My solution was to modify the "mi" and "ma" values (in the first code snippet) to match the grid left and right edges but that of course is a workaround only for this particular case. Any thoughts?
Thanks,
--Boyan Hristov
More information about the yt-users
mailing list