[yt-svn] commit/yt: 4 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Apr 6 11:06:21 PDT 2016


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/171a0b20f8c0/
Changeset:   171a0b20f8c0
Branch:      yt
User:        chummels
Date:        2016-04-01 23:23:41+00:00
Summary:     Correcting chemical formulas to treat electrons with -1 charge.
Affected #:  1 file

diff -r d18f33211199f71e2fac4d927307b015d513a328 -r 171a0b20f8c047a5206158c070c34eecc0e8a6f7 yt/utilities/chemical_formulas.py
--- a/yt/utilities/chemical_formulas.py
+++ b/yt/utilities/chemical_formulas.py
@@ -29,6 +29,9 @@
                 charge = -int(ionization[1:])
             else:
                 raise NotImplementedError
+        elif self.formula_string.startswith('El'):
+            molecule = self.formula_string
+            charge = -1
         else:
             molecule = self.formula_string
             charge = 0


https://bitbucket.org/yt_analysis/yt/commits/65b01600c5d8/
Changeset:   65b01600c5d8
Branch:      yt
User:        chummels
Date:        2016-04-01 23:47:22+00:00
Summary:     Adding species aliases mapping neutral species fields to "MM_p0_" fields.
Affected #:  1 file

diff -r 171a0b20f8c047a5206158c070c34eecc0e8a6f7 -r 65b01600c5d8ffd087dfd5d5b39eab0989e44113 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -114,6 +114,24 @@
                        particle_type = particle_type,
                        units = unit_system["number_density"])
 
+def add_species_aliases(registry, ftype, alias_species, species):
+    """
+    This takes a field registry, a fluid type, and two species names.  
+    The first species name is one you wish to alias to an existing species
+    name.  For instance you might alias all "H_p0" fields to "H_" fields
+    to indicate that "H_" fields are really just neutral hydrogen fields.
+    This function registers field aliases for the density, number_density,
+    mass, and fraction fields between the two species given in the arguments.
+    """
+    registry.alias((ftype, "%s_density" % alias_species), 
+                   (ftype, "%s_density" % species))
+    registry.alias((ftype, "%s_fraction" % alias_species), 
+                   (ftype, "%s_fraction" % species))
+    registry.alias((ftype, "%s_number_density" % alias_species), 
+                   (ftype, "%s_number_density" % species))
+    registry.alias((ftype, "%s_mass" % alias_species), 
+                   (ftype, "%s_mass" % species))
+
 def add_nuclei_density_fields(registry, ftype,
                               particle_type = False):
     unit_system = registry.ds.unit_system
@@ -181,4 +199,9 @@
             # Skip it
             continue
         func(registry, ftype, species, particle_type)
+        # Adds aliases for all neutral species from their raw "MM_"
+        # species to "MM_p0_" species to be explicit.
+        if (ChemicalFormula(species).charge == 0):
+            alias_species = "%s_p0" % species.split('_')[0]
+            add_species_aliases(registry, "gas", alias_species, species)
     add_nuclei_density_fields(registry, ftype, particle_type=particle_type)


https://bitbucket.org/yt_analysis/yt/commits/d0da53659fbb/
Changeset:   d0da53659fbb
Branch:      yt
User:        chummels
Date:        2016-04-01 23:47:43+00:00
Summary:     Adding note about YTEP-0003
Affected #:  1 file

diff -r 65b01600c5d8ffd087dfd5d5b39eab0989e44113 -r d0da53659fbb11f15c403937ac00ad51e018030c yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -201,6 +201,7 @@
         func(registry, ftype, species, particle_type)
         # Adds aliases for all neutral species from their raw "MM_"
         # species to "MM_p0_" species to be explicit.
+        # See YTEP-0003 for more details.
         if (ChemicalFormula(species).charge == 0):
             alias_species = "%s_p0" % species.split('_')[0]
             add_species_aliases(registry, "gas", alias_species, species)


https://bitbucket.org/yt_analysis/yt/commits/068a53069cdf/
Changeset:   068a53069cdf
Branch:      yt
User:        ngoldbaum
Date:        2016-04-06 18:06:06+00:00
Summary:     Merged in chummels/yt (pull request #2105)

Adding neutral species aliases as described in YTEP 0003
Affected #:  2 files

diff -r 179a73a7e7f479572d0b9039feee73f75360fd3d -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -114,6 +114,24 @@
                        particle_type = particle_type,
                        units = unit_system["number_density"])
 
+def add_species_aliases(registry, ftype, alias_species, species):
+    """
+    This takes a field registry, a fluid type, and two species names.  
+    The first species name is one you wish to alias to an existing species
+    name.  For instance you might alias all "H_p0" fields to "H_" fields
+    to indicate that "H_" fields are really just neutral hydrogen fields.
+    This function registers field aliases for the density, number_density,
+    mass, and fraction fields between the two species given in the arguments.
+    """
+    registry.alias((ftype, "%s_density" % alias_species), 
+                   (ftype, "%s_density" % species))
+    registry.alias((ftype, "%s_fraction" % alias_species), 
+                   (ftype, "%s_fraction" % species))
+    registry.alias((ftype, "%s_number_density" % alias_species), 
+                   (ftype, "%s_number_density" % species))
+    registry.alias((ftype, "%s_mass" % alias_species), 
+                   (ftype, "%s_mass" % species))
+
 def add_nuclei_density_fields(registry, ftype,
                               particle_type = False):
     unit_system = registry.ds.unit_system
@@ -181,4 +199,10 @@
             # Skip it
             continue
         func(registry, ftype, species, particle_type)
+        # Adds aliases for all neutral species from their raw "MM_"
+        # species to "MM_p0_" species to be explicit.
+        # See YTEP-0003 for more details.
+        if (ChemicalFormula(species).charge == 0):
+            alias_species = "%s_p0" % species.split('_')[0]
+            add_species_aliases(registry, "gas", alias_species, species)
     add_nuclei_density_fields(registry, ftype, particle_type=particle_type)

diff -r 179a73a7e7f479572d0b9039feee73f75360fd3d -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 yt/utilities/chemical_formulas.py
--- a/yt/utilities/chemical_formulas.py
+++ b/yt/utilities/chemical_formulas.py
@@ -29,6 +29,9 @@
                 charge = -int(ionization[1:])
             else:
                 raise NotImplementedError
+        elif self.formula_string.startswith('El'):
+            molecule = self.formula_string
+            charge = -1
         else:
             molecule = self.formula_string
             charge = 0

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160406/3e5d2682/attachment.html>


More information about the yt-svn mailing list