This looks like it would be a welcome addition to the code if someone wants to put it together, but I agree, that at the minimum, we should remove the bad index value returned to the user. Good idea!
On Mon, Nov 23, 2015 at 1:08 PM, Matthew Turk email@example.com wrote:
I have an alternate solution to this problem, which dovetails with the numpy-like operations.
If we were to make a different DerivedQuantity (which MaxLocation and MinLocation could subclass with a prescription that they return x,y,z) that accepted the names of the fields to obtain at the maximum value of a field, this could probably accomplish what you are looking for. This would be equivalent to the .argmax() operation, so you would be able to do:
dd = ds.all_data() dd.argmax("density", ["temperature", "velocity_magnitude"])
and get back the temperature and velocity_magnitude fields at the maximum density.
Would that suffice?
On Sun, Nov 22, 2015 at 4:11 PM, Matthew Turk firstname.lastname@example.org wrote:
I'm not sure that, as it stands, it is possible to get the "index", unless we made the parallel iteration sequential. Perhaps a better solution would be to not return the index value.
On Sun, Nov 22, 2015 at 4:06 PM, Cameron Hummels email@example.com wrote:
New issue 1147: Derived quantities `max_location` and `min_location`
not returning correct index values
Something is going awry in the `max_location` and `min_location`
derived quantities such that they return an incorrect index for where the extrema occur. Here's an example script. I tried correcting the code, but I got caught up in the chunk processing for derived quantities.
#!python import yt import numpy as np ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') ad = ds.all_data() val, index, x, y, z = ad.quantities.max_location('density') print val == ad['density'][int(index)] # false val2 = ad['density'].max() index2 = np.argmax(ad['density']) print val2 == ad['density'][index2] # true print val == val2 # true print index == index2 # false # Thus, something is going awry in the max_location (and the
# derived quantities where it calculates the index values for the
_______________________________________________ yt-dev mailing list firstname.lastname@example.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
yt-dev mailing list email@example.com http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org