[yt-svn] commit/yt: atmyers: Merged in MatthewTurk/yt (pull request #2205)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 15 11:33:08 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/9bcee915d549/
Changeset:   9bcee915d549
Branch:      yt
User:        atmyers
Date:        2016-06-15 18:32:53+00:00
Summary:     Merged in MatthewTurk/yt (pull request #2205)

Only add OWLS/EAGLE ion fields if they are present.  Closes #1085.
Affected #:  3 files

diff -r 8308ef0bf6d6c8bef092842a4eeb3f4734416cff -r 9bcee915d549eb251157fbe2b82c5b5e8fb783b9 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -90,6 +90,10 @@
                        particle_type = particle_type,
                        units = unit_system["number_density"])
 
+    return [(ftype, "%s_number_density" % species),
+            (ftype, "%s_density" % species),
+            (ftype, "%s_mass" % species)]
+
 def add_species_field_by_fraction(registry, ftype, species, 
                                   particle_type = False):
     """
@@ -114,6 +118,10 @@
                        particle_type = particle_type,
                        units = unit_system["number_density"])
 
+    return [(ftype, "%s_number_density" % species),
+            (ftype, "%s_density" % species),
+            (ftype, "%s_mass" % species)]
+
 def add_species_aliases(registry, ftype, alias_species, species):
     """
     This takes a field registry, a fluid type, and two species names.  

diff -r 8308ef0bf6d6c8bef092842a4eeb3f4734416cff -r 9bcee915d549eb251157fbe2b82c5b5e8fb783b9 yt/frontends/eagle/tests/test_outputs.py
--- a/yt/frontends/eagle/tests/test_outputs.py
+++ b/yt/frontends/eagle/tests/test_outputs.py
@@ -24,3 +24,10 @@
 @requires_file(s28)
 def test_EagleDataset():
     assert isinstance(data_dir_load(s28), EagleDataset)
+
+s399 = "snipshot_399_z000p000/snip_399_z000p000.0.hdf5"
+ at requires_file(s399)
+def test_Snipshot():
+    ds = data_dir_load(s399)
+    ds.index
+    assert isinstance(ds, EagleDataset)

diff -r 8308ef0bf6d6c8bef092842a4eeb3f4734416cff -r 9bcee915d549eb251157fbe2b82c5b5e8fb783b9 yt/frontends/owls/fields.py
--- a/yt/frontends/owls/fields.py
+++ b/yt/frontends/owls/fields.py
@@ -76,8 +76,6 @@
 
         smoothed_suffixes = ("_number_density", "_density", "_mass")
 
-
-
         # we add particle element fields for stars and gas
         #-----------------------------------------------------
         if ptype in self._add_elements:
@@ -144,6 +142,9 @@
                     symbol = ion[0:1].capitalize()
                     roman = int(ion[1:])
 
+                if (ptype, symbol + "_fraction") not in self.field_aliases:
+                    continue
+
                 pstr = "_p" + str(roman-1)
                 yt_ion = symbol + pstr
 
@@ -166,6 +167,9 @@
                     symbol = ion[0:1].capitalize()
                     roman = int(ion[1:])
 
+                if (ptype, symbol + "_fraction") not in self.field_aliases:
+                    continue
+
                 pstr = "_p" + str(roman-1)
                 yt_ion = symbol + pstr
 
@@ -201,6 +205,9 @@
                 symbol = ion[0:1].capitalize()
                 roman = int(ion[1:])
 
+            if (ptype, symbol + "_fraction") not in self.field_aliases:
+                continue
+
             pstr = "_p" + str(roman-1)
             yt_ion = symbol + pstr
             ftype = ptype

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the yt-svn mailing list