[yt-dev] Issue #1147: Derived quantities `max_location` and `min_location` not returning correct index values (yt_analysis/yt)

Matthew Turk matthewturk at gmail.com
Sun Nov 22 14:11:10 PST 2015


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
<issues-reply at bitbucket.org> wrote:
> New issue 1147: Derived quantities `max_location` and `min_location` not returning correct index values
> https://bitbucket.org/yt_analysis/yt/issues/1147/derived-quantities-max_location-and
>
> Cameron Hummels:
>
> 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 min_location)
> # derived quantities where it calculates the index values for the extrema
> ```
>
>
>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



More information about the yt-dev mailing list