<div dir="ltr">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!</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 23, 2015 at 1:08 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have an alternate solution to this problem, which dovetails with the<br>
numpy-like operations.<br>
<br>
If we were to make a different DerivedQuantity (which MaxLocation and<br>
MinLocation could subclass with a prescription that they return x,y,z)<br>
that accepted the names of the fields to obtain at the maximum value<br>
of a field, this could probably accomplish what you are looking for.<br>
This would be equivalent to the .argmax() operation, so you would be<br>
able to do:<br>
<br>
dd = ds.all_data()<br>
dd.argmax("density", ["temperature", "velocity_magnitude"])<br>
<br>
and get back the temperature and velocity_magnitude fields at the<br>
maximum density.<br>
<br>
Would that suffice?<br>
<div class="HOEnZb"><div class="h5"><br>
On Sun, Nov 22, 2015 at 4:11 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
> I'm not sure that, as it stands, it is possible to get the "index",<br>
> unless we made the parallel iteration sequential.  Perhaps a better<br>
> solution would be to not return the index value.<br>
><br>
> On Sun, Nov 22, 2015 at 4:06 PM, Cameron Hummels<br>
> <<a href="mailto:issues-reply@bitbucket.org">issues-reply@bitbucket.org</a>> wrote:<br>
>> New issue 1147: Derived quantities `max_location` and `min_location` not returning correct index values<br>
>> <a href="https://bitbucket.org/yt_analysis/yt/issues/1147/derived-quantities-max_location-and" rel="noreferrer" target="_blank">https://bitbucket.org/yt_analysis/yt/issues/1147/derived-quantities-max_location-and</a><br>
>><br>
>> Cameron Hummels:<br>
>><br>
>> 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.<br>
>><br>
>><br>
>> ```<br>
>> #!python<br>
>><br>
>> import yt<br>
>> import numpy as np<br>
>><br>
>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')<br>
>> ad = ds.all_data()<br>
>> val, index, x, y, z = ad.quantities.max_location('density')<br>
>> print val == ad['density'][int(index)]  # false<br>
>><br>
>> val2 = ad['density'].max()<br>
>> index2 = np.argmax(ad['density'])<br>
>> print val2 == ad['density'][index2] # true<br>
>><br>
>> print val == val2 # true<br>
>> print index == index2 # false<br>
>><br>
>> # Thus, something is going awry in the max_location (and the min_location)<br>
>> # derived quantities where it calculates the index values for the extrema<br>
>> ```<br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> yt-dev mailing list<br>
>> <a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Cameron Hummels<div><span style="font-size:12.8000001907349px">NSF Postdoctoral Fellow</span></div><div><span style="font-size:12.8000001907349px">Department of Astronomy</span></div><div><span style="font-size:12.8000001907349px">California Institute of Technology</span><br></div><div><a href="http://chummels.org" style="font-size:12.8000001907349px" target="_blank">http://chummels.org</a><br></div></div></div></div>
</div>