Average between two values?

Hey everyone,
I would like to calculate the average metallically between two temperature values. IE... the average metallicity between T = 200 K and T = 1000 K. Is there a way to do this? Thanks!

Hi Joseph,
You can use a cut region to create an object with that temperature range and then calculate the average quantity from that.
http://yt-project.org/docs/dev/analyzing/filtering.html?highlight=cut%20regi...
Thanks, John
On 2/5/19 10:44 AM, Joseph Smidt wrote:
Hey everyone,
I would like to calculate the average metallically between two temperature values. IE... the average metallicity between T = 200 K and T = 1000 K. Is there a way to do this? Thanks!
--
Joseph Smidt <josephsmidt@gmail.com mailto:josephsmidt@gmail.com>
Theoretical Division P.O. Box 1663, Mail Stop B283 Los Alamos, NM 87545 Office: 505-665-9752 Fax: 505-667-1931
yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org

How about something like this:
In [1]: import yt ...: ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
In [2]: reg = ds.cut_region(ds.all_data(), "np.logical_and(obj['temperature'] < 1e5, obj['temperature'] > 1e4)")
In [3]: reg['temperature'].min() Out[3]: 10000.001953125 K
In [4]: reg['temperature'].max() Out[4]: 99975.84375 K
In [5]: reg['metallicity'].mean() Out[5]: 0.010114664953242768 Zsun
On Tue, Feb 5, 2019 at 9:43 AM Joseph Smidt josephsmidt@gmail.com wrote:
Hey everyone,
I would like to calculate the average metallically between two
temperature values. IE... the average metallicity between T = 200 K and T = 1000 K. Is there a way to do this? Thanks!
--
Joseph Smidt josephsmidt@gmail.com
Theoretical Division P.O. Box 1663, Mail Stop B283 Los Alamos, NM 87545 Office: 505-665-9752 Fax: 505-667-1931 _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org

Thanks everyone! This will work.
On Tue, Feb 5, 2019 at 8:57 AM Nathan Goldbaum nathan12343@gmail.com wrote:
How about something like this:
In [1]: import yt ...: ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
In [2]: reg = ds.cut_region(ds.all_data(), "np.logical_and(obj['temperature'] < 1e5, obj['temperature'] > 1e4)")
In [3]: reg['temperature'].min() Out[3]: 10000.001953125 K
In [4]: reg['temperature'].max() Out[4]: 99975.84375 K
In [5]: reg['metallicity'].mean() Out[5]: 0.010114664953242768 Zsun
On Tue, Feb 5, 2019 at 9:43 AM Joseph Smidt josephsmidt@gmail.com wrote:
Hey everyone,
I would like to calculate the average metallically between two
temperature values. IE... the average metallicity between T = 200 K and T = 1000 K. Is there a way to do this? Thanks!
--
Joseph Smidt josephsmidt@gmail.com
Theoretical Division P.O. Box 1663, Mail Stop B283 Los Alamos, NM 87545 Office: 505-665-9752 Fax: 505-667-1931 _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (3)
-
Joseph Smidt
-
Nathan Goldbaum
-
Wise, John H