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

Cameron Hummels issues-reply at bitbucket.org
Sun Nov 22 14:06:56 PST 2015


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
```







More information about the yt-dev mailing list