<html><body>
<p>29 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/ef3ad4d78214/">https://bitbucket.org/yt_analysis/yt/commits/ef3ad4d78214/</a> Changeset:   ef3ad4d78214 Branch:      yt User:        brittonsmith Date:        2016-04-11 16:17:52+00:00 Summary:     Initial import. Affected #:  3 files</p>
<p>diff -r 248ccc5ef8b46d83682344d249c8de1c964759ab -r ef3ad4d78214ad3b5479bff80928e2f88ebcc788 yt_gizmo/__init__.py --- /dev/null +++ b/yt_gizmo/__init__.py @@ -0,0 +1,26 @@ +""" +API for gadget_fof_plus frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.funcs import \ +    mylog + +mylog.warn("GizmoDataset dataset overrides GadgetHDF5Dataset.") + +from .data_structures import \ +    GizmoDataset + +from .fields import \ +    GizmoFieldInfo</p>
<p>diff -r 248ccc5ef8b46d83682344d249c8de1c964759ab -r ef3ad4d78214ad3b5479bff80928e2f88ebcc788 yt_gizmo/data_structures.py --- /dev/null +++ b/yt_gizmo/data_structures.py @@ -0,0 +1,29 @@ +""" +Data structures for gizmo frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.data_objects.static_output import \ +    ParticleFile +from yt.frontends.gadget.data_structures import \ +    GadgetHDF5Dataset + +from .fields import \ +    GizmoFieldInfo + +class GizmoDataset(GadgetHDF5Dataset): +    _file_class = ParticleFile +    _field_info_class = GizmoFieldInfo +    _particle_mass_name = “Masses” +    _suffix = “.hdf5”</p>
<p>diff -r 248ccc5ef8b46d83682344d249c8de1c964759ab -r ef3ad4d78214ad3b5479bff80928e2f88ebcc788 yt_gizmo/fields.py --- /dev/null +++ b/yt_gizmo/fields.py @@ -0,0 +1,28 @@ +""" +Gizmo-specific fields + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.fields.species_fields import \ +    add_species_field_by_fraction +from yt.frontends.gadget.fields import \ +    GadgetFieldInfo + +class GizmoFieldInfo(GadgetFieldInfo): +    def setup_gas_particle_fields(self, ptype): +        super(GizmoFieldInfo, self).setup_gas_particle_fields(ptype) +        self.alias((ptype, “temperature"), (ptype, "Temperature")) + +        self.alias((ptype, "H_fraction"), (ptype, "NeutralHydrogenAbundance")) +        add_species_field_by_fraction(self, ptype, "H”, particle_type=True)</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/e911b118b8af/">https://bitbucket.org/yt_analysis/yt/commits/e911b118b8af/</a> Changeset:   e911b118b8af Branch:      yt User:        brittonsmith Date:        2016-04-11 16:35:26+00:00 Summary:     Adding HI and HII density fields. Affected #:  1 file</p>
<p>diff -r ef3ad4d78214ad3b5479bff80928e2f88ebcc788 -r e911b118b8af5ed38636b703b27717473cb7452f yt_gizmo/fields.py --- a/yt_gizmo/fields.py +++ b/yt_gizmo/fields.py @@ -15,7 +15,7 @@</p>
<pre>#-----------------------------------------------------------------------------

from yt.fields.species_fields import \</pre>
<ul><li><p>add_species_field_by_fraction</p></li></ul>
<p>+    add_species_field_by_density</p>
<pre>from yt.frontends.gadget.fields import \
    GadgetFieldInfo
</pre>
<p>@@ -24,5 +24,28 @@</p>
<pre>        super(GizmoFieldInfo, self).setup_gas_particle_fields(ptype)
        self.alias((ptype, "temperature"), (ptype, "Temperature"))
</pre>
<ul><li><p>self.alias((ptype, "H_fraction"), (ptype, "NeutralHydrogenAbundance"))</p></li>
<li><p>add_species_field_by_fraction(self, ptype, “H”, particle_type=True)</p></li></ul>
<p>+        def _h_density(field, data): +            x_H = 1.0 – data[(ptype, “He_fraction")] – \ +              data[(ptype, “metallicity")] +            return x_H * data[(ptype, "density")] * \ +              data[(ptype, "NeutralHydrogenAbundance")] + +        self.add_field( +            (ptype, "H_density"), +            function=_h_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H”, particle_type=True) + +        def _h_p1_density(field, data): +            x_H = 1.0 – data[(ptype, "He_fraction")] – \ +              data[(ptype, "metallicity")] +            return x_H * data[(ptype, "density")] * \ +              (1.0 – data[(ptype, "NeutralHydrogenAbundance")]) + +        self.add_field( +            (ptype, "H_p1_density"), +            function=_h_p1_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H_p1”, particle_type=True)</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/5c3acafec7cb/">https://bitbucket.org/yt_analysis/yt/commits/5c3acafec7cb/</a> Changeset:   5c3acafec7cb Branch:      yt User:        brittonsmith Date:        2016-04-12 14:41:51+00:00 Summary:     Renaming as FIRE frontend. Affected #:  6 files</p>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_fire/__init__.py --- /dev/null +++ b/yt_fire/__init__.py @@ -0,0 +1,24 @@ +""" +API for FIRE frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.funcs import \ +    mylog + +from .data_structures import \ +    FIREDataset + +from .fields import \ +    FIREFieldInfo</p>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_fire/data_structures.py --- /dev/null +++ b/yt_fire/data_structures.py @@ -0,0 +1,29 @@ +""" +Data structures for FIRE frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.data_objects.static_output import \ +    ParticleFile +from yt.frontends.gadget.data_structures import \ +    GadgetHDF5Dataset + +from .fields import \ +    FIREFieldInfo + +class FIREDataset(GadgetHDF5Dataset): +    _file_class = ParticleFile +    _field_info_class = FIREFieldInfo +    _particle_mass_name = “Masses” +    _suffix = “.hdf5”</p>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_fire/fields.py --- /dev/null +++ b/yt_fire/fields.py @@ -0,0 +1,51 @@ +""" +FIRE-specific fields + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.fields.species_fields import \ +    add_species_field_by_density +from yt.frontends.gadget.fields import \ +    GadgetFieldInfo + +class FIREFieldInfo(GadgetFieldInfo): +    def setup_gas_particle_fields(self, ptype): +        super(FIREFieldInfo, self).setup_gas_particle_fields(ptype) +        self.alias((ptype, “temperature"), (ptype, “Temperature")) + +        def _h_density(field, data): +            x_H = 1.0 – data[(ptype, "He_fraction")] – \ +              data[(ptype, "metallicity")] +            return x_H * data[(ptype, "density")] * \ +              data[(ptype, "NeutralHydrogenAbundance")] + +        self.add_field( +            (ptype, "H_density"), +            function=_h_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H”, particle_type=True) + +        def _h_p1_density(field, data): +            x_H = 1.0 – data[(ptype, "He_fraction")] – \ +              data[(ptype, "metallicity")] +            return x_H * data[(ptype, "density")] * \ +              (1.0 – data[(ptype, "NeutralHydrogenAbundance")]) + +        self.add_field( +            (ptype, "H_p1_density"), +            function=_h_p1_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H_p1”, particle_type=True)</p>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_gizmo/__init__.py --- a/yt_gizmo/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -API for gadget_fof_plus frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.funcs import \</p>
<ul><li><p>mylog</p></li></ul>
<p>– -mylog.warn("GizmoDataset dataset overrides GadgetHDF5Dataset.") – -from .data_structures import \</p>
<ul><li><p>GizmoDataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>GizmoFieldInfo</p></li></ul>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_gizmo/data_structures.py --- a/yt_gizmo/data_structures.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Data structures for gizmo frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.data_objects.static_output import \</p>
<ul><li><p>ParticleFile</p></li></ul>
<p>-from yt.frontends.gadget.data_structures import \</p>
<ul><li><p>GadgetHDF5Dataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>GizmoFieldInfo</p></li></ul>
<p>– -class GizmoDataset(GadgetHDF5Dataset):</p>
<ul><li><p>_file_class = ParticleFile</p></li>
<li><p>_field_info_class = GizmoFieldInfo</p></li>
<li><p>_particle_mass_name = “Masses”</p></li>
<li><p>_suffix = “.hdf5”</p></li></ul>
<p>diff -r e911b118b8af5ed38636b703b27717473cb7452f -r 5c3acafec7cb7062fa7052182c4341bc6418852e yt_gizmo/fields.py --- a/yt_gizmo/fields.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Gizmo-specific fields – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.fields.species_fields import \</p>
<ul><li><p>add_species_field_by_density</p></li></ul>
<p>-from yt.frontends.gadget.fields import \</p>
<ul><li><p>GadgetFieldInfo</p></li></ul>
<p>– -class GizmoFieldInfo(GadgetFieldInfo):</p>
<ul><li><p>def setup_gas_particle_fields(self, ptype):</p></li>
<li><p>super(GizmoFieldInfo, self).setup_gas_particle_fields(ptype)</p></li>
<li><p>self.alias((ptype, "temperature"), (ptype, "Temperature"))</p></li></ul>
<p>–</p>
<ul><li><p>def _h_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_fraction")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>data[(ptype, "NeutralHydrogenAbundance")]</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_density"),</p></li>
<li><p>function=_h_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H”, particle_type=True)</p></li></ul>
<p>–</p>
<ul><li><p>def _h_p1_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_fraction")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>(1.0 – data[(ptype, "NeutralHydrogenAbundance")])</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_p1_density"),</p></li>
<li><p>function=_h_p1_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H_p1”, particle_type=True)</p></li></ul>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/f5341734cf6a/">https://bitbucket.org/yt_analysis/yt/commits/f5341734cf6a/</a> Changeset:   f5341734cf6a Branch:      yt User:        brittonsmith Date:        2016-04-12 15:03:53+00:00 Summary:     Adding p0 aliaes. Affected #:  1 file</p>
<p>diff -r 5c3acafec7cb7062fa7052182c4341bc6418852e -r f5341734cf6abda3ccad9fab032c74329f8e0f3c yt_fire/fields.py --- a/yt_fire/fields.py +++ b/yt_fire/fields.py @@ -36,6 +36,8 @@</p>
<pre>particle_type=True,
units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H", particle_type=True)</pre>
<p>+        for suffix in ["density", “fraction”, “mass”, “number_density"]: +            self.alias((ptype, “H_%s” % suffix), (ptype, "H_p0_%s” % suffix))</p>
<pre>         def _h_p1_density(field, data):
x_H = 1.0 - data[(ptype, "He_fraction")] - \</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/8ecf0cf5aa90/">https://bitbucket.org/yt_analysis/yt/commits/8ecf0cf5aa90/</a> Changeset:   8ecf0cf5aa90 Branch:      yt User:        brittonsmith Date:        2016-04-12 15:23:08+00:00 Summary:     Adding is_valid for FIRE. Affected #:  1 file</p>
<p>diff -r f5341734cf6abda3ccad9fab032c74329f8e0f3c -r 8ecf0cf5aa90e80660ad319a264943b60a45ffb9 yt_fire/data_structures.py --- a/yt_fire/data_structures.py +++ b/yt_fire/data_structures.py @@ -14,6 +14,8 @@</p>
<pre># The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
</pre>
<p>+from yt.utilities.on_demand_imports import _h5py as h5py +</p>
<pre>from yt.data_objects.static_output import \
    ParticleFile
from yt.frontends.gadget.data_structures import \</pre>
<p>@@ -27,3 +29,21 @@</p>
<pre>_field_info_class = FIREFieldInfo
_particle_mass_name = "Masses"
_suffix = ".hdf5"</pre>
<p>+ +    @classmethod +    def _is_valid(self, *args, **kwargs): +        need_groups = ['Header'] +        veto_groups = ['FOF', ‘Group’, ‘Subhalo’] +        valid = True +        try: +            fh = h5py.File(args[0], mode='r') +            valid = all(ng in fh["/"] for ng in need_groups) and \ +              not any(vg in fh["/"] for vg in veto_groups) +            dmetal = “/PartType0/Metallicity” +            if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17): +                valid = False +            fh.close() +        except: +            valid = False +            pass +        return valid</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/8cb09ffccb65/">https://bitbucket.org/yt_analysis/yt/commits/8cb09ffccb65/</a> Changeset:   8cb09ffccb65 Branch:      yt User:        brittonsmith Date:        2016-04-12 16:17:59+00:00 Summary:     Removing some stuff we didn't need. Affected #:  1 file</p>
<p>diff -r 8ecf0cf5aa90e80660ad319a264943b60a45ffb9 -r 8cb09ffccb65afe79d78e045c8ff224bac1ec87f yt_fire/data_structures.py --- a/yt_fire/data_structures.py +++ b/yt_fire/data_structures.py @@ -16,8 +16,6 @@</p>
<pre>from yt.utilities.on_demand_imports import _h5py as h5py
</pre>
<p>-from yt.data_objects.static_output import \</p>
<ul><li><p>ParticleFile</p></li></ul>
<pre>from yt.frontends.gadget.data_structures import \
    GadgetHDF5Dataset
</pre>
<p>@@ -25,10 +23,7 @@</p>
<pre>    FIREFieldInfo

class FIREDataset(GadgetHDF5Dataset):</pre>
<ul><li><p>_file_class = ParticleFile _field_info_class = FIREFieldInfo</p></li>
<li><p>_particle_mass_name = “Masses”</p></li>
<li><p>_suffix = “.hdf5”</p>
<p>@classmethod def _is_valid(self, *args, **kwargs):</p></li></ul>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/654472b8f929/">https://bitbucket.org/yt_analysis/yt/commits/654472b8f929/</a> Changeset:   654472b8f929 Branch:      yt User:        brittonsmith Date:        2016-04-12 16:50:18+00:00 Summary:     Adding nuclei fraction and density fields for metals. Affected #:  1 file</p>
<p>diff -r 8cb09ffccb65afe79d78e045c8ff224bac1ec87f -r 654472b8f929fd4616108badf40faed2a37701df yt_fire/fields.py --- a/yt_fire/fields.py +++ b/yt_fire/fields.py @@ -18,14 +18,53 @@</p>
<pre>    add_species_field_by_density
from yt.frontends.gadget.fields import \
    GadgetFieldInfo</pre>
<p>+from yt.frontends.sph.fields import \ +    SPHFieldInfo</p>
<pre>class FIREFieldInfo(GadgetFieldInfo):</pre>
<p>+    known_particle_fields = ( +        ("Mass", ("code_mass", ["particle_mass"], None)), +        ("Masses", ("code_mass", ["particle_mass"], None)), +        ("Coordinates", ("code_length", ["particle_position"], None)), +        ("Velocity", ("code_velocity", ["particle_velocity"], None)), +        ("Velocities", ("code_velocity", ["particle_velocity"], None)), +        ("ParticleIDs", ("", ["particle_index"], None)), +        ("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)), +        ("SmoothingLength", ("code_length", ["smoothing_length"], None)), +        ("Density", ("code_mass / code_length**3", ["density"], None)), +        ("MaximumTemperature", ("K", [], None)), +        ("Temperature", ("K", ["temperature"], None)), +        ("Epsilon", ("code_length", [], None)), +        ("Metals", ("code_metallicity", ["metallicity"], None)), +        ("Metallicity", ("code_metallicity", ["metallicity"], None)), +        ("Phi", ("code_length", [], None)), +        ("StarFormationRate", ("Msun / yr", [], None)), +        ("FormationTime", ("code_time", ["creation_time"], None)), +        ("Metallicity_00", ("", ["metallicity"], None)), +        ("Metallicity_01", ("", ["He_nuclei_fraction"], None)), +        ("Metallicity_02", ("", ["C_nuclei_fraction"], None)), +        ("Metallicity_03", ("", ["N_nuclei_fraction"], None)), +        ("Metallicity_04", ("", ["O_nuclei_fraction"], None)), +        ("Metallicity_05", ("", ["Ne_nuclei_fraction"], None)), +        ("Metallicity_06", ("", ["Mg_nuclei_fraction"], None)), +        ("Metallicity_07", ("", ["Si_nuclei_fraction"], None)), +        ("Metallicity_08", ("", ["S_nuclei_fraction"], None)), +        ("Metallicity_09", ("", ["Ca_nuclei_fraction"], None)), +        ("Metallicity_10", ("", ["Fe_nuclei_fraction"], None)), +    ) + +    def __init__(self, *args, **kwargs): +        super(SPHFieldInfo, self).__init__(*args, **kwargs) +        if ("PartType0", “Metallicity_00”) in self.field_list: +            self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”, +                                 “Ca”, “Fe”] +</p>
<pre>    def setup_gas_particle_fields(self, ptype):
        super(FIREFieldInfo, self).setup_gas_particle_fields(ptype)
        self.alias((ptype, "temperature"), (ptype, "Temperature"))

        def _h_density(field, data):</pre>
<ul><li><p>x_H = 1.0 – data[(ptype, "He_fraction")] – \</p></li></ul>
<p>+            x_H = 1.0 – data[(ptype, "He_nuclei_fraction")] – \</p>
<pre>  data[(ptype, "metallicity")]
return x_H * data[(ptype, "density")] * \
  data[(ptype, "NeutralHydrogenAbundance")]</pre>
<p>@@ -40,7 +79,7 @@</p>
<pre>            self.alias((ptype, "H_%s" % suffix), (ptype, "H_p0_%s" % suffix))

        def _h_p1_density(field, data):</pre>
<ul><li><p>x_H = 1.0 – data[(ptype, "He_fraction")] – \</p></li></ul>
<p>+            x_H = 1.0 – data[(ptype, "He_nuclei_fraction")] – \</p>
<pre>  data[(ptype, "metallicity")]
return x_H * data[(ptype, "density")] * \
  (1.0 - data[(ptype, "NeutralHydrogenAbundance")])</pre>
<p>@@ -51,3 +90,14 @@</p>
<pre>particle_type=True,
units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H_p1", particle_type=True)</pre>
<p>+ +        for species in self.nuclei_names: +            def _nuclei_density_field(field, data): +                return data[ptype, “density”] * \ +                  data[ptype, “%s_nuclei_fraction” % species] + +            self.add_field( +                (ptype, “%s_nuclei_density” % species), +                function=_h_p1_density, +                particle_type=True, +                units=self.ds.unit_system["density"])</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/60b4ae456bd2/">https://bitbucket.org/yt_analysis/yt/commits/60b4ae456bd2/</a> Changeset:   60b4ae456bd2 Branch:      yt User:        brittonsmith Date:        2016-04-12 19:18:50+00:00 Summary:     Fixing nuclei mass density fields and changing nuclei fractions to metallicities. Affected #:  1 file</p>
<p>diff -r 654472b8f929fd4616108badf40faed2a37701df -r 60b4ae456bd2d4fb081ba025c87c394fb8b5e02d yt_fire/fields.py --- a/yt_fire/fields.py +++ b/yt_fire/fields.py @@ -41,16 +41,16 @@</p>
<pre>("StarFormationRate", ("Msun / yr", [], None)),
("FormationTime", ("code_time", ["creation_time"], None)),
("Metallicity_00", ("", ["metallicity"], None)),</pre>
<ul><li><p>("Metallicity_01", ("", ["He_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_02", ("", ["C_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_03", ("", ["N_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_04", ("", ["O_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_05", ("", ["Ne_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_06", ("", ["Mg_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_07", ("", ["Si_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_08", ("", ["S_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_09", ("", ["Ca_nuclei_fraction"], None)),</p></li>
<li><p>("Metallicity_10", ("", ["Fe_nuclei_fraction"], None)),</p></li></ul>
<p>+        ("Metallicity_01", ("", ["He_metallicity"], None)), +        ("Metallicity_02", ("", ["C_metallicity"], None)), +        ("Metallicity_03", ("", ["N_metallicity"], None)), +        ("Metallicity_04", ("", ["O_metallicity"], None)), +        ("Metallicity_05", ("", ["Ne_metallicity"], None)), +        ("Metallicity_06", ("", ["Mg_metallicity"], None)), +        ("Metallicity_07", ("", ["Si_metallicity"], None)), +        ("Metallicity_08", ("", ["S_metallicity"], None)), +        ("Metallicity_09", ("", ["Ca_metallicity"], None)), +        ("Metallicity_10", ("", ["Fe_metallicity"], None)),</p>
<pre>    )

    def __init__(self, *args, **kwargs):</pre>
<p>@@ -64,7 +64,7 @@</p>
<pre>        self.alias((ptype, "temperature"), (ptype, "Temperature"))

        def _h_density(field, data):</pre>
<ul><li><p>x_H = 1.0 – data[(ptype, "He_nuclei_fraction")] – \</p></li></ul>
<p>+            x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p>
<pre>  data[(ptype, "metallicity")]
return x_H * data[(ptype, "density")] * \
  data[(ptype, "NeutralHydrogenAbundance")]</pre>
<p>@@ -79,7 +79,7 @@</p>
<pre>            self.alias((ptype, "H_%s" % suffix), (ptype, "H_p0_%s" % suffix))

        def _h_p1_density(field, data):</pre>
<ul><li><p>x_H = 1.0 – data[(ptype, "He_nuclei_fraction")] – \</p></li></ul>
<p>+            x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p>
<pre>  data[(ptype, "metallicity")]
return x_H * data[(ptype, "density")] * \
  (1.0 - data[(ptype, "NeutralHydrogenAbundance")])</pre>
<p>@@ -91,13 +91,14 @@</p>
<pre>            units=self.ds.unit_system["density"])
        add_species_field_by_density(self, ptype, "H_p1", particle_type=True)
</pre>
<p>+        def _nuclei_mass_density_field(field, data): +            species = field.name[1][:field.name[1].find("_")] +            return data[ptype, “density”] * \ +              data[ptype, “%s_metallicity” % species] +</p>
<pre>for species in self.nuclei_names:</pre>
<ul><li><p>def _nuclei_density_field(field, data):</p></li>
<li><p>return data[ptype, “density”] * \</p></li>
<li><p>data[ptype, “%s_nuclei_fraction” % species]</p></li></ul>
<p>–</p>
<pre>self.add_field(</pre>
<ul><li><p>(ptype, “%s_nuclei_density” % species),</p></li>
<li><p>function=_h_p1_density,</p></li></ul>
<p>+                (ptype, “%s_nuclei_mass_density” % species), +                function=_nuclei_mass_density_field,</p>
<pre>particle_type=True,
units=self.ds.unit_system["density"])</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/5ac8198b96b5/">https://bitbucket.org/yt_analysis/yt/commits/5ac8198b96b5/</a> Changeset:   5ac8198b96b5 Branch:      yt User:        brittonsmith Date:        2016-04-13 10:59:26+00:00 Summary:     Fix alias call. Affected #:  1 file</p>
<p>diff -r 60b4ae456bd2d4fb081ba025c87c394fb8b5e02d -r 5ac8198b96b5ff1372198687f850b305a951e5f4 yt_fire/fields.py --- a/yt_fire/fields.py +++ b/yt_fire/fields.py @@ -76,7 +76,7 @@</p>
<pre>units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H", particle_type=True)
         for suffix in ["density", "fraction", "mass", "number_density"]:</pre>
<ul><li><p>self.alias((ptype, “H_%s” % suffix), (ptype, “H_p0_%s” % suffix))</p></li></ul>
<p>+            self.alias((ptype, “H_p0_%s” % suffix), (ptype, “H_%s” % suffix))</p>
<pre>         def _h_p1_density(field, data):
x_H = 1.0 - data[(ptype, "He_metallicity")] - \</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/aecdcc23193d/">https://bitbucket.org/yt_analysis/yt/commits/aecdcc23193d/</a> Changeset:   aecdcc23193d Branch:      yt User:        brittonsmith Date:        2016-04-21 10:39:52+00:00 Summary:     Moving files into correct place. Affected #:  7 files</p>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt/frontends/fire/api.py --- /dev/null +++ b/yt/frontends/fire/api.py @@ -0,0 +1,21 @@ +""" +API for FIRE frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .data_structures import \ +    FIREDataset + +from .fields import \ +    FIREFieldInfo</p>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt/frontends/fire/data_structures.py --- /dev/null +++ b/yt/frontends/fire/data_structures.py @@ -0,0 +1,44 @@ +""" +Data structures for FIRE frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.utilities.on_demand_imports import _h5py as h5py + +from yt.frontends.gadget.data_structures import \ +    GadgetHDF5Dataset + +from .fields import \ +    FIREFieldInfo + +class FIREDataset(GadgetHDF5Dataset): +    _field_info_class = FIREFieldInfo + +    @classmethod +    def _is_valid(self, *args, **kwargs): +        need_groups = ['Header'] +        veto_groups = ['FOF', ‘Group’, ‘Subhalo’] +        valid = True +        try: +            fh = h5py.File(args[0], mode='r') +            valid = all(ng in fh["/"] for ng in need_groups) and \ +              not any(vg in fh["/"] for vg in veto_groups) +            dmetal = “/PartType0/Metallicity” +            if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17): +                valid = False +            fh.close() +        except: +            valid = False +            pass +        return valid</p>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt/frontends/fire/fields.py --- /dev/null +++ b/yt/frontends/fire/fields.py @@ -0,0 +1,104 @@ +""" +FIRE-specific fields + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, Britton Smith. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.fields.species_fields import \ +    add_species_field_by_density +from yt.frontends.gadget.fields import \ +    GadgetFieldInfo +from yt.frontends.sph.fields import \ +    SPHFieldInfo + +class FIREFieldInfo(GadgetFieldInfo): +    known_particle_fields = ( +        ("Mass", ("code_mass", ["particle_mass"], None)), +        ("Masses", ("code_mass", ["particle_mass"], None)), +        ("Coordinates", ("code_length", ["particle_position"], None)), +        ("Velocity", ("code_velocity", ["particle_velocity"], None)), +        ("Velocities", ("code_velocity", ["particle_velocity"], None)), +        ("ParticleIDs", ("", ["particle_index"], None)), +        ("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)), +        ("SmoothingLength", ("code_length", ["smoothing_length"], None)), +        ("Density", ("code_mass / code_length**3", ["density"], None)), +        ("MaximumTemperature", ("K", [], None)), +        ("Temperature", ("K", ["temperature"], None)), +        ("Epsilon", ("code_length", [], None)), +        ("Metals", ("code_metallicity", ["metallicity"], None)), +        ("Metallicity", ("code_metallicity", ["metallicity"], None)), +        ("Phi", ("code_length", [], None)), +        ("StarFormationRate", ("Msun / yr", [], None)), +        ("FormationTime", ("code_time", ["creation_time"], None)), +        ("Metallicity_00", ("", ["metallicity"], None)), +        ("Metallicity_01", ("", ["He_metallicity"], None)), +        ("Metallicity_02", ("", ["C_metallicity"], None)), +        ("Metallicity_03", ("", ["N_metallicity"], None)), +        ("Metallicity_04", ("", ["O_metallicity"], None)), +        ("Metallicity_05", ("", ["Ne_metallicity"], None)), +        ("Metallicity_06", ("", ["Mg_metallicity"], None)), +        ("Metallicity_07", ("", ["Si_metallicity"], None)), +        ("Metallicity_08", ("", ["S_metallicity"], None)), +        ("Metallicity_09", ("", ["Ca_metallicity"], None)), +        ("Metallicity_10", ("", ["Fe_metallicity"], None)), +    ) + +    def __init__(self, *args, **kwargs): +        super(SPHFieldInfo, self).__init__(*args, **kwargs) +        if ("PartType0", “Metallicity_00”) in self.field_list: +            self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”, +                                 “Ca”, “Fe”] + +    def setup_gas_particle_fields(self, ptype): +        super(FIREFieldInfo, self).setup_gas_particle_fields(ptype) +        self.alias((ptype, “temperature"), (ptype, “Temperature")) + +        def _h_density(field, data): +            x_H = 1.0 – data[(ptype, “He_metallicity")] – \ +              data[(ptype, “metallicity")] +            return x_H * data[(ptype, “density")] * \ +              data[(ptype, “NeutralHydrogenAbundance")] + +        self.add_field( +            (ptype, “H_density"), +            function=_h_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, “H”, particle_type=True) +        for suffix in ["density”, “fraction”, “mass”, "number_density"]: +            self.alias((ptype, "H_p0_%s” % suffix), (ptype, "H_%s” % suffix)) + +        def _h_p1_density(field, data): +            x_H = 1.0 – data[(ptype, "He_metallicity")] – \ +              data[(ptype, "metallicity")] +            return x_H * data[(ptype, "density")] * \ +              (1.0 – data[(ptype, "NeutralHydrogenAbundance")]) + +        self.add_field( +            (ptype, "H_p1_density"), +            function=_h_p1_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H_p1”, particle_type=True) + +        def _nuclei_mass_density_field(field, data): +            species = field.name[1][:field.name[1].find("_")] +            return data[ptype, "density”] * \ +              data[ptype, "%s_metallicity” % species] + +        for species in self.nuclei_names: +            self.add_field( +                (ptype, "%s_nuclei_mass_density” % species), +                function=_nuclei_mass_density_field, +                particle_type=True, +                units=self.ds.unit_system["density"])</p>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt_fire/__init__.py --- a/yt_fire/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -API for FIRE frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.funcs import \</p>
<ul><li><p>mylog</p></li></ul>
<p>– -from .data_structures import \</p>
<ul><li><p>FIREDataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>FIREFieldInfo</p></li></ul>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt_fire/data_structures.py --- a/yt_fire/data_structures.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Data structures for FIRE frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.utilities.on_demand_imports import _h5py as h5py – -from yt.frontends.gadget.data_structures import \</p>
<ul><li><p>GadgetHDF5Dataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>FIREFieldInfo</p></li></ul>
<p>– -class FIREDataset(GadgetHDF5Dataset):</p>
<ul><li><p>_field_info_class = FIREFieldInfo</p></li></ul>
<p>–</p>
<ul><li><p>@classmethod</p></li>
<li><p>def _is_valid(self, *args, **kwargs):</p></li>
<li><p>need_groups = ['Header']</p></li>
<li><p>veto_groups = ['FOF', ‘Group’, ‘Subhalo’]</p></li>
<li><p>valid = True</p></li>
<li><p>try:</p></li>
<li><p>fh = h5py.File(args[0], mode='r')</p></li>
<li><p>valid = all(ng in fh["/"] for ng in need_groups) and \</p></li>
<li><p>not any(vg in fh["/"] for vg in veto_groups)</p></li>
<li><p>dmetal = “/PartType0/Metallicity”</p></li>
<li><p>if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17):</p></li>
<li><p>valid = False</p></li>
<li><p>fh.close()</p></li>
<li><p>except:</p></li>
<li><p>valid = False</p></li>
<li><p>pass</p></li>
<li><p>return valid</p></li></ul>
<p>diff -r 5ac8198b96b5ff1372198687f850b305a951e5f4 -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 yt_fire/fields.py --- a/yt_fire/fields.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -FIRE-specific fields – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, Britton Smith. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.fields.species_fields import \</p>
<ul><li><p>add_species_field_by_density</p></li></ul>
<p>-from yt.frontends.gadget.fields import \</p>
<ul><li><p>GadgetFieldInfo</p></li></ul>
<p>-from yt.frontends.sph.fields import \</p>
<ul><li><p>SPHFieldInfo</p></li></ul>
<p>– -class FIREFieldInfo(GadgetFieldInfo):</p>
<ul><li><p>known_particle_fields = (</p></li>
<li><p>("Mass", ("code_mass", ["particle_mass"], None)),</p></li>
<li><p>("Masses", ("code_mass", ["particle_mass"], None)),</p></li>
<li><p>("Coordinates", ("code_length", ["particle_position"], None)),</p></li>
<li><p>("Velocity", ("code_velocity", ["particle_velocity"], None)),</p></li>
<li><p>("Velocities", ("code_velocity", ["particle_velocity"], None)),</p></li>
<li><p>("ParticleIDs", ("", ["particle_index"], None)),</p></li>
<li><p>("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)),</p></li>
<li><p>("SmoothingLength", ("code_length", ["smoothing_length"], None)),</p></li>
<li><p>("Density", ("code_mass / code_length**3", ["density"], None)),</p></li>
<li><p>("MaximumTemperature", ("K", [], None)),</p></li>
<li><p>("Temperature", ("K", ["temperature"], None)),</p></li>
<li><p>("Epsilon", ("code_length", [], None)),</p></li>
<li><p>("Metals", ("code_metallicity", ["metallicity"], None)),</p></li>
<li><p>("Metallicity", ("code_metallicity", ["metallicity"], None)),</p></li>
<li><p>("Phi", ("code_length", [], None)),</p></li>
<li><p>("StarFormationRate", ("Msun / yr", [], None)),</p></li>
<li><p>("FormationTime", ("code_time", ["creation_time"], None)),</p></li>
<li><p>("Metallicity_00", ("", ["metallicity"], None)),</p></li>
<li><p>("Metallicity_01", ("", ["He_metallicity"], None)),</p></li>
<li><p>("Metallicity_02", ("", ["C_metallicity"], None)),</p></li>
<li><p>("Metallicity_03", ("", ["N_metallicity"], None)),</p></li>
<li><p>("Metallicity_04", ("", ["O_metallicity"], None)),</p></li>
<li><p>("Metallicity_05", ("", ["Ne_metallicity"], None)),</p></li>
<li><p>("Metallicity_06", ("", ["Mg_metallicity"], None)),</p></li>
<li><p>("Metallicity_07", ("", ["Si_metallicity"], None)),</p></li>
<li><p>("Metallicity_08", ("", ["S_metallicity"], None)),</p></li>
<li><p>("Metallicity_09", ("", ["Ca_metallicity"], None)),</p></li>
<li><p>("Metallicity_10", ("", ["Fe_metallicity"], None)),</p></li>
<li><p>)</p></li></ul>
<p>–</p>
<ul><li><p>def __init__(self, *args, **kwargs):</p></li>
<li><p>super(SPHFieldInfo, self).__init__(*args, **kwargs)</p></li>
<li><p>if ("PartType0", “Metallicity_00”) in self.field_list:</p></li>
<li><p>self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”,</p></li>
<li><p>“Ca”, “Fe”]</p></li></ul>
<p>–</p>
<ul><li><p>def setup_gas_particle_fields(self, ptype):</p></li>
<li><p>super(FIREFieldInfo, self).setup_gas_particle_fields(ptype)</p></li>
<li><p>self.alias((ptype, "temperature"), (ptype, "Temperature"))</p></li></ul>
<p>–</p>
<ul><li><p>def _h_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>data[(ptype, "NeutralHydrogenAbundance")]</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_density"),</p></li>
<li><p>function=_h_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H”, particle_type=True)</p></li>
<li><p>for suffix in ["density", “fraction”, “mass”, "number_density"]:</p></li>
<li><p>self.alias((ptype, “H_p0_%s” % suffix), (ptype, “H_%s” % suffix))</p></li></ul>
<p>–</p>
<ul><li><p>def _h_p1_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>(1.0 – data[(ptype, "NeutralHydrogenAbundance")])</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_p1_density"),</p></li>
<li><p>function=_h_p1_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H_p1”, particle_type=True)</p></li></ul>
<p>–</p>
<ul><li><p>def _nuclei_mass_density_field(field, data):</p></li>
<li><p>species = field.name[1][:field.name[1].find("_")]</p></li>
<li><p>return data[ptype, “density”] * \</p></li>
<li><p>data[ptype, “%s_metallicity” % species]</p></li></ul>
<p>–</p>
<ul><li><p>for species in self.nuclei_names:</p></li>
<li><p>self.add_field(</p></li>
<li><p>(ptype, “%s_nuclei_mass_density” % species),</p></li>
<li><p>function=_nuclei_mass_density_field,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li></ul>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/b0016b5ad2c0/">https://bitbucket.org/yt_analysis/yt/commits/b0016b5ad2c0/</a> Changeset:   b0016b5ad2c0 Branch:      yt User:        brittonsmith Date:        2016-04-21 10:44:23+00:00 Summary:     Adding import to frontends api. Affected #:  1 file</p>
<p>diff -r aecdcc23193d7d8966b9cb61b3afcf84c8c97887 -r b0016b5ad2c0815c68f5fdccf9d775d647bb41ed yt/frontends/api.py --- a/yt/frontends/api.py +++ b/yt/frontends/api.py @@ -25,6 +25,7 @@</p>
<pre>'eagle',
'enzo',
'exodus_ii',</pre>
<p>+    ‘fire’,</p>
<pre>'fits',
'flash',
'gadget',</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/6b45307ae021/">https://bitbucket.org/yt_analysis/yt/commits/6b45307ae021/</a> Changeset:   6b45307ae021 Branch:      yt User:        brittonsmith Date:        2016-04-21 10:44:34+00:00 Summary:     Updating headers. Affected #:  2 files</p>
<p>diff -r b0016b5ad2c0815c68f5fdccf9d775d647bb41ed -r 6b45307ae021f9bc7c202e6b16849b1232dfcc47 yt/frontends/fire/data_structures.py --- a/yt/frontends/fire/data_structures.py +++ b/yt/frontends/fire/data_structures.py @@ -7,7 +7,7 @@</p>
<pre>"""

#-----------------------------------------------------------------------------</pre>
<p>-# Copyright © 2016, Britton Smith. +# Copyright © 2016, yt Development Team</p>
<pre>#
# Distributed under the terms of the Modified BSD License.
#</pre>
<p>diff -r b0016b5ad2c0815c68f5fdccf9d775d647bb41ed -r 6b45307ae021f9bc7c202e6b16849b1232dfcc47 yt/frontends/fire/fields.py --- a/yt/frontends/fire/fields.py +++ b/yt/frontends/fire/fields.py @@ -7,7 +7,7 @@</p>
<pre>"""

#-----------------------------------------------------------------------------</pre>
<p>-# Copyright © 2016, Britton Smith. +# Copyright © 2016, yt Development Team</p>
<pre>#
# Distributed under the terms of the Modified BSD License.
#</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/cdbafa074d6f/">https://bitbucket.org/yt_analysis/yt/commits/cdbafa074d6f/</a> Changeset:   cdbafa074d6f Branch:      yt User:        brittonsmith Date:        2016-04-21 10:49:06+00:00 Summary:     Removing old FIRE fields. Affected #:  1 file</p>
<p>diff -r 6b45307ae021f9bc7c202e6b16849b1232dfcc47 -r cdbafa074d6f3c1e10ca64bd3c037b9ca4f04135 yt/frontends/sph/fields.py --- a/yt/frontends/sph/fields.py +++ b/yt/frontends/sph/fields.py @@ -41,27 +41,8 @@</p>
<pre>("Phi", ("code_length", [], None)),
("StarFormationRate", ("Msun / yr", [], None)),
("FormationTime", ("code_time", ["creation_time"], None)),</pre>
<ul><li><p># These are metallicity fields that get discovered for FIRE simulations</p></li>
<li><p>("Metallicity_00", ("", ["metallicity"], None)),</p></li>
<li><p>("Metallicity_01", ("", ["He_fraction"], None)),</p></li>
<li><p>("Metallicity_02", ("", ["C_fraction"], None)),</p></li>
<li><p>("Metallicity_03", ("", ["N_fraction"], None)),</p></li>
<li><p>("Metallicity_04", ("", ["O_fraction"], None)),</p></li>
<li><p>("Metallicity_05", ("", ["Ne_fraction"], None)),</p></li>
<li><p>("Metallicity_06", ("", ["Mg_fraction"], None)),</p></li>
<li><p>("Metallicity_07", ("", ["Si_fraction"], None)),</p></li>
<li><p>("Metallicity_08", ("", ["S_fraction"], None)),</p></li>
<li><p>("Metallicity_09", ("", ["Ca_fraction"], None)),</p></li>
<li><p>("Metallicity_10", ("", ["Fe_fraction"], None)),</p></li></ul>
<pre>    )
</pre>
<ul><li><p>def __init__(self, *args, **kwargs):</p></li>
<li><p>super(SPHFieldInfo, self).__init__(*args, **kwargs)</p></li>
<li><p># Special case for FIRE</p></li>
<li><p>if ("PartType0", “Metallicity_00”) in self.field_list:</p></li>
<li><p>self.species_names += ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”,</p></li>
<li><p>“Ca”, “Fe”]</p></li></ul>
<p>–</p>
<pre>def setup_particle_fields(self, ptype, *args, **kwargs):
    super(SPHFieldInfo, self).setup_particle_fields(ptype, *args, **kwargs)
    setup_species_fields(self, ptype)</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/a0fcda2c243f/">https://bitbucket.org/yt_analysis/yt/commits/a0fcda2c243f/</a> Changeset:   a0fcda2c243f Branch:      yt User:        chummels Date:        2016-05-11 17:10:04+00:00 Summary:     Adding docs for loading Gizmo and FIRE data Affected #:  1 file</p>
<p>diff -r cdbafa074d6f3c1e10ca64bd3c037b9ca4f04135 -r a0fcda2c243f357d141296212368b6dff114a116 doc/source/examining/loading_data.rst --- a/doc/source/examining/loading_data.rst +++ b/doc/source/examining/loading_data.rst @@ -1285,6 +1285,31 @@</p>
<pre>``bbox``
       The bounding box for the particle positions.
</pre>
<p>+.. _loading-gizmo-data: + +Gizmo Data +---------- + +Gizmo datasets, including FIRE outputs, can be loaded into yt in the usual +manner.  Like other SPH data formats, yt loads Gizmo data as particle fields +and then uses smoothing kernels to deposit those fields to an underlying +grid structure as spatial fields as described in :ref:`loading-gadget-data`. +To load Gizmo datasets using the standard HDF5 output format:: + +.. code-block:: python + +   import yt +   ds = yt.load("snapshot_600.hdf5") + +Because the Gizmo output format is similar to the Gadget format, yt +may load Gizmo datasets as Gadget depending on the circumstances, but this +should not pose a problem in most situations.  FIRE outputs will be loaded +accordingly due to the number of metallicity fields found (11 or 17). + +For Gizmo outputs written as raw binary outputs, you may have to specify +a bounding box, field specification, and units as are done for standard +Gadget outputs.  See :ref:`loading-gadget-data` for more information. +</p>
<pre>.. _loading-pyne-data:

Halo Catalog Data</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/681b490ea35c/">https://bitbucket.org/yt_analysis/yt/commits/681b490ea35c/</a> Changeset:   681b490ea35c Branch:      yt User:        chummels Date:        2016-05-11 17:13:34+00:00 Summary:     Adding FIRE and Gizmo to supported codes. Affected #:  1 file</p>
<p>diff -r a0fcda2c243f357d141296212368b6dff114a116 -r 681b490ea35c278a18f945d27e91160a14fae655 doc/source/reference/code_support.rst --- a/doc/source/reference/code_support.rst +++ b/doc/source/reference/code_support.rst @@ -28,14 +28,18 @@</p>
<pre>+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Enzo                  |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>-| FLASH                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   | +| FIRE                  |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |</p>
<pre>+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| FITS                  |     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |</pre>
<p>-+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+ +++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+ +| FLASH                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   | +-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Gadget                |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Gasoline              |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>+| Gizmo                 |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   | ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Grid Data Format (GDF)|     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Maestro               |   Y [#f1]_ |     N     |      Y     |   Y   |    Y     |    Y     |     N      | Partial  |</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/63ec9ddb4b76/">https://bitbucket.org/yt_analysis/yt/commits/63ec9ddb4b76/</a> Changeset:   63ec9ddb4b76 Branch:      yt User:        chummels Date:        2016-05-11 19:00:29+00:00 Summary:     Adding tests for FIRE frontend. Affected #:  2 files</p>
<p>diff -r 681b490ea35c278a18f945d27e91160a14fae655 -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 yt/frontends/fire/tests/test_outputs.py --- /dev/null +++ b/yt/frontends/fire/tests/test_outputs.py @@ -0,0 +1,48 @@ +""" +Gadget frontend tests + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2015, yt Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from collections import OrderedDict + +from yt.utilities.answer_testing.framework import \ +    data_dir_load, \ +    requires_ds, \ +    sph_answer +from yt.frontends.fire.api import FIREDataset + +FIRE_m12i = ‘FIRE_M12i_ref11/snapshot_600.hdf5’ + +# This maps from field names to weight field names to use for projections +fields = OrderedDict( +    [ +        (("gas", “density"), None), +        (("gas”, “temperature"), None), +        (("gas”, “temperature"), ('gas', ‘density')), +        (('gas’, ‘velocity_magnitude'), None), +        (("deposit”, “all_density"), None), +        (("deposit”, “all_count"), None), +        (("deposit”, “all_cic"), None), +        (("deposit”, "PartType0_density"), None), +    ] +) + +@requires_ds(FIRE_m12i) +def test_FireDataset(): +    ds = data_dir_load(FIRE_m12i) +    assert isinstance(ds, FIREDataset) +    for test in sph_answer(ds, 'FIRE_m12i’, 4786950, fields): +        test_FireDataset.__name__ = test.description +        yield test +    assert False</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/3ce6fdcf725a/">https://bitbucket.org/yt_analysis/yt/commits/3ce6fdcf725a/</a> Changeset:   3ce6fdcf725a Branch:      yt User:        chummels Date:        2016-05-11 19:04:08+00:00 Summary:     Moving FIRE frontend to Gizmo frontend Affected #:  12 files</p>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/fire/api.py --- a/yt/frontends/fire/api.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -API for FIRE frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, yt Development Team -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from .data_structures import \</p>
<ul><li><p>FIREDataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>FIREFieldInfo</p></li></ul>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/fire/data_structures.py --- a/yt/frontends/fire/data_structures.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Data structures for FIRE frontend. – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, yt Development Team -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.utilities.on_demand_imports import _h5py as h5py – -from yt.frontends.gadget.data_structures import \</p>
<ul><li><p>GadgetHDF5Dataset</p></li></ul>
<p>– -from .fields import \</p>
<ul><li><p>FIREFieldInfo</p></li></ul>
<p>– -class FIREDataset(GadgetHDF5Dataset):</p>
<ul><li><p>_field_info_class = FIREFieldInfo</p></li></ul>
<p>–</p>
<ul><li><p>@classmethod</p></li>
<li><p>def _is_valid(self, *args, **kwargs):</p></li>
<li><p>need_groups = ['Header']</p></li>
<li><p>veto_groups = ['FOF', ‘Group’, ‘Subhalo’]</p></li>
<li><p>valid = True</p></li>
<li><p>try:</p></li>
<li><p>fh = h5py.File(args[0], mode='r')</p></li>
<li><p>valid = all(ng in fh["/"] for ng in need_groups) and \</p></li>
<li><p>not any(vg in fh["/"] for vg in veto_groups)</p></li>
<li><p>dmetal = “/PartType0/Metallicity”</p></li>
<li><p>if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17):</p></li>
<li><p>valid = False</p></li>
<li><p>fh.close()</p></li>
<li><p>except:</p></li>
<li><p>valid = False</p></li>
<li><p>pass</p></li>
<li><p>return valid</p></li></ul>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/fire/fields.py --- a/yt/frontends/fire/fields.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -FIRE-specific fields – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2016, yt Development Team -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from yt.fields.species_fields import \</p>
<ul><li><p>add_species_field_by_density</p></li></ul>
<p>-from yt.frontends.gadget.fields import \</p>
<ul><li><p>GadgetFieldInfo</p></li></ul>
<p>-from yt.frontends.sph.fields import \</p>
<ul><li><p>SPHFieldInfo</p></li></ul>
<p>– -class FIREFieldInfo(GadgetFieldInfo):</p>
<ul><li><p>known_particle_fields = (</p></li>
<li><p>("Mass", ("code_mass", ["particle_mass"], None)),</p></li>
<li><p>("Masses", ("code_mass", ["particle_mass"], None)),</p></li>
<li><p>("Coordinates", ("code_length", ["particle_position"], None)),</p></li>
<li><p>("Velocity", ("code_velocity", ["particle_velocity"], None)),</p></li>
<li><p>("Velocities", ("code_velocity", ["particle_velocity"], None)),</p></li>
<li><p>("ParticleIDs", ("", ["particle_index"], None)),</p></li>
<li><p>("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)),</p></li>
<li><p>("SmoothingLength", ("code_length", ["smoothing_length"], None)),</p></li>
<li><p>("Density", ("code_mass / code_length**3", ["density"], None)),</p></li>
<li><p>("MaximumTemperature", ("K", [], None)),</p></li>
<li><p>("Temperature", ("K", ["temperature"], None)),</p></li>
<li><p>("Epsilon", ("code_length", [], None)),</p></li>
<li><p>("Metals", ("code_metallicity", ["metallicity"], None)),</p></li>
<li><p>("Metallicity", ("code_metallicity", ["metallicity"], None)),</p></li>
<li><p>("Phi", ("code_length", [], None)),</p></li>
<li><p>("StarFormationRate", ("Msun / yr", [], None)),</p></li>
<li><p>("FormationTime", ("code_time", ["creation_time"], None)),</p></li>
<li><p>("Metallicity_00", ("", ["metallicity"], None)),</p></li>
<li><p>("Metallicity_01", ("", ["He_metallicity"], None)),</p></li>
<li><p>("Metallicity_02", ("", ["C_metallicity"], None)),</p></li>
<li><p>("Metallicity_03", ("", ["N_metallicity"], None)),</p></li>
<li><p>("Metallicity_04", ("", ["O_metallicity"], None)),</p></li>
<li><p>("Metallicity_05", ("", ["Ne_metallicity"], None)),</p></li>
<li><p>("Metallicity_06", ("", ["Mg_metallicity"], None)),</p></li>
<li><p>("Metallicity_07", ("", ["Si_metallicity"], None)),</p></li>
<li><p>("Metallicity_08", ("", ["S_metallicity"], None)),</p></li>
<li><p>("Metallicity_09", ("", ["Ca_metallicity"], None)),</p></li>
<li><p>("Metallicity_10", ("", ["Fe_metallicity"], None)),</p></li>
<li><p>)</p></li></ul>
<p>–</p>
<ul><li><p>def __init__(self, *args, **kwargs):</p></li>
<li><p>super(SPHFieldInfo, self).__init__(*args, **kwargs)</p></li>
<li><p>if ("PartType0", “Metallicity_00”) in self.field_list:</p></li>
<li><p>self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”,</p></li>
<li><p>“Ca”, “Fe”]</p></li></ul>
<p>–</p>
<ul><li><p>def setup_gas_particle_fields(self, ptype):</p></li>
<li><p>super(FIREFieldInfo, self).setup_gas_particle_fields(ptype)</p></li>
<li><p>self.alias((ptype, "temperature"), (ptype, "Temperature"))</p></li></ul>
<p>–</p>
<ul><li><p>def _h_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>data[(ptype, "NeutralHydrogenAbundance")]</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_density"),</p></li>
<li><p>function=_h_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H”, particle_type=True)</p></li>
<li><p>for suffix in ["density", “fraction”, “mass”, "number_density"]:</p></li>
<li><p>self.alias((ptype, “H_p0_%s” % suffix), (ptype, “H_%s” % suffix))</p></li></ul>
<p>–</p>
<ul><li><p>def _h_p1_density(field, data):</p></li>
<li><p>x_H = 1.0 – data[(ptype, "He_metallicity")] – \</p></li>
<li><p>data[(ptype, "metallicity")]</p></li>
<li><p>return x_H * data[(ptype, "density")] * \</p></li>
<li><p>(1.0 – data[(ptype, "NeutralHydrogenAbundance")])</p></li></ul>
<p>–</p>
<ul><li><p>self.add_field(</p></li>
<li><p>(ptype, "H_p1_density"),</p></li>
<li><p>function=_h_p1_density,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li>
<li><p>add_species_field_by_density(self, ptype, “H_p1”, particle_type=True)</p></li></ul>
<p>–</p>
<ul><li><p>def _nuclei_mass_density_field(field, data):</p></li>
<li><p>species = field.name[1][:field.name[1].find("_")]</p></li>
<li><p>return data[ptype, “density”] * \</p></li>
<li><p>data[ptype, “%s_metallicity” % species]</p></li></ul>
<p>–</p>
<ul><li><p>for species in self.nuclei_names:</p></li>
<li><p>self.add_field(</p></li>
<li><p>(ptype, “%s_nuclei_mass_density” % species),</p></li>
<li><p>function=_nuclei_mass_density_field,</p></li>
<li><p>particle_type=True,</p></li>
<li><p>units=self.ds.unit_system["density"])</p></li></ul>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/fire/tests/test_outputs.py --- a/yt/frontends/fire/tests/test_outputs.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Gadget frontend tests – – – – -""" – -#----------------------------------------------------------------------------- -# Copyright © 2015, yt Development Team. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- – -from collections import OrderedDict – -from yt.utilities.answer_testing.framework import \</p>
<ul><li><p>data_dir_load, \</p></li>
<li><p>requires_ds, \</p></li>
<li><p>sph_answer</p></li></ul>
<p>-from yt.frontends.fire.api import FIREDataset – -FIRE_m12i = ‘FIRE_M12i_ref11/snapshot_600.hdf5’ – -# This maps from field names to weight field names to use for projections -fields = OrderedDict(</p>
<ul><li><p>[</p></li>
<li><p>(("gas", "density"), None),</p></li>
<li><p>(("gas", "temperature"), None),</p></li>
<li><p>(("gas", "temperature"), ('gas', 'density')),</p></li>
<li><p>(('gas', 'velocity_magnitude'), None),</p></li>
<li><p>(("deposit", "all_density"), None),</p></li>
<li><p>(("deposit", "all_count"), None),</p></li>
<li><p>(("deposit", "all_cic"), None),</p></li>
<li><p>(("deposit", "PartType0_density"), None),</p></li>
<li><p>]</p></li></ul>
<p>-) – -@requires_ds(FIRE_m12i) -def test_FireDataset():</p>
<ul><li><p>ds = data_dir_load(FIRE_m12i)</p></li>
<li><p>assert isinstance(ds, FIREDataset)</p></li>
<li><p>for test in sph_answer(ds, ‘FIRE_m12i’, 4786950, fields):</p></li>
<li><p>test_FireDataset.__name__ = test.description</p></li>
<li><p>yield test</p></li>
<li><p>assert False</p></li></ul>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/gizmo/api.py --- /dev/null +++ b/yt/frontends/gizmo/api.py @@ -0,0 +1,21 @@ +""" +API for FIRE frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .data_structures import \ +    GizmoDataset + +from .fields import \ +    GizmoFieldInfo</p>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/gizmo/data_structures.py --- /dev/null +++ b/yt/frontends/gizmo/data_structures.py @@ -0,0 +1,44 @@ +""" +Data structures for Gizmo frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.utilities.on_demand_imports import _h5py as h5py + +from yt.frontends.gadget.data_structures import \ +    GadgetHDF5Dataset + +from .fields import \ +    GizmoFieldInfo + +class GizmoDataset(GadgetHDF5Dataset): +    _field_info_class = GizmoFieldInfo + +    @classmethod +    def _is_valid(self, *args, **kwargs): +        need_groups = ['Header'] +        veto_groups = ['FOF', ‘Group’, ‘Subhalo’] +        valid = True +        try: +            fh = h5py.File(args[0], mode='r') +            valid = all(ng in fh["/"] for ng in need_groups) and \ +              not any(vg in fh["/"] for vg in veto_groups) +            dmetal = “/PartType0/Metallicity” +            if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17): +                valid = False +            fh.close() +        except: +            valid = False +            pass +        return valid</p>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/gizmo/fields.py --- /dev/null +++ b/yt/frontends/gizmo/fields.py @@ -0,0 +1,104 @@ +""" +Gizmo-specific fields + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.fields.species_fields import \ +    add_species_field_by_density +from yt.frontends.gadget.fields import \ +    GadgetFieldInfo +from yt.frontends.sph.fields import \ +    SPHFieldInfo + +class GizmoFieldInfo(GadgetFieldInfo): +    known_particle_fields = ( +        ("Mass", ("code_mass", ["particle_mass"], None)), +        ("Masses", ("code_mass", ["particle_mass"], None)), +        ("Coordinates", ("code_length", ["particle_position"], None)), +        ("Velocity", ("code_velocity", ["particle_velocity"], None)), +        ("Velocities", ("code_velocity", ["particle_velocity"], None)), +        ("ParticleIDs", ("", ["particle_index"], None)), +        ("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)), +        ("SmoothingLength", ("code_length", ["smoothing_length"], None)), +        ("Density", ("code_mass / code_length**3", ["density"], None)), +        ("MaximumTemperature", ("K", [], None)), +        ("Temperature", ("K", ["temperature"], None)), +        ("Epsilon", ("code_length", [], None)), +        ("Metals", ("code_metallicity", ["metallicity"], None)), +        ("Metallicity", ("code_metallicity", ["metallicity"], None)), +        ("Phi", ("code_length", [], None)), +        ("StarFormationRate", ("Msun / yr", [], None)), +        ("FormationTime", ("code_time", ["creation_time"], None)), +        ("Metallicity_00", ("", ["metallicity"], None)), +        ("Metallicity_01", ("", ["He_metallicity"], None)), +        ("Metallicity_02", ("", ["C_metallicity"], None)), +        ("Metallicity_03", ("", ["N_metallicity"], None)), +        ("Metallicity_04", ("", ["O_metallicity"], None)), +        ("Metallicity_05", ("", ["Ne_metallicity"], None)), +        ("Metallicity_06", ("", ["Mg_metallicity"], None)), +        ("Metallicity_07", ("", ["Si_metallicity"], None)), +        ("Metallicity_08", ("", ["S_metallicity"], None)), +        ("Metallicity_09", ("", ["Ca_metallicity"], None)), +        ("Metallicity_10", ("", ["Fe_metallicity"], None)), +    ) + +    def __init__(self, *args, **kwargs): +        super(SPHFieldInfo, self).__init__(*args, **kwargs) +        if ("PartType0", “Metallicity_00”) in self.field_list: +            self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”, +                                 “Ca”, “Fe”] + +    def setup_gas_particle_fields(self, ptype): +        super(GizmoFieldInfo, self).setup_gas_particle_fields(ptype) +        self.alias((ptype, “temperature"), (ptype, “Temperature")) + +        def _h_density(field, data): +            x_H = 1.0 – data[(ptype, “He_metallicity")] – \ +              data[(ptype, “metallicity")] +            return x_H * data[(ptype, “density")] * \ +              data[(ptype, “NeutralHydrogenAbundance")] + +        self.add_field( +            (ptype, “H_density"), +            function=_h_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, “H”, particle_type=True) +        for suffix in ["density”, “fraction”, “mass”, "number_density"]: +            self.alias((ptype, "H_p0_%s” % suffix), (ptype, "H_%s” % suffix)) + +        def _h_p1_density(field, data): +            x_H = 1.0 – data[(ptype, "He_metallicity")] – \ +              data[(ptype, "metallicity")] +            return x_H * data[(ptype, "density")] * \ +              (1.0 – data[(ptype, "NeutralHydrogenAbundance")]) + +        self.add_field( +            (ptype, "H_p1_density"), +            function=_h_p1_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H_p1”, particle_type=True) + +        def _nuclei_mass_density_field(field, data): +            species = field.name[1][:field.name[1].find("_")] +            return data[ptype, "density”] * \ +              data[ptype, "%s_metallicity” % species] + +        for species in self.nuclei_names: +            self.add_field( +                (ptype, "%s_nuclei_mass_density” % species), +                function=_nuclei_mass_density_field, +                particle_type=True, +                units=self.ds.unit_system["density"])</p>
<p>diff -r 63ec9ddb4b7610cdb0b9245dea59aa255dd19b96 -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a yt/frontends/gizmo/tests/test_outputs.py --- /dev/null +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -0,0 +1,48 @@ +""" +Gizmo frontend tests + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2015, yt Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from collections import OrderedDict + +from yt.utilities.answer_testing.framework import \ +    data_dir_load, \ +    requires_ds, \ +    sph_answer +from yt.frontends.gizmo.api import GizmoDataset + +FIRE_m12i = ‘FIRE_M12i_ref11/snapshot_600.hdf5’ + +# This maps from field names to weight field names to use for projections +fields = OrderedDict( +    [ +        (("gas", “density"), None), +        (("gas”, “temperature"), None), +        (("gas”, “temperature"), ('gas', ‘density')), +        (('gas’, ‘velocity_magnitude'), None), +        (("deposit”, “all_density"), None), +        (("deposit”, “all_count"), None), +        (("deposit”, “all_cic"), None), +        (("deposit”, "PartType0_density"), None), +    ] +) + +@requires_ds(FIRE_m12i) +def test_GizmoDataset(): +    ds = data_dir_load(FIRE_m12i) +    assert isinstance(ds, FIREDataset) +    for test in sph_answer(ds, 'FIRE_m12i’, 4786950, fields): +        test_GizmoDataset.__name__ = test.description +        yield test +    assert False</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/e7f00268f51b/">https://bitbucket.org/yt_analysis/yt/commits/e7f00268f51b/</a> Changeset:   e7f00268f51b Branch:      yt User:        chummels Date:        2016-05-11 19:07:33+00:00 Summary:     Updating docs removing fire entry. Affected #:  1 file</p>
<p>diff -r 3ce6fdcf725aab87fd7004359cbc69e97cc8902a -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c doc/source/reference/code_support.rst --- a/doc/source/reference/code_support.rst +++ b/doc/source/reference/code_support.rst @@ -28,8 +28,6 @@</p>
<pre>+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Enzo                  |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>-| FIRE                  |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   | -+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| FITS                  |     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| FLASH                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/a33c31184bc1/">https://bitbucket.org/yt_analysis/yt/commits/a33c31184bc1/</a> Changeset:   a33c31184bc1 Branch:      yt User:        chummels Date:        2016-05-11 19:08:21+00:00 Summary:     Merging with tip Affected #:  73 files</p>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/install_script.sh --- a/doc/install_script.sh +++ b/doc/install_script.sh @@ -994,6 +994,17 @@</p>
<pre>        cd ..
    fi
</pre>
<p>+    ( ${DEST_DIR}/bin/python -c “import _ssl” 2>&1 ) 1>> ${LOG_FILE} +    RESULT=$? +    if  [ $RESULT -ne 0 ] +    then +        echo “Unable to import the python SSL bindings.” +        echo “This means that OpenSSL is not installed or your system's OpenSSL” +        echo “installation is out of date.” +        echo “Please install OpenSSL or set INST_CONDA=1” +        do_exit +    fi +</p>
<pre>if [ $INST_PY3 -eq 1 ]
then
    if [ ! -e $PYTHON3/done ]</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/analysis_modules/photon_simulator.rst --- a/doc/source/analyzing/analysis_modules/photon_simulator.rst +++ b/doc/source/analyzing/analysis_modules/photon_simulator.rst @@ -478,7 +478,8 @@</p>
<pre>import yt
import numpy as np</pre>
<ul><li><p>from yt.utilities.physical_constants import cm_per_kpc, K_per_keV, mp</p></li></ul>
<p>+   from yt.utilities.physical_ratios import cm_per_kpc, K_per_keV +   from yt.units import mp</p>
<pre>from yt.utilities.cosmology import Cosmology
from yt.analysis_modules.photon_simulator.api import *
import aplpy</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/analysis_modules/xray_emission_fields.rst --- a/doc/source/analyzing/analysis_modules/xray_emission_fields.rst +++ b/doc/source/analyzing/analysis_modules/xray_emission_fields.rst @@ -32,7 +32,7 @@</p>
<pre>  from yt.analysis_modules.spectral_integrator.api import \
       add_xray_emissivity_field
</pre>
<ul><li><p>xray_fields = add_xray_emissivity_field(0.5, 7.0)</p></li></ul>
<p>+  xray_fields = add_xray_emissivity_field(ds, 0.5, 7.0)</p>
<pre>Additional keyword arguments are:
</pre>
<p>@@ -49,7 +49,8 @@</p>
<pre>* **constant_metallicity** (*float*): If specified, assume a constant
  metallicity for the emission from metals.  The *with_metals* keyword</pre>
<ul><li><p>must be set to False to use this.  Default: None.</p></li></ul>
<p>+   must be set to False to use this. It should be given in unit of solar metallicity. +   Default: None.</p>
<pre>The resulting fields can be used like all normal fields. The function will return the names of
the created fields in a Python list.</pre>
<p>@@ -60,7 +61,7 @@</p>
<pre>  from yt.analysis_modules.spectral_integrator.api import \
       add_xray_emissivity_field
</pre>
<ul><li><p>xray_fields = add_xray_emissivity_field(0.5, 7.0, filename="apec_emissivity.h5")</p></li></ul>
<p>+  xray_fields = add_xray_emissivity_field(ds, 0.5, 7.0, filename="apec_emissivity.h5")</p>
<pre>ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
plot = yt.SlicePlot(ds, 'x', 'xray_luminosity_0.5_7.0_keV')</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/units/1)_Symbolic_Units.ipynb --- a/doc/source/analyzing/units/1)_Symbolic_Units.ipynb +++ b/doc/source/analyzing/units/1)_Symbolic_Units.ipynb @@ -155,7 +155,7 @@</p>
<pre>"outputs": [],
"source": [
 "from yt.units.yt_array import YTQuantity\n",</pre>
<ul><li><p>“from yt.utilities.physical_constants import kboltz\n”,</p></li></ul>
<p>+    “from yt.units import kboltz\n”,</p>
<pre>"from numpy.random import random\n",
"import numpy as np\n",
"\n",</pre>
<p>@@ -446,7 +446,7 @@</p>
<pre>},
"outputs": [],
"source": [</pre>
<ul><li><p>“from yt.utilities.physical_constants import G, kboltz\n”,</p></li></ul>
<p>+    “from yt.units import G, kboltz\n”,</p>
<pre>"\n",
"print (\"Newton's constant: \", G)\n",
"print (\"Newton's constant in MKS: \", G.in_mks(), \"\\n\")\n",</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/units/2)_Fields_and_unit_conversion.ipynb --- a/doc/source/analyzing/units/2)_Fields_and_unit_conversion.ipynb +++ b/doc/source/analyzing/units/2)_Fields_and_unit_conversion.ipynb @@ -467,7 +467,7 @@</p>
<pre>"metadata": {},
"outputs": [],
"source": [</pre>
<ul><li><p>“from yt.utilities.physical_constants import kboltz\n”,</p></li></ul>
<p>+    “from yt.units import kboltz\n”,</p>
<pre>  "kb = kboltz.to_astropy()"
 ]
},</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/units/6)_Unit_Equivalencies.ipynb --- a/doc/source/analyzing/units/6)_Unit_Equivalencies.ipynb +++ b/doc/source/analyzing/units/6)_Unit_Equivalencies.ipynb @@ -41,7 +41,7 @@</p>
<pre>"print (dd[\"temperature\"].to_equivalent(\"eV\", \"thermal\"))\n",
"\n",
"# Rest energy of the proton\n",</pre>
<ul><li><p>“from yt.utilities.physical_constants import mp\n”,</p></li></ul>
<p>+    “from yt.units import mp\n”,</p>
<pre> "E_p = mp.to_equivalent(\"GeV\", \"mass_energy\")\n",
 "print (E_p)"
]</pre>
<p>@@ -61,7 +61,7 @@</p>
<pre>},
"outputs": [],
"source": [</pre>
<ul><li><p>“from yt.utilities.physical_constants import clight\n”,</p></li></ul>
<p>+    “from yt.units import clight\n”,</p>
<pre>"v = 0.1*clight\n",
"g = v.to_equivalent(\"dimensionless\", \"lorentz\")\n",
"print (g)\n",</pre>
<p>@@ -166,7 +166,7 @@</p>
<pre>},
"outputs": [],
"source": [</pre>
<ul><li><p>“from yt.utilities.physical_constants import qp # the elementary charge in esu\n”,</p></li></ul>
<p>+    “from yt.units import qp # the elementary charge in esu\n”,</p>
<pre>"qp_SI = qp.to_equivalent(\"C\",\"SI\") # convert to Coulombs\n",
"print (qp)\n",
"print (qp_SI)"</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/analyzing/units/7)_Unit_Systems.ipynb --- a/doc/source/analyzing/units/7)_Unit_Systems.ipynb +++ b/doc/source/analyzing/units/7)_Unit_Systems.ipynb @@ -324,7 +324,7 @@</p>
<pre>},
"outputs": [],
"source": [</pre>
<ul><li><p>“from yt.utilities.physical_constants import G\n”,</p></li></ul>
<p>+    “from yt.units import G\n”,</p>
<pre>  "print (G.in_base(\"mks\"))"
 ]
},</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/cookbook/tests/test_cookbook.py --- a/doc/source/cookbook/tests/test_cookbook.py +++ b/doc/source/cookbook/tests/test_cookbook.py @@ -15,6 +15,26 @@</p>
<pre>import subprocess

</pre>
<p>+def run_with_capture(*args, **kwargs): +    sp = subprocess.Popen(*args, +                          stdout=subprocess.PIPE, +                          stderr=subprocess.PIPE, +                          **kwargs) +    out, err = sp.communicate() +    if out: +        sys.stdout.write(out.decode("UTF-8")) +    if err: +        sys.stderr.write(err.decode("UTF-8")) + +    if sp.returncode != 0: +        retstderr = " “.join(args[0]) +        retstderr += “\n\nTHIS IS THE REAL CAUSE OF THE FAILURE:\n” +        retstderr += err.decode("UTF-8”) + “\n” +        raise subprocess.CalledProcessError(sp.returncode, retstderr) + +    return sp.returncode + +</p>
<pre>PARALLEL_TEST = {"rockstar_nest.py": "3"}
BLACKLIST = ["opengl_ipython.py", "opengl_vr.py"]
</pre>
<p>@@ -37,10 +57,16 @@</p>
<pre>def check_recipe(cmd):
    '''Run single recipe'''</pre>
<ul><li><p>try:</p></li>
<li><p>subprocess.check_call(cmd)</p></li>
<li><p>result = True</p></li>
<li><p>except subprocess.CalledProcessError as e:</p></li>
<li><p>print(("Stdout output:\n", e.output))</p></li>
<li><p>result = False</p></li>
<li><p>assert result</p></li></ul>
<p>+    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, +                            stderr=subprocess.PIPE) +    out, err = proc.communicate() +    if out: +        sys.stdout.write(out.decode("utf8")) +    if err: +        sys.stderr.write(err.decode("utf8")) + +    if proc.returncode != 0: +        retstderr = " “.join(cmd) +        retstderr += “\n\nTHIS IS THE REAL CAUSE OF THE FAILURE:\n” +        retstderr += err.decode("UTF-8”) + “\n” +        raise subprocess.CalledProcessError(proc.returncode, retstderr)</p>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/developing/creating_derived_fields.rst --- a/doc/source/developing/creating_derived_fields.rst +++ b/doc/source/developing/creating_derived_fields.rst @@ -71,9 +71,9 @@</p>
<pre>a dimensionless float or array.

If your field definition includes physical constants rather than defining a</pre>
<p>-constant as a float, you can import it from ``yt.utilities.physical_constants`` +constant as a float, you can import it from ``yt.units``</p>
<pre>to get a predefined version of the constant with the correct units. If you know</pre>
<p>-the units your data is supposed to have ahead of time, you can import unit +the units your data is supposed to have ahead of time, you can also import unit</p>
<pre>symbols like ``g`` or ``cm`` from the ``yt.units`` namespace and multiply the
return value of your field function by the appropriate combination of unit
symbols for your field's units. You can also convert floats or NumPy arrays into</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/developing/creating_frontend.rst --- a/doc/source/developing/creating_frontend.rst +++ b/doc/source/developing/creating_frontend.rst @@ -34,7 +34,8 @@</p>
<pre>`yt-dev <http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org>`_!

To get started, make a new directory in ``yt/frontends`` with the name</pre>
<p>-of your code.  Copying the contents of the ``yt/frontends/_skeleton`` +of your code and add the name into ``yt/frontends/api.py``. +Copying the contents of the ``yt/frontends/_skeleton``</p>
<pre>directory will add a lot of boilerplate for the required classes and
methods that are needed.  In particular, you'll have to create a
subclass of ``Dataset`` in the data_structures.py file. This subclass</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/developing/testing.rst --- a/doc/source/developing/testing.rst +++ b/doc/source/developing/testing.rst @@ -245,6 +245,12 @@</p>
<pre>* ``IsothermalCollapse/snap_505.hdf5``
* ``GadgetDiskGalaxy/snapshot_200.hdf5``
</pre>
<p>+GAMER +~~~~~~ + +* ``InteractingJets/jet_000002`` +* ``WaveDarkMatter/psiDM_000020`` +</p>
<pre>Halo Catalog
~~~~~~~~~~~~
</pre>
<p>@@ -532,7 +538,13 @@</p>
<pre>      local_pw_000:
</pre>
<p>-would regenerate answers for OWLS frontend. +would regenerate answers for OWLS frontend. + +When adding tests to an existing set of answers (like ``local_owls_000`` or ``local_varia_000``), +it is considered best practice to first submit a pull request adding the tests WITHOUT incrementing +the version number. Then, allow the tests to run (resulting in “no old answer” errors for the missing +answers). If no other failures are present, you can then increment the version number to regenerate +the answers. This way, we can avoid accidently covering up test breakages.</p>
<pre>Adding New Answer Tests
~~~~~~~~~~~~~~~~~~~~~~~</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/examining/loading_data.rst --- a/doc/source/examining/loading_data.rst +++ b/doc/source/examining/loading_data.rst @@ -1021,6 +1021,34 @@</p>
<pre>yt will utilize length, mass and time to set up all other units.
</pre>
<p>+GAMER Data +---------- + +GAMER HDF5 data is supported and cared for by Hsi-Yu Schive. You can load the data like this: + +.. code-block:: python + +   import yt +   ds = yt.load("InteractingJets/jet_000002") + +Currently GAMER does not assume any unit for non-cosmological simulations. To specify the units for yt, +you need to supply conversions for length, time, and mass to ``load`` using the ``units_override`` functionality: + +.. code-block:: python + +   import yt +   code_units = { “length_unit":(1.0,"kpc"), +                  “time_unit”  :(3.08567758096e+13,"s"), +                  “mass_unit”  :(1.4690033e+36,"g”) } +   ds = yt.load("InteractingJets/jet_000002", units_override=code_units) + +This means that the yt fields, e.g., ``("gas","density")``, will be in cgs units, but the GAMER fields, +e.g., ``("gamer","Dens")``, will be in code units. + +.. rubric:: Caveats + +* GAMER data in raw binary format (i.e., OPT__OUTPUT_TOTAL = C-binary) is not supported. +</p>
<pre>.. _loading-amr-data:

Generic AMR Data</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/installing.rst --- a/doc/source/installing.rst +++ b/doc/source/installing.rst @@ -18,26 +18,27 @@</p>
<pre>* If you do not have root access on your computer, are not comfortable managing
  python packages, or are working on a supercomputer or cluster computer, you</pre>
<ul><li><p>will probably want to use the bash all-in-one installation script.  This builds</p></li>
<li><p>Python, NumPy, Matplotlib, and yt from source to set up an isolated scientific</p></li>
<li><p>python environment inside of a single folder in your home directory. See</p></li>
<li><p>:ref:`install-script` for more details.</p></li></ul>
<p>+  will probably want to use the bash all-in-one installation script.  This +  creates a python environment using the `miniconda python +  distrubtion <<a href="http://conda.pydata.org/miniconda.html">http://conda.pydata.org/miniconda.html</a>>`_ and the +  `conda <<a href="http://conda.pydata.org/docs/">http://conda.pydata.org/docs/</a>>`_ package manager inside of a single +  folder in your home directory. See :ref:`install-script` for more details.</p>
<pre>* If you use the `Anaconda <https://store.continuum.io/cshop/anaconda/>`_ python</pre>
<ul><li><p>distribution see :ref:`anaconda-installation` for details on how to install</p></li>
<li><p>yt using the ``conda`` package manager.  Source-based installation from the</p></li>
<li><p>mercurial repository or via ``pip`` should also work under Anaconda. Note that</p></li>
<li><p>this is currently the only supported installation mechanism on Windows.</p></li></ul>
<p>+  distribution and already have ``conda`` installed, see +  :ref:`anaconda-installation` for details on how to install yt using the +  ``conda`` package manager. Note that this is currently the only supported +  installation mechanism on Windows.</p>
<p>-* If you already have a scientific python software stack installed on your</p>
<ul><li><p>computer and are comfortable installing python packages,</p></li></ul>
<p>+* If you want to build a development version of yt or are comfortable with +  compilers and know your way around python packaging,</p>
<pre>:ref:`source-installation` will probably be the best choice. If you have set
up python using a source-based package manager like `Homebrew
<http://brew.sh>`_ or `MacPorts <http://www.macports.org/>`_ this choice will</pre>
<ul><li><p>let you install yt using the python installed by the package manager. Similarly</p></li>
<li><p>for python environments set up via Linux package managers so long as you</p></li>
<li><p>have the necessary compilers installed (e.g. the ``build-essentials``</p></li>
<li><p>package on Debian and Ubuntu).</p></li></ul>
<p>+  let you install yt using the python installed by the package +  manager. Similarly, this will also work for python environments set up via +  Linux package managers so long as you have the necessary compilers installed +  (e.g. the ``build-essentials`` package on Debian and Ubuntu).</p>
<pre>.. note::
  See `Parallel Computation</pre>
<p>@@ -53,19 +54,21 @@</p>
<pre>Before you install yt, you must decide which branch (i.e. version) of the code
you prefer to use:
</pre>
<p>-* ``yt`` — The most up-to-date <strong>development</strong> version with the most current features but sometimes unstable (yt-3.x) -* ``stable`` — The latest stable release of yt-3.x -* ``yt-2.x`` — The latest stable release of yt-2.x +* ``yt`` — The most up-to-date <strong>development</strong> version with the most current +  features but sometimes unstable (the development version of the next ``yt-3.x`` +  release). +* ``stable`` — The latest stable release of ``yt-3.x``. +* ``yt-2.x`` — The last stable release of ``yt-2.x``.</p>
<p>-If this is your first time using the code, we recommend using ``stable``, -unless you specifically need some piece of brand-new functionality only -available in ``yt`` or need to run an old script developed for ``yt-2.x``. -There were major API and functionality changes made in yt after version 2.7 -in moving to version 3.0.  For a detailed description of the changes -between versions 2.x (e.g. branch ``yt-2.x``) and 3.x (e.g. branches ``yt`` and -``stable``) see :ref:`yt3differences`.  Lastly, don't feel like you're locked -into one branch when you install yt, because you can easily change the active -branch by following the instructions in :ref:`switching-between-yt-versions`. +If this is your first time using the code, we recommend using ``stable``, unless +you specifically need some piece of brand-new functionality only available in +``yt`` or need to run an old script developed for ``yt-2.x``.  There were major +API and functionality changes made in yt for version 3.0.  For a detailed +description of the changes between versions 2.x (e.g. branch ``yt-2.x``) and 3.x +(e.g. branches ``yt`` and ``stable``) see :ref:`yt3differences`.  Lastly, don't +feel like you're locked into one branch when you install yt, because you can +easily change the active branch by following the instructions in +:ref:`switching-between-yt-versions`.</p>
<pre>.. _install-script:
</pre>
<p>@@ -74,9 +77,8 @@</p>
<pre>Because installation of all of the interlocking parts necessary to install yt
itself can be time-consuming, yt provides an all-in-one installation script</pre>
<p>-which downloads and builds a fully-isolated Python + NumPy + Matplotlib + HDF5 + -Mercurial installation. Since the install script compiles yt's dependencies from -source, you must have C, C++, and optionally Fortran compilers installed. +which downloads and builds a fully-isolated installation of Python that includes +NumPy, Matplotlib, H5py, Mercurial, and yt.</p>
<pre>The install script supports UNIX-like systems, including Linux, OS X, and most
supercomputer and cluster environments. It is particularly suited for deployment</pre>
<p>@@ -94,30 +96,62 @@</p>
<pre>^^^^^^^^^^^^^^^^^^^^^^^^^^

To get the installation script for the ``stable`` branch of the code,</pre>
<p>-download it from: +download it using the following command:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>wget <a href="http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh">http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh</a></p></li></ul>
<p>+  $ wget <a href="http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh">http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh</a></p>
<p>-If you wish to install a different version of yt (see -:ref:`above <branches-of-yt>`), replace ``stable`` with the appropriate -branch name (e.g. ``yt``, ``yt-2.x``) in the path above to get the correct -install script. – -By default, the bash install script will install an array of items, but there -are additional packages that can be downloaded and installed (e.g. SciPy, enzo, -etc.). The script has all of these options at the top of the file. You should be -able to open it and edit it without any knowledge of bash syntax.  To execute -it, run: +If you do not have ``wget``, the following should also work:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>bash install_script.sh</p></li></ul>
<p>+  $ curl -OL <a href="http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh">http://bitbucket.org/yt_analysis/yt/raw/stable/doc/install_script.sh</a> + +If you wish to install a different version of yt (see :ref:`branches-of-yt`), +replace ``stable`` with the appropriate branch name (e.g. ``yt``, ``yt-2.x``) in +the path above to get the correct install script. + +By default, the bash install script will create a python environment based on +the `miniconda python distrubtion <<a href="http://conda.pydata.org/miniconda.html">http://conda.pydata.org/miniconda.html</a>>`_, +and will install yt's dependencies using the `conda +<<a href="http://conda.pydata.org/docs/">http://conda.pydata.org/docs/</a>>`_ package manager. To avoid needing a +compilation environment to run the install script, yt itself will also be +installed using `conda`. + +If you would like to customize your yt installation, you can edit the values of +several variables that are defined at the top of the script. + +If you would like to build yt from source, you will need to edit the install +script and set ``INST_YT_SOURCE=1`` near the top. This will clone a copy of the +yt mercurial repository and build yt form source. The default is +``INST_YT_SOURCE=0``, which installs yt from a binary conda package. + +The install script can also build python and all yt dependencies from source. To +switch to this mode, set ``INST_CONDA=0`` at the top of the install script. If +you choose this mode, you must also set ``INST_YT_SOURCE=1``. + +In addition, you can tell the install script to download and install some +additional packages --- currently these include +`PyX <<a href="http://pyx.sourceforge.net/">http://pyx.sourceforge.net/</a>>`_, the `Rockstar halo +finder <<a href="http://arxiv.org/abs/1110.4372">http://arxiv.org/abs/1110.4372</a>>`_, `SciPy <<a href="https://www.scipy.org/">https://www.scipy.org/</a>>`_, +`Astropy <<a href="http://www.astropy.org/">http://www.astropy.org/</a>>`_, and the necessary dependencies for +:ref:`unstructured mesh rendering <unstructured_mesh_rendering>`. The script has +all of the options for installing optional packages near the top of the +file. You should be able to open it and edit it without any knowledge of bash +syntax. For example, to install scipy, change ``INST_SCIPY=0`` to +``INST_SCIPY=1``. + +To execute the install script, run: + +.. code-block:: bash + +  $ bash install_script.sh</p>
<pre>Because the installer is downloading and building a variety of packages from</pre>
<p>-source, this will likely take a while (e.g. 20 minutes), but you will get -updates of its status at the command line throughout. +source, this will likely take a few minutes, especially if you have a slow +internet connection or have ``INST_CONDA=0`` set. You will get updates of its +status at the command prompt throughout.</p>
<pre>If you receive errors during this process, the installer will provide you
with a large amount of information to assist in debugging your problems.  The</pre>
<p>@@ -127,26 +161,63 @@</p>
<pre>potentially figure out what went wrong.  If you have problems, though, do not
hesitate to :ref:`contact us <asking-for-help>` for assistance.
</pre>
<p>+If the install script errors out with a message about being unable to import the +python SSL bindings, this means that the Python built by the install script was +unable to link against the OpenSSL library. This likely means that you installed +with ``INST_CONDA=0`` on a recent version of OSX, or on a cluster that has a +very out of date installation of OpenSSL. In both of these cases you will either +need to install OpenSSL yourself from the system package manager or consider +using ``INST_CONDA=1``, since conda-based installs can install the conda package +for OpenSSL. +</p>
<pre>.. _activating-yt:

Activating Your Installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once the installation has completed, there will be instructions on how to set up</pre>
<p>-your shell environment to use yt by executing the activate script.  You must -run this script in order to have yt properly recognized by your system.  You can -either add it to your login script, or you must execute it in each shell session -prior to working with yt. +your shell environment to use yt. + +Activating Conda-based installs (``INST_CONDA=1``) +"""""""""""""""""""""""""""""""""""""""""""""""""" + +For conda-based installs, you will need to ensure that the installation's +``yt-conda/bin`` directory is prepended to your ``PATH`` environment variable. + +For Bash-style shells, you can use the following command in a terminal session +to temporarily activate the yt installation:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>source <yt installation directory>/bin/activate</p></li></ul>
<p>+  $ export PATH=/path/to/yt-conda/bin:$PATH + +and on csh-style shells: + +.. code-block:: csh + +  $ setenv PATH /path/to/yt-conda/bin:$PATH + +If you would like to permanently activate yt, you can also update the init file +appropriate for your shell and OS (e.g. .bashrc, .bash_profile, .cshrc, .zshrc) +to include the same command. + +Activating source-based installs (``INST_CONDA=0``) +""""""""""""""""""""""""""""""""""""""""""""""""""" + +For this installation method, you must run an ``activate`` script to activate +the yt environment in a terminal session. You must run this script in order to +have yt properly recognized by your system.  You can either add it to your login +script, or you must execute it in each shell session prior to working with yt. + +.. code-block:: bash + +  $ source <yt installation directory>/bin/activate</p>
<pre>If you use csh or tcsh as your shell, activate that version of the script:

.. code-block:: bash
</pre>
<ul><li><p>source <yt installation directory>/bin/activate.csh</p></li></ul>
<p>+  $ source <yt installation directory>/bin/activate.csh</p>
<pre>If you don't like executing outside scripts on your computer, you can set
the shell variables manually.  ``YT_DEST`` needs to point to the root of the</pre>
<p>@@ -166,14 +237,21 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>yt update</p></li></ul>
<p>+  $ yt update</p>
<p>-Additionally, if you want to make sure you have the latest dependencies -associated with yt and update the codebase simultaneously, type this: +Additionally, if you ran the install script with ``INST_CONDA=0`` and want to +make sure you have the latest dependencies associated with yt and update the +codebase simultaneously, type this:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>yt update --all</p></li></ul>
<p>+  $ yt update --all + +If you ran the install script with ``INST_CONDA=1`` and want to update your dependencies, run: + +.. code-block:: bash + +  $ conda update --all</p>
<pre>.. _removing-yt:
</pre>
<p>@@ -192,35 +270,26 @@</p>
<pre>Installing yt Using Anaconda
++++++++++++++++++++++++++++
</pre>
<p>-Perhaps the quickest way to get yt up and running is to install it using the -`Anaconda Python Distribution <<a href="https://store.continuum.io/cshop/anaconda/">https://store.continuum.io/cshop/anaconda/</a>>`_, -which will provide you with a easy-to-use environment for installing Python -packages. – -If you do not want to install the full anaconda python distribution, you can -install a bare-bones Python installation using miniconda.  To install miniconda, -visit <a href="http://repo.continuum.io/miniconda/">http://repo.continuum.io/miniconda/</a> and download ``Miniconda-latest-…`` -script for your platform and system architecture. Next, run the script, e.g.: – -.. code-block:: bash –</p>
<ul><li><p>bash Miniconda-latest-Linux-x86_64.sh</p></li></ul>
<p>–</p>
<pre>For both the Anaconda and Miniconda installations, make sure that the Anaconda
``bin`` directory is in your path, and then issue:

.. code-block:: bash
</pre>
<ul><li><p>conda install yt</p></li></ul>
<p>+  $ conda install yt</p>
<pre>which will install stable branch of yt along with all of its dependencies.
</pre>
<p>+.. _nightly-conda-builds: + +Nightly Conda Builds +^^^^^^^^^^^^^^^^^^^^ +</p>
<pre>If you would like to install latest development version of yt, you can download
it from our custom anaconda channel:

.. code-block:: bash
</pre>
<ul><li><p>conda install -c <a href="http://use.yt/with_conda/">http://use.yt/with_conda/</a> yt</p></li></ul>
<p>+  $ conda install -c <a href="http://use.yt/with_conda/">http://use.yt/with_conda/</a> yt</p>
<pre>New packages for development branch are built after every pull request is
merged. In order to make sure you are running latest version, it's recommended</pre>
<p>@@ -228,28 +297,26 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>conda update -c <a href="http://use.yt/with_conda/">http://use.yt/with_conda/</a> yt</p></li></ul>
<p>+  $ conda update -c <a href="http://use.yt/with_conda/">http://use.yt/with_conda/</a> yt</p>
<pre>Location of our channel can be added to ``.condarc`` to avoid retyping it during
each *conda* invocation. Please refer to `Conda Manual
<http://conda.pydata.org/docs/config.html#channel-locations-channels>`_ for
detailed instructions.
</pre>
<p>+.. _conda-source-build:</p>
<p>-Obtaining Source Code -^^^^^^^^^^^^^^^^^^^^^ +Building yt from Source For Conda-based Installs +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<p>-There are two ways to get the yt source code when using an Anaconda -installation. – -Option 1: – -Ensure that you have all build dependencies installed in your current +First, ensure that you have all build dependencies installed in your current</p>
<pre>conda environment:

.. code-block:: bash
</pre>
<ul><li><p>conda install cython mercurial sympy ipython h5py matplotlib</p></li></ul>
<p>+  $ conda install cython mercurial sympy ipython matplotlib + +In addition, you will need a C compiler installed.</p>
<pre>.. note::
  </pre>
<p>@@ -260,87 +327,124 @@</p>
<pre>  .. code-block:: bash
</pre>
<ul><li><p>export CONDA_DIR=$(python -c ‘import sys; print(sys.executable.split("/bin/python")[0])’)</p></li>
<li><p>conda create -y -n py27 python=2.7 mercurial</p></li>
<li><p>ln -s ${CONDA_DIR}/envs/py27/bin/hg ${CONDA_DIR}/bin</p></li></ul>
<p>+   $ export CONDA_DIR=$(python -c ‘import sys; print(sys.executable.split("/bin/python")[0])’) +   $ conda create -y -n py27 python=2.7 mercurial +   $ ln -s ${CONDA_DIR}/envs/py27/bin/hg ${CONDA_DIR}/bin</p>
<pre>Clone the yt repository with:

.. code-block:: bash
</pre>
<ul><li><p>hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p></li></ul>
<p>+  $ hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p>
<pre>Once inside the yt directory, update to the appropriate branch and</pre>
<p>-run ``setup.py``. For example, the following commands will allow you +run ``setup.py develop``. For example, the following commands will allow you</p>
<pre>to see the tip of the development branch.

.. code-block:: bash
</pre>
<ul><li><p>hg up yt</p></li>
<li><p>python setup.py develop</p></li></ul>
<p>+  $ hg pull +  $ hg update yt +  $ python setup.py develop</p>
<pre>This will make sure you are running a version of yt corresponding to the
most up-to-date source code.
</pre>
<p>-Option 2: +.. _rockstar-conda:</p>
<p>-Recipes to build conda packages for yt are available at -<a href="https://github.com/conda/conda-recipes">https://github.com/conda/conda-recipes</a>.  To build the yt conda recipe, first -clone the conda-recipes repository +Rockstar Halo Finder for Conda-based installations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The easiest way to set rockstar up in a conda-based python envrionment is to run +the install script with both ``INST_CONDA=1`` and ``INST_ROCKSTAR=1``. + +If you want to do this manually, you will need to follow these +instructions. First, clone Matt Turk's fork of rockstar and compile it:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>git clone <a href="https://github.com/conda/conda-recipes">https://github.com/conda/conda-recipes</a></p></li></ul>
<p>+  $ hg clone <a href="https://bitbucket.org/MatthewTurk/rockstar">https://bitbucket.org/MatthewTurk/rockstar</a> +  $ cd rockstar +  $ make lib</p>
<p>-Then navigate to the repository root and invoke ``conda build``: +Next, copy `librockstar.so` into the `lib` folder of your anaconda installation:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>cd conda-recipes</p></li>
<li><p>conda build ./yt/</p></li></ul>
<p>+  $ cp librockstar.so /path/to/anaconda/lib</p>
<p>-Note that building a yt conda package requires a C compiler. +Finally, you will need to recompile yt to enable the rockstar interface. Clone a +copy of the yt mercurial repository (see :ref:`conda-source-build`), or navigate +to a clone that you have already made, and do the following: + +.. code-block:: bash + +  $ cd /path/to/yt-hg +  $ ./clean.sh +  $ echo /path/to/rockstar > rockstar.cfg +  $ python setup.py develop + +Here ``/path/to/yt-hg`` is the path to your clone of the yt mercurial repository +and ``/path/to/rockstar`` is the path to your clone of Matt Turk's fork of +rockstar. + +Finally, to actually use rockstar, you will need to ensure the folder containing +`librockstar.so` is in your LD_LIBRARY_PATH: + +.. code-block:: bash + +  $ export LD_LIBRARY_PATH=/path/to/anaconda/lib + +You should now be able to enter a python session and import the rockstar +interface: + +.. code-block:: python + +  >>> from yt.analysis_modules.halo_finding.rockstar import rockstar_interface + +If this python import fails, then you have not installed rockstar and yt's +rockstar interface correctly.</p>
<pre>.. _windows-installation:

Installing yt on Windows
^^^^^^^^^^^^^^^^^^^^^^^^
</pre>
<p>-Installation on 64-bit Microsoft Windows platforms is supported using Anaconda (see -:ref:`anaconda-installation`). Also see :ref:`windows-developing` for details on how to build yt -from source in Windows. +Installation on 64-bit Microsoft Windows platforms is supported using Anaconda +(see :ref:`anaconda-installation`). Also see :ref:`windows-developing` for +details on how to build yt from source in Windows.</p>
<pre>.. _source-installation:
</pre>
<p>-Installing yt Using pip or from Source -++++++++++++++++++++++++++++++++++++++ +Installing yt Using ``pip`` or From Source +++++++++++++++++++++++++++++++++++++++++++ + +.. note:: + +  If you wish to install yt from source in a conda-based installation of yt, +  see :ref:`conda-source-build`.</p>
<pre>To install yt from source, you must make sure you have yt's dependencies</pre>
<p>-installed on your system. +installed on your system. Right now, the dependencies to build yt from +source include:</p>
<p>-If you use a Linux OS, use your distro's package manager to install these yt -dependencies on your system: +- ``mercurial`` +- A C compiler such as ``gcc`` or ``clang`` +- ``Python 2.7``, ``Python 3.4``, or ``Python 3.5``</p>
<p>— ``HDF5`` — ``zeromq`` — ``sqlite`` — ``mercurial`` – -Then install the required Python packages with ``pip``: +In addition, building yt from source requires several python packages +which can be installed with ``pip``:</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>$ pip install numpy matplotlib cython h5py nose sympy</p></li></ul>
<p>+  $ pip install numpy matplotlib cython sympy</p>
<p>-If you're using IPython notebooks, you can install its dependencies -with ``pip`` as well: +You may also want to install some of yt's optional dependencies, including +``jupyter``, ``h5py`` (which in turn depends on the HDF5 library), ``scipy``, or +``astropy``,</p>
<p>-.. code-block:: bash –</p>
<ul><li><p>$ pip install ipython[notebook]</p></li></ul>
<p>– -From here, you can use ``pip`` (which comes with ``Python``) to install the latest -stable version of yt: +From here, you can use ``pip`` (which comes with ``Python``) to install the +latest stable version of yt:</p>
<pre>.. code-block:: bash
</pre>
<p>@@ -353,46 +457,30 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p></li>
<li><p>cd yt</p></li>
<li><p>hg update yt</p></li>
<li><p>python setup.py install --user --prefix=</p></li></ul>
<p>+  $ hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a> +  $ cd yt +  $ hg update yt +  $ python setup.py install --user --prefix=</p>
<pre>.. note::
</pre>
<ul><li><p>If you maintain your own user-level python installation separate from the OS-level python</p></li>
<li><p>installation, you can leave off ``--user --prefix=``, although you might need</p></li>
<li><p>``sudo`` depending on where python is installed. See `This StackOverflow</p></li>
<li><p>discussion</p></li></ul>
<p>+  If you maintain your own user-level python installation separate from the +  OS-level python installation, you can leave off ``--user --prefix=``, although +  you might need ``sudo`` depending on where python is installed. See `This +  StackOverflow discussion</p>
<pre>  <http://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install>`_
  if you are curious why ``--prefix=`` is neccessary on some systems.
</pre>
<p>-.. note:: –</p>
<ul><li><p>yt requires version 18.0 or higher of ``setuptools``. If you see</p></li>
<li><p>error messages about this package, you may need to update it. For</p></li>
<li><p>example, with pip via</p></li></ul>
<p>–</p>
<ul><li><p>.. code-block:: bash</p></li></ul>
<p>–</p>
<ul><li><p>pip install --upgrade setuptools</p></li></ul>
<p>–</p>
<ul><li><p>or your preferred method. If you have ``distribute`` installed, you</p></li>
<li><p>may also see error messages for it if it's out of date. You can</p></li>
<li><p>update with pip via</p></li></ul>
<p>–</p>
<ul><li><p>.. code-block:: bash</p></li></ul>
<p>–</p>
<ul><li><p>pip install --upgrade distribute</p></li></ul>
<p>–</p>
<ul><li><p>or via your preferred method.</p></li></ul>
<p>– –</p>
<pre>This will install yt into a folder in your home directory
(``$HOME/.local/lib64/python2.7/site-packages`` on Linux,
``$HOME/Library/Python/2.7/lib/python/site-packages/`` on OSX) Please refer to
the ``setuptools`` documentation for the additional options.
</pre>
<p>+If you are unable to locate the ``yt`` executable (i.e. ``yt version`` failes), +then you likely need to add the ``$HOME/.local/bin`` (or the equivalent on your +OS) to your PATH. Some linux distributions do not include this directory in the +default search path. +</p>
<pre>If you choose this installation method, you do not need to run any activation
script since this will install yt into your global python environment.
</pre>
<p>@@ -401,15 +489,35 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p></li>
<li><p>cd yt</p></li>
<li><p>hg update yt</p></li>
<li><p>python setup.py develop --user --prefix=</p></li></ul>
<p>+  $ hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a> +  $ cd yt +  $ hg update yt +  $ python setup.py develop --user --prefix=</p>
<pre>As above, you can leave off ``--user --prefix=`` if you want to install yt into the default
package install path.  If you do not have write access for this location, you
might need to use ``sudo``.
</pre>
<p>+Build errors with ``setuptools`` or ``distribute`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Building yt requires version 18.0 or higher of ``setuptools``. If you see error +messages about this package, you may need to update it. For example, with pip +via + +.. code-block:: bash + +  $ pip install --upgrade setuptools + +or your preferred method. If you have ``distribute`` installed, you may also see +error messages for it if it's out of date. You can update with pip via + +.. code-block:: bash + +  $ pip install --upgrade distribute + +or via your preferred method. +</p>
<pre>Keeping yt Updated via Mercurial
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
</pre>
<p>@@ -424,7 +532,7 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>yt update</p></li></ul>
<p>+  $ yt update</p>
<pre>This will detect that you have installed yt from the mercurial repository, pull
any changes from Bitbucket, and then recompile yt if necessary.</pre>
<p>@@ -439,7 +547,7 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>yt --help</p></li></ul>
<p>+  $ yt --help</p>
<pre>If this works, you should get a list of the various command-line options for
yt, which means you have successfully installed yt.  Congratulations!</pre>
<p>@@ -453,21 +561,57 @@</p>
<pre>.. _switching-between-yt-versions:
</pre>
<p>-Switching versions of yt: yt-2.x, yt-3.x, stable, and dev ---------------------------------------------------------- +Switching versions of yt: ``yt-2.x``, ``stable``, and ``yt`` branches +---------------------------------------------------------------------</p>
<p>-With the release of version 3.0 of yt, development of the legacy yt 2.x series -has been relegated to bugfixes.  That said, we will continue supporting the 2.x -series for the foreseeable future.  This makes it easy to use scripts written -for older versions of yt without substantially updating them to support the -new field naming or unit systems in yt version 3. +Here we explain how to switch between different development branches of yt.</p>
<p>-Currently, the yt-2.x codebase is contained in a named branch in the yt -mercurial repository.  Thus, depending on the method you used to install -yt, there are different instructions for switching versions. +If You Installed yt Using the Bash Install Script ++++++++++++++++++++++++++++++++++++++++++++++++++</p>
<p>-If You Installed yt Using the Installer Script -++++++++++++++++++++++++++++++++++++++++++++++ +The instructions for how to switch between branches depend on whether you ran +the install script with ``INST_YT_SOURCE=0`` (the default) or +``INST_YT_SOURCE=1``. You can determine which option you used by inspecting the +output: + +.. code-block:: bash + +  $ yt version + +If the output from this command looks like: + +.. code-block:: none + +  The current version and changeset for the code is: + +  --- +  Version = 3.2.3 +  --- + +i.e. it does not refer to a specific changeset hash, then you originally chose +``INST_YT_SOURCE=0``. + +On the other hand, if the output from ``yt version`` looks like: + +.. code-block:: none + +  The current version and changeset for the code is: + +  --- +  Version = 3.3-dev +  Changeset = d8eec89b2c86 (yt) tip +  --- + +i.e. it refers to a specific changeset in the yt mercurial repository, then +you installed using ``INST_YT_SOURCE=1``. + +Conda-based installs (``INST_YT_SOURCE=0``) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In this case you can either install one of the nightly conda builds (see :ref:`nightly-conda-builds`), or you can follow the instructions above to build yt from source under conda (see :ref:`conda-source-build`). + +Source-based installs (``INST_YT_SOURCE=1``) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<pre>You already have the mercurial repository, so you simply need to switch
which version you're using.  Navigate to the root of the yt mercurial</pre>
<p>@@ -476,9 +620,9 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>cd yt-<machine>/src/yt-hg</p></li>
<li><p>hg update <desired-version></p></li>
<li><p>python setup.py develop</p></li></ul>
<p>+  $ cd yt-<machine>/src/yt-hg +  $ hg update <desired-version> +  $ python setup.py develop</p>
<pre>Valid versions to jump to are described in :ref:`branches-of-yt`.
</pre>
<p>@@ -494,8 +638,8 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>pip uninstall yt</p></li>
<li><p>hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p></li></ul>
<p>+  $ pip uninstall yt +  $ hg clone <a href="https://bitbucket.org/yt_analysis/yt">https://bitbucket.org/yt_analysis/yt</a></p>
<pre>Now, to switch between versions, you need to navigate to the root of
the mercurial yt repository. Use mercurial to</pre>
<p>@@ -503,9 +647,9 @@</p>
<pre>.. code-block:: bash
</pre>
<ul><li><p>cd yt</p></li>
<li><p>hg update <desired-version></p></li>
<li><p>python setup.py install --user --prefix=</p></li></ul>
<p>+  $ cd yt +  $ hg update <desired-version> +  $ python setup.py install --user --prefix=</p>
<pre>Valid versions to jump to are described in :ref:`branches-of-yt`).
</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/reference/code_support.rst --- a/doc/source/reference/code_support.rst +++ b/doc/source/reference/code_support.rst @@ -34,6 +34,8 @@</p>
<pre>-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Gadget                |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>+| GAMER                 |     Y      |     N     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   | ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Gasoline              |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Gizmo                 |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e doc/source/visualizing/sketchfab.rst --- a/doc/source/visualizing/sketchfab.rst +++ b/doc/source/visualizing/sketchfab.rst @@ -55,7 +55,7 @@</p>
<pre>.. code-block:: python

   import yt</pre>
<ul><li><p>ds = yt.load("/data/workshop2012/IsolatedGalaxy/galaxy0030/galaxy0030")</p></li></ul>
<p>+   ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")</p>
<pre>   sphere = ds.sphere("max", (1.0, "Mpc"))
   surface = ds.surface(sphere, "density", 1e-27)
</pre>
<p>@@ -113,24 +113,23 @@</p>
<pre>.. code-block:: python
</pre>
<ul><li><p>import yt</p></li>
<li><p>ds = yt.load("redshift0058")</p></li>
<li><p>dd = ds.sphere("max", (200, "kpc"))</p></li>
<li><p>rho = 5e-27</p></li></ul>
<p>+    import yt +    from yt.units import kpc +    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030") +    dd = ds.sphere(ds.domain_center, (500, "kpc")) +    rho = 1e-28</p>
<ul><li><p>bounds = [(dd.center[i] – 100.0/ds['kpc'],</p></li>
<li><p>dd.center[i] + 100.0/ds['kpc']) for i in range(3)]</p></li></ul>
<p>+    bounds = [[dd.center[i] – 250*kpc, dd.center[i] + 250*kpc] for i in range(3)]</p>
<ul><li><p>surf = ds.surface(dd, “density”, rho)</p></li></ul>
<p>+    surf = ds.surface(dd, “density”, rho)</p>
<ul><li><p>upload_id = surf.export_sketchfab(</p></li>
<li><p>title = “RD0058 – 5e-27”,</p></li>
<li><p>description = "Extraction of Density (colored by Temperature) at 5e-27 " \</p></li>
<li><p>+ “g/cc from a galaxy formation simulation by Ryan Joung.”</p></li>
<li><p>color_field = “temperature”,</p></li>
<li><p>color_map = “hot”,</p></li>
<li><p>color_log = True,</p></li>
<li><p>bounds = bounds</p></li></ul>
<p>+    upload_id = surf.export_sketchfab( +        title="galaxy0030 – 1e-28", +        description="Extraction of Density (colored by temperature) at 1e-28 g/cc", +        color_field="temperature", +        color_map="hot", +        color_log=True, +        bounds=bounds</p>
<pre>   )

and yt will extract a surface, convert to a format that Sketchfab.com</pre>
<p>@@ -141,15 +140,13 @@</p>
<pre>.. raw:: html
</pre>
<ul><li><p><iframe frameborder="0" height="480" width="854" allowFullScreen</p></li>
<li><p>webkitallowfullscreen="true" mozallowfullscreen="true"</p></li>
<li><p>src="<a href="http://skfb.ly/l4jh2edcba?autostart=0&transparent=0&autospin=0&controls=1&watermark=1">http://skfb.ly/l4jh2edcba?autostart=0&transparent=0&autospin=0&controls=1&watermark=1</a>"></iframe></p></li></ul>
<p>+     <iframe width="640" height="480" src="<a href="https://sketchfab.com/models/ff59dacd55824110ad5bcc292371a514/embed">https://sketchfab.com/models/ff59dacd55824110ad5bcc292371a514/embed</a>" frameborder="0" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe></p>
<pre>As a note, Sketchfab has a maximum model size of 50MB for the free account.</pre>
<p>-50MB is pretty hefty, though, so it shouldn't be a problem for most needs. -We're working on a way to optionally upload links to the Sketchfab models on -the `yt Hub <<a href="https://hub.yt-project.org/">https://hub.yt-project.org/</a>>`_, but for now, if you want to share -a cool model we'd love to see it! +50MB is pretty hefty, though, so it shouldn't be a problem for most +needs. Additionally, if you have an eligible e-mail address associated with a +school or university, you can request a free professional account, which allows +models up to 200MB. See <a href="https://sketchfab.com/education">https://sketchfab.com/education</a> for details.</p>
<pre>OBJ and MTL Files
-----------------</pre>
<p>@@ -167,7 +164,7 @@</p>
<pre>   import yt
</pre>
<ul><li><p>ds = yt.load("/data/workshop2012/IsolatedGalaxy/galaxy0030/galaxy0030")</p></li></ul>
<p>+   ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")</p>
<pre>rho = [2e-27, 1e-27]
trans = [1.0, 0.5]
filename = './surfaces'</pre>
<p>@@ -239,7 +236,7 @@</p>
<pre>   import yt
</pre>
<ul><li><p>ds = yt.load("/data/workshop2012/IsolatedGalaxy/galaxy0030/galaxy0030")</p></li></ul>
<p>+   ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")</p>
<pre>rho = [2e-27, 1e-27]
trans = [1.0, 0.5]
filename = './surfaces'</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e setup.cfg --- a/setup.cfg +++ b/setup.cfg @@ -10,10 +10,10 @@</p>
<pre>[flake8]
# we exclude:</pre>
<p>-#      api.py and __init__.py files to avoid spurious unused import errors -#      _mpl_imports.py for the same reason +#      api.py, mods.py, _mpl_imports.py, and __init__.py files to avoid spurious +#      unused import errors</p>
<pre>#      autogenerated __config__.py files
#      vendored libraries</pre>
<p>-exclude = */api.py,*/__init__.py,*/__config__.py,yt/visualization/_mpl_imports.py,yt/utilities/lodgeit.py,yt/utilities/poster/*,yt/extern/*,yt/mods.py +exclude = */api.py,*/__init__.py,*/__config__.py,yt/visualization/_mpl_imports.py,yt/utilities/lodgeit.py,yt/utilities/lru_cache.py,yt/utilities/poster/*,yt/extern/*,yt/mods.py</p>
<pre>max-line-length=999
ignore = E111,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E211,E221,E222,E227,E228,E241,E301,E203,E225,E226,E231,E251,E261,E262,E265,E266,E302,E303,E402,E502,E701,E703,E731,W291,W292,W293,W391,W503</pre>
<p>\ No newline at end of file</p>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e setupext.py --- a/setupext.py +++ b/setupext.py @@ -1,10 +1,11 @@</p>
<pre>import os
from pkg_resources import resource_filename
import shutil</pre>
<p>-import subprocess +from subprocess import Popen, PIPE</p>
<pre>import sys
import tempfile
</pre>
<p>+</p>
<pre>def check_for_openmp():
    """Returns True if local setup supports OpenMP, False otherwise"""
</pre>
<p>@@ -37,13 +38,21 @@</p>
<pre>"}"
         )
         file.flush()</pre>
<ul><li><p>with open(os.devnull, ‘w’) as fnull:</p></li>
<li><p>exit_code = subprocess.call(compiler + ['-fopenmp', filename],</p></li>
<li><p>stdout=fnull, stderr=fnull)</p></li></ul>
<p>+        p = Popen(compiler + ['-fopenmp', filename], +                  stdin=PIPE, stdout=PIPE, stderr=PIPE) +        output, err = p.communicate() +        exit_code = p.returncode + +        if exit_code != 0: +            print("Compilation of OpenMP test code failed with the error: ") +            print(err) +            print("Disabling OpenMP support. ")</p>
<pre>    # Clean up
    file.close()
except OSError:</pre>
<p>+        print("check_for_openmp() could not find your C compiler. " +              "Attempted to use ‘%s’. " % compiler)</p>
<pre>    return False
finally:
    os.chdir(curdir)</pre>
<p>@@ -82,12 +91,11 @@</p>
<pre>        except IOError:
            rd = '/usr/local'
</pre>
<ul><li><p>fail_msg = ("Pyembree is installed, but I could not compile Embree test code. \n"</p></li>
<li><p>“I attempted to find Embree headers in %s. \n”</p></li></ul>
<p>+    fail_msg = ("I attempted to find Embree headers in %s. \n"</p>
<pre>"If this is not correct, please set your correct embree location \n"
"using EMBREE_DIR environment variable or your embree.cfg file. \n"
"Please see http://yt-project.org/docs/dev/visualizing/unstructured_mesh_rendering.html "</pre>
<ul><li><p>“for more information.” % rd)</p></li></ul>
<p>+                “for more information. \n” % rd)</p>
<pre># Create a temporary directory
tmpdir = tempfile.mkdtemp()</pre>
<p>@@ -110,23 +118,29 @@</p>
<pre>'}'
         )
         file.flush()</pre>
<ul><li><p>with open(os.devnull, ‘w’) as fnull:</p></li>
<li><p>exit_code = subprocess.call(compiler + ['-I%s/include/' % rd, filename],</p></li>
<li><p>stdout=fnull, stderr=fnull)</p></li></ul>
<p>+        p = Popen(compiler + ['-I%s/include/' % rd, filename], +                  stdin=PIPE, stdout=PIPE, stderr=PIPE) +        output, err = p.communicate() +        exit_code = p.returncode + +        if exit_code != 0: +            print("Pyembree is installed, but I could not compile Embree test code.") +            print("The error message was: ") +            print(err) +            print(fail_msg)</p>
<pre>        # Clean up
        file.close()

    except OSError:</pre>
<ul><li><p>print(fail_msg)</p></li></ul>
<p>+        print("read_embree_location() could not find your C compiler. " +              "Attempted to use ‘%s’. " % compiler) +        return False</p>
<pre>    finally:
        os.chdir(curdir)
        shutil.rmtree(tmpdir)
</pre>
<ul><li><p>if exit_code != 0:</p></li>
<li><p>print(fail_msg)</p></li></ul>
<p>–</p>
<pre>    return rd

</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e tests/tests.yaml --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -20,6 +20,9 @@</p>
<pre>  local_gadget_000:
    - yt/frontends/gadget/tests/test_outputs.py
</pre>
<p>+  local_gamer_000: +    – yt/frontends/gamer/tests/test_outputs.py +</p>
<pre>  local_gdf_000:
    - yt/frontends/gdf/tests/test_outputs.py
</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/analysis_modules/absorption_spectrum/absorption_spectrum.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py @@ -394,7 +394,8 @@</p>
<pre>#    10; this will assure we don't get spikes in the deposited
#    spectra from uneven numbers of vbins per bin
resolution = thermal_width / self.bin_width</pre>
<ul><li><p>n_vbins_per_bin = 10**(np.ceil(np.log10(subgrid_resolution/resolution)).clip(0, np.inf))</p></li></ul>
<p>+            n_vbins_per_bin = (10 ** (np.ceil( np.log10( subgrid_resolution / +                               resolution) ).clip(0, np.inf) ) ).astype('int')</p>
<pre>            vbin_width = self.bin_width.d / n_vbins_per_bin

            # a note to the user about which lines components are unresolved</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py --- a/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py +++ b/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py @@ -176,7 +176,7 @@</p>
<pre>constant_metallicity: float, optional
    If specified, assume a constant metallicity for the emission
    from metals.  The *with_metals* keyword must be set to False</pre>
<ul><li><p>to use this.</p></li></ul>
<p>+        to use this. It should be given in unit of solar metallicity.</p>
<pre>        Default: None.

    This will create three fields:</pre>
<p>@@ -245,7 +245,7 @@</p>
<pre>emiss_name = "xray_emissivity_%s_%s_keV" % (e_min, e_max)
ds.add_field(("gas", emiss_name), function=_emissivity_field,</pre>
<ul><li><p>display_name=r"\epsilon_{X}\ (%s-%s\ keV)" % (e_min, e_max),</p></li></ul>
<p>+                 display_name=r"\epsilon_{X} (%s-%s keV)" % (e_min, e_max),</p>
<pre>                 units="erg/cm**3/s")

    def _luminosity_field(field, data):</pre>
<p>@@ -253,7 +253,7 @@</p>
<pre>lum_name = "xray_luminosity_%s_%s_keV" % (e_min, e_max)
ds.add_field(("gas", lum_name), function=_luminosity_field,</pre>
<ul><li><p>display_name=r"\rm{L}_{X}\ (%s-%s\ keV)" % (e_min, e_max),</p></li></ul>
<p>+                 display_name=r"\rm{L}_{X} (%s-%s keV)" % (e_min, e_max),</p>
<pre>                 units="erg/s")

    def _photon_emissivity_field(field, data):</pre>
<p>@@ -273,7 +273,7 @@</p>
<pre>phot_name = "xray_photon_emissivity_%s_%s_keV" % (e_min, e_max)
ds.add_field(("gas", phot_name), function=_photon_emissivity_field,</pre>
<ul><li><p>display_name=r"\epsilon_{X}\ (%s-%s\ keV)" % (e_min, e_max),</p></li></ul>
<p>+                 display_name=r"\epsilon_{X} (%s-%s keV)" % (e_min, e_max),</p>
<pre>                 units="photons/cm**3/s")

    return emiss_name, lum_name, phot_name</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/data_objects/static_output.py --- a/yt/data_objects/static_output.py +++ b/yt/data_objects/static_output.py @@ -597,7 +597,8 @@</p>
<pre>ftype = self._last_freq[0] or ftype
         field = (ftype, fname)
         if field == self._last_freq:</pre>
<ul><li><p>return self._last_finfo</p></li></ul>
<p>+            if field not in self.field_info.field_aliases.values(): +                return self._last_finfo</p>
<pre>         if field in self.field_info:
self._last_freq = field
self._last_finfo = self.field_info[(ftype, fname)]</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/extern/functools32.py --- a/yt/extern/functools32.py +++ /dev/null @@ -1,423 +0,0 @@ -"""functools.py – Tools for working with functions and callable objects -""" -# Python module wrapper for <em>functools C module -# to allow utilities written in Python to be added -# to the functools module. -# Written by Nick Coghlan <ncoghlan at gmail.com> -# and Raymond Hettinger <python at rcn.com> -#   Copyright © 2006-2010 Python Software Foundation. -# See C source code for <em>functools credits/copyright – -__all</em></em> = ['update_wrapper', ‘wraps’, ‘WRAPPER_ASSIGNMENTS’, ‘WRAPPER_UPDATES’,</p>
<ul><li><p>‘total_ordering’, ‘cmp_to_key’, ‘lru_cache’, ‘reduce’, ‘partial’]</p></li></ul>
<p>– -from _functools import partial, reduce -from collections import MutableMapping, namedtuple -from .reprlib32 import recursive_repr as _recursive_repr -from weakref import proxy as _proxy -import sys as _sys -try:</p>
<ul><li><p>from _thread import allocate_lock as Lock</p></li></ul>
<p>-except:</p>
<ul><li><p>from ._dummy_thread32 import allocate_lock as Lock</p></li></ul>
<p>– -################################################################################ -### OrderedDict -################################################################################ – -class _Link(object):</p>
<ul><li><p><em>_slots</em>_ = ‘prev’, ‘next’, ‘key’, ‘__weakref__’</p></li></ul>
<p>– -class OrderedDict(dict):</p>
<ul><li><p>‘Dictionary that remembers insertion order’</p></li>
<li><p># An inherited dict maps keys to values.</p></li>
<li><p># The inherited dict provides <em>_getitem_</em>, <em>_len_</em>, <em>_contains_</em>, and get.</p></li>
<li><p># The remaining methods are order-aware.</p></li>
<li><p># Big-O running times for all methods are the same as regular dictionaries.</p></li></ul>
<p>–</p>
<ul><li><p># The internal self.__map dict maps keys to links in a doubly linked list.</p></li>
<li><p># The circular doubly linked list starts and ends with a sentinel element.</p></li>
<li><p># The sentinel element never gets deleted (this simplifies the algorithm).</p></li>
<li><p># The sentinel is in self.__hardroot with a weakref proxy in self.__root.</p></li>
<li><p># The prev links are weakref proxies (to prevent circular references).</p></li>
<li><p># Individual links are kept alive by the hard reference in self.__map.</p></li>
<li><p># Those hard references disappear when a key is deleted from an OrderedDict.</p></li></ul>
<p>–</p>
<ul><li><p>def __init__(self, *args, **kwds):</p></li>
<li><p>'''Initialize an ordered dictionary.  The signature is the same as</p></li>
<li><p>regular dictionaries, but keyword arguments are not recommended because</p></li>
<li><p>their insertion order is arbitrary.</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>if len(args) > 1:</p></li>
<li><p>raise TypeError('expected at most 1 arguments, got %d' % len(args))</p></li>
<li><p>try:</p></li>
<li><p>self.__root</p></li>
<li><p>except AttributeError:</p></li>
<li><p>self.__hardroot = _Link()</p></li>
<li><p>self.__root = root = _proxy(self.__hardroot)</p></li>
<li><p>root.prev = root.next = root</p></li>
<li><p>self.__map = {}</p></li>
<li><p>self.__update(*args, **kwds)</p></li></ul>
<p>–</p>
<ul><li><p>def __setitem__(self, key, value,</p></li>
<li><p>dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link):</p></li>
<li><p>‘od.__setitem__(i, y) <==> od[i]=y’</p></li>
<li><p># Setting a new item creates a new link at the end of the linked list,</p></li>
<li><p># and the inherited dictionary is updated with the new key/value pair.</p></li>
<li><p>if key not in self:</p></li>
<li><p>self.__map[key] = link = Link()</p></li>
<li><p>root = self.__root</p></li>
<li><p>last = root.prev</p></li>
<li><p>link.prev, link.next, link.key = last, root, key</p></li>
<li><p>last.next = link</p></li>
<li><p>root.prev = proxy(link)</p></li>
<li><p>dict_setitem(self, key, value)</p></li></ul>
<p>–</p>
<ul><li><p>def __delitem__(self, key, dict_delitem=dict.__delitem__):</p></li>
<li><p>‘od.__delitem__(y) <==> del od[y]’</p></li>
<li><p># Deleting an existing item uses self.__map to find the link which gets</p></li>
<li><p># removed by updating the links in the predecessor and successor nodes.</p></li>
<li><p>dict_delitem(self, key)</p></li>
<li><p>link = self.__map.pop(key)</p></li>
<li><p>link_prev = link.prev</p></li>
<li><p>link_next = link.next</p></li>
<li><p>link_prev.next = link_next</p></li>
<li><p>link_next.prev = link_prev</p></li></ul>
<p>–</p>
<ul><li><p>def __iter__(self):</p></li>
<li><p>‘od.__iter__() <==> iter(od)’</p></li>
<li><p># Traverse the linked list in order.</p></li>
<li><p>root = self.__root</p></li>
<li><p>curr = root.next</p></li>
<li><p>while curr is not root:</p></li>
<li><p>yield curr.key</p></li>
<li><p>curr = curr.next</p></li></ul>
<p>–</p>
<ul><li><p>def __reversed__(self):</p></li>
<li><p>‘od.__reversed__() <==> reversed(od)’</p></li>
<li><p># Traverse the linked list in reverse order.</p></li>
<li><p>root = self.__root</p></li>
<li><p>curr = root.prev</p></li>
<li><p>while curr is not root:</p></li>
<li><p>yield curr.key</p></li>
<li><p>curr = curr.prev</p></li></ul>
<p>–</p>
<ul><li><p>def clear(self):</p></li>
<li><p>‘od.clear() -> None.  Remove all items from od.’</p></li>
<li><p>root = self.__root</p></li>
<li><p>root.prev = root.next = root</p></li>
<li><p>self.__map.clear()</p></li>
<li><p>dict.clear(self)</p></li></ul>
<p>–</p>
<ul><li><p>def popitem(self, last=True):</p></li>
<li><p>'''od.popitem() -> (k, v), return and remove a (key, value) pair.</p></li>
<li><p>Pairs are returned in LIFO order if last is true or FIFO order if false.</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>if not self:</p></li>
<li><p>raise KeyError('dictionary is empty')</p></li>
<li><p>root = self.__root</p></li>
<li><p>if last:</p></li>
<li><p>link = root.prev</p></li>
<li><p>link_prev = link.prev</p></li>
<li><p>link_prev.next = root</p></li>
<li><p>root.prev = link_prev</p></li>
<li><p>else:</p></li>
<li><p>link = root.next</p></li>
<li><p>link_next = link.next</p></li>
<li><p>root.next = link_next</p></li>
<li><p>link_next.prev = root</p></li>
<li><p>key = link.key</p></li>
<li><p>del self.__map[key]</p></li>
<li><p>value = dict.pop(self, key)</p></li>
<li><p>return key, value</p></li></ul>
<p>–</p>
<ul><li><p>def move_to_end(self, key, last=True):</p></li>
<li><p>'''Move an existing element to the end (or beginning if last==False).</p></li></ul>
<p>–</p>
<ul><li><p>Raises KeyError if the element does not exist.</p></li>
<li><p>When last=True, acts like a fast version of self[key]=self.pop(key).</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>link = self.__map[key]</p></li>
<li><p>link_prev = link.prev</p></li>
<li><p>link_next = link.next</p></li>
<li><p>link_prev.next = link_next</p></li>
<li><p>link_next.prev = link_prev</p></li>
<li><p>root = self.__root</p></li>
<li><p>if last:</p></li>
<li><p>last = root.prev</p></li>
<li><p>link.prev = last</p></li>
<li><p>link.next = root</p></li>
<li><p>last.next = root.prev = link</p></li>
<li><p>else:</p></li>
<li><p>first = root.next</p></li>
<li><p>link.prev = root</p></li>
<li><p>link.next = first</p></li>
<li><p>root.next = first.prev = link</p></li></ul>
<p>–</p>
<ul><li><p>def __sizeof__(self):</p></li>
<li><p>sizeof = _sys.getsizeof</p></li>
<li><p>n = len(self) + 1                       # number of links including root</p></li>
<li><p>size = sizeof(self.__dict__)            # instance dictionary</p></li>
<li><p>size += sizeof(self.__map) * 2          # internal dict and inherited dict</p></li>
<li><p>size += sizeof(self.__hardroot) * n     # link objects</p></li>
<li><p>size += sizeof(self.__root) * n         # proxy objects</p></li>
<li><p>return size</p></li></ul>
<p>–</p>
<ul><li><p>update = __update = MutableMapping.update</p></li>
<li><p>keys = MutableMapping.keys</p></li>
<li><p>values = MutableMapping.values</p></li>
<li><p>items = MutableMapping.items</p></li>
<li><p><em>_ne</em>_ = MutableMapping.__ne__</p></li></ul>
<p>–</p>
<ul><li><p>__marker = object()</p></li></ul>
<p>–</p>
<ul><li><p>def pop(self, key, default=__marker):</p></li>
<li><p>'''od.pop(k[,d]) -> v, remove specified key and return the corresponding</p></li>
<li><p>value.  If key is not found, d is returned if given, otherwise KeyError</p></li>
<li><p>is raised.</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>if key in self:</p></li>
<li><p>result = self[key]</p></li>
<li><p>del self[key]</p></li>
<li><p>return result</p></li>
<li><p>if default is self.__marker:</p></li>
<li><p>raise KeyError(key)</p></li>
<li><p>return default</p></li></ul>
<p>–</p>
<ul><li><p>def setdefault(self, key, default=None):</p></li>
<li><p>‘od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od’</p></li>
<li><p>if key in self:</p></li>
<li><p>return self[key]</p></li>
<li><p>self[key] = default</p></li>
<li><p>return default</p></li></ul>
<p>–</p>
<ul><li><p>@_recursive_repr()</p></li>
<li><p>def __repr__(self):</p></li>
<li><p>‘od.__repr__() <==> repr(od)’</p></li>
<li><p>if not self:</p></li>
<li><p>return ‘%s()’ % (self.__class__.__name__,)</p></li>
<li><p>return ‘%s(%r)’ % (self.__class__.__name__, list(self.items()))</p></li></ul>
<p>–</p>
<ul><li><p>def __reduce__(self):</p></li>
<li><p>‘Return state information for pickling’</p></li>
<li><p>items = [[k, self[k]] for k in self]</p></li>
<li><p>inst_dict = vars(self).copy()</p></li>
<li><p>for k in vars(OrderedDict()):</p></li>
<li><p>inst_dict.pop(k, None)</p></li>
<li><p>if inst_dict:</p></li>
<li><p>return (self.__class__, (items,), inst_dict)</p></li>
<li><p>return self.__class__, (items,)</p></li></ul>
<p>–</p>
<ul><li><p>def copy(self):</p></li>
<li><p>‘od.copy() -> a shallow copy of od’</p></li>
<li><p>return self.__class__(self)</p></li></ul>
<p>–</p>
<ul><li><p>@classmethod</p></li>
<li><p>def fromkeys(cls, iterable, value=None):</p></li>
<li><p>'''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.</p></li>
<li><p>If not specified, the value defaults to None.</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>self = cls()</p></li>
<li><p>for key in iterable:</p></li>
<li><p>self[key] = value</p></li>
<li><p>return self</p></li></ul>
<p>–</p>
<ul><li><p>def __eq__(self, other):</p></li>
<li><p>'''od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive</p></li>
<li><p>while comparison to a regular mapping is order-insensitive.</p></li></ul>
<p>–</p>
<ul><li><p>'''</p></li>
<li><p>if isinstance(other, OrderedDict):</p></li>
<li><p>return len(self)==len(other) and \</p></li>
<li><p>all(p==q for p, q in zip(self.items(), other.items()))</p></li>
<li><p>return dict.__eq__(self, other)</p></li></ul>
<p>– -# update_wrapper() and wraps() are tools to help write -# wrapper functions that can handle naive introspection – -WRAPPER_ASSIGNMENTS = ('__module__', ‘__name__’, ‘__doc__’) -WRAPPER_UPDATES = ('__dict__',) -def update_wrapper(wrapper,</p>
<ul><li><p>wrapped,</p></li>
<li><p>assigned = WRAPPER_ASSIGNMENTS,</p></li>
<li><p>updated = WRAPPER_UPDATES):</p></li>
<li><p>"""Update a wrapper function to look like the wrapped function</p></li></ul>
<p>–</p>
<ul><li><p>wrapper is the function to be updated</p></li>
<li><p>wrapped is the original function</p></li>
<li><p>assigned is a tuple naming the attributes assigned directly</p></li>
<li><p>from the wrapped function to the wrapper function (defaults to</p></li>
<li><p>functools.WRAPPER_ASSIGNMENTS)</p></li>
<li><p>updated is a tuple naming the attributes of the wrapper that</p></li>
<li><p>are updated with the corresponding attribute from the wrapped</p></li>
<li><p>function (defaults to functools.WRAPPER_UPDATES)</p></li>
<li><p>"""</p></li>
<li><p>wrapper.__wrapped__ = wrapped</p></li>
<li><p>for attr in assigned:</p></li>
<li><p>try:</p></li>
<li><p>value = getattr(wrapped, attr)</p></li>
<li><p>except AttributeError:</p></li>
<li><p>pass</p></li>
<li><p>else:</p></li>
<li><p>setattr(wrapper, attr, value)</p></li>
<li><p>for attr in updated:</p></li>
<li><p>getattr(wrapper, attr).update(getattr(wrapped, attr, {}))</p></li>
<li><p># Return the wrapper so this can be used as a decorator via partial()</p></li>
<li><p>return wrapper</p></li></ul>
<p>– -def wraps(wrapped,</p>
<ul><li><p>assigned = WRAPPER_ASSIGNMENTS,</p></li>
<li><p>updated = WRAPPER_UPDATES):</p></li>
<li><p>"""Decorator factory to apply update_wrapper() to a wrapper function</p></li></ul>
<p>–</p>
<ul><li><p>Returns a decorator that invokes update_wrapper() with the decorated</p></li>
<li><p>function as the wrapper argument and the arguments to wraps() as the</p></li>
<li><p>remaining arguments. Default arguments are as for update_wrapper().</p></li>
<li><p>This is a convenience function to simplify applying partial() to</p></li>
<li><p>update_wrapper().</p></li>
<li><p>"""</p></li>
<li><p>return partial(update_wrapper, wrapped=wrapped,</p></li>
<li><p>assigned=assigned, updated=updated)</p></li></ul>
<p>– -def total_ordering(cls):</p>
<ul><li><p>"""Class decorator that fills in missing ordering methods"""</p></li>
<li><p>convert = {</p></li>
<li><p>‘__lt__’: [('__gt__', lambda self, other: not (self < other or self == other)),</p></li>
<li><p>('__le__', lambda self, other: self < other or self == other),</p></li>
<li><p>('__ge__', lambda self, other: not self < other)],</p></li>
<li><p>‘__le__’: [('__ge__', lambda self, other: not self <= other or self == other),</p></li>
<li><p>('__lt__', lambda self, other: self <= other and not self == other),</p></li>
<li><p>('__gt__', lambda self, other: not self <= other)],</p></li>
<li><p>‘__gt__’: [('__lt__', lambda self, other: not (self > other or self == other)),</p></li>
<li><p>('__ge__', lambda self, other: self > other or self == other),</p></li>
<li><p>('__le__', lambda self, other: not self > other)],</p></li>
<li><p>‘__ge__’: [('__le__', lambda self, other: (not self >= other) or self == other),</p></li>
<li><p>('__gt__', lambda self, other: self >= other and not self == other),</p></li>
<li><p>('__lt__', lambda self, other: not self >= other)]</p></li>
<li><p>}</p></li>
<li><p>roots = set(dir(cls)) & set(convert)</p></li>
<li><p>if not roots:</p></li>
<li><p>raise ValueError('must define at least one ordering operation: < ><= >=')</p></li>
<li><p>root = max(roots)       # prefer <em>_lt</em>_ to <em>_le</em>_ to <em>_gt</em>_ to <em>_ge</em>_</p></li>
<li><p>for opname, opfunc in convert[root]:</p></li>
<li><p>if opname not in roots:</p></li>
<li><p>opfunc.__name__ = opname</p></li>
<li><p>opfunc.__doc__ = getattr(int, opname).__doc__</p></li>
<li><p>setattr(cls, opname, opfunc)</p></li>
<li><p>return cls</p></li></ul>
<p>– -def cmp_to_key(mycmp):</p>
<ul><li><p>"""Convert a cmp= function into a key= function"""</p></li>
<li><p>class K(object):</p></li>
<li><p><em>_slots</em>_ = ['obj']</p></li>
<li><p>def __init__(self, obj):</p></li>
<li><p>self.obj = obj</p></li>
<li><p>def __lt__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) < 0</p></li>
<li><p>def __gt__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) > 0</p></li>
<li><p>def __eq__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) == 0</p></li>
<li><p>def __le__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) <= 0</p></li>
<li><p>def __ge__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) >= 0</p></li>
<li><p>def __ne__(self, other):</p></li>
<li><p>return mycmp(self.obj, other.obj) != 0</p></li>
<li><p><em>_hash</em>_ = None</p></li>
<li><p>return K</p></li></ul>
<p>– -_CacheInfo = namedtuple("CacheInfo", “hits misses maxsize currsize”) – -def lru_cache(maxsize=100):</p>
<ul><li><p>"""Least-recently-used cache decorator.</p></li></ul>
<p>–</p>
<ul><li><p>If <strong>maxsize</strong> is set to None, the LRU features are disabled and the cache</p></li>
<li><p>can grow without bound.</p></li></ul>
<p>–</p>
<ul><li><p>Arguments to the cached function must be hashable.</p></li></ul>
<p>–</p>
<ul><li><p>View the cache statistics named tuple (hits, misses, maxsize, currsize) with</p></li>
<li><p>f.cache_info().  Clear the cache and statistics with f.cache_clear().</p></li>
<li><p>Access the underlying function with f.__wrapped__.</p></li></ul>
<p>–</p>
<ul><li><p>See:  <a href="http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used">http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used</a></p></li></ul>
<p>–</p>
<ul><li><p>"""</p></li>
<li><p># Users should only access the lru_cache through its public API:</p></li>
<li><p>#       cache_info, cache_clear, and f.__wrapped__</p></li>
<li><p># The internals of the lru_cache are encapsulated for thread safety and</p></li>
<li><p># to allow the implementation to change (including a possible C version).</p></li></ul>
<p>–</p>
<ul><li><p>def decorating_function(user_function,</p></li>
<li><p>tuple=tuple, sorted=sorted, len=len, KeyError=KeyError):</p></li></ul>
<p>–</p>
<ul><li><p>hits, misses = [0], [0]</p></li>
<li><p>kwd_mark = (object(),)          # separates positional and keyword args</p></li>
<li><p>lock = Lock()                   # needed because OrderedDict isn't threadsafe</p></li></ul>
<p>–</p>
<ul><li><p>if maxsize is None:</p></li>
<li><p>cache = dict()              # simple cache without ordering or size limit</p></li></ul>
<p>–</p>
<ul><li><p>@wraps(user_function)</p></li>
<li><p>def wrapper(*args, **kwds):</p></li>
<li><p>key = args</p></li>
<li><p>if kwds:</p></li>
<li><p>key += kwd_mark + tuple(sorted(kwds.items()))</p></li>
<li><p>try:</p></li>
<li><p>result = cache[key]</p></li>
<li><p>hits[0] += 1</p></li>
<li><p>return result</p></li>
<li><p>except KeyError:</p></li>
<li><p>pass</p></li>
<li><p>result = user_function(*args, **kwds)</p></li>
<li><p>cache[key] = result</p></li>
<li><p>misses[0] += 1</p></li>
<li><p>return result</p></li>
<li><p>else:</p></li>
<li><p>cache = OrderedDict()           # ordered least recent to most recent</p></li>
<li><p>cache_popitem = cache.popitem</p></li>
<li><p>cache_renew = cache.move_to_end</p></li></ul>
<p>–</p>
<ul><li><p>@wraps(user_function)</p></li>
<li><p>def wrapper(*args, **kwds):</p></li>
<li><p>key = args</p></li>
<li><p>if kwds:</p></li>
<li><p>key += kwd_mark + tuple(sorted(kwds.items()))</p></li>
<li><p>with lock:</p></li>
<li><p>try:</p></li>
<li><p>result = cache[key]</p></li>
<li><p>cache_renew(key)    # record recent use of this key</p></li>
<li><p>hits[0] += 1</p></li>
<li><p>return result</p></li>
<li><p>except KeyError:</p></li>
<li><p>pass</p></li>
<li><p>result = user_function(*args, **kwds)</p></li>
<li><p>with lock:</p></li>
<li><p>cache[key] = result     # record recent use of this key</p></li>
<li><p>misses[0] += 1</p></li>
<li><p>if len(cache) > maxsize:</p></li>
<li><p>cache_popitem(0)    # purge least recently used cache entry</p></li>
<li><p>return result</p></li></ul>
<p>–</p>
<ul><li><p>def cache_info():</p></li>
<li><p>"""Report cache statistics"""</p></li>
<li><p>with lock:</p></li>
<li><p>return _CacheInfo(hits[0], misses[0], maxsize, len(cache))</p></li></ul>
<p>–</p>
<ul><li><p>def cache_clear():</p></li>
<li><p>"""Clear the cache and cache statistics"""</p></li>
<li><p>with lock:</p></li>
<li><p>cache.clear()</p></li>
<li><p>hits[0] = misses[0] = 0</p></li></ul>
<p>–</p>
<ul><li><p>wrapper.cache_info = cache_info</p></li>
<li><p>wrapper.cache_clear = cache_clear</p></li>
<li><p>return wrapper</p></li></ul>
<p>–</p>
<ul><li><p>return decorating_function</p></li></ul>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/field_aliases.py --- a/yt/fields/field_aliases.py +++ b/yt/fields/field_aliases.py @@ -79,8 +79,8 @@</p>
<pre>("TangentialVelocity",               "tangential_velocity"),
("CuttingPlaneVelocityX",            "cutting_plane_velocity_x"),
("CuttingPlaneVelocityY",            "cutting_plane_velocity_y"),</pre>
<ul><li><p>("CuttingPlaneBX",                   "cutting_plane_bx"),</p></li>
<li><p>("CuttingPlaneBy",                   "cutting_plane_by"),</p></li></ul>
<p>+    ("CuttingPlaneBX",                   “cutting_plane_magnetic_field_x"), +    ("CuttingPlaneBy”,                   "cutting_plane_magnetic_field_y"),</p>
<pre>("MeanMolecularWeight",              "mean_molecular_weight"),
("particle_density",                 "particle_density"),
("ThermalEnergy",                    "thermal_energy"),</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/field_info_container.py --- a/yt/fields/field_info_container.py +++ b/yt/fields/field_info_container.py @@ -253,7 +253,17 @@</p>
<pre>    self[name] = DerivedField(name, f, **kwargs)
    return f
return create_function</pre>
<ul><li><p>self[name] = DerivedField(name, function, **kwargs)</p></li></ul>
<p>+        ptype = kwargs.get("particle_type", False) +        if ptype: +            ftype = ‘all’ +        else: +            ftype = self.ds.default_fluid_type +        if not isinstance(name, tuple) and (ftype, name) not in self: +            tuple_name = (ftype, name) +            self[tuple_name] = DerivedField(tuple_name, function, **kwargs) +            self.alias(name, tuple_name) +        else: +            self[name] = DerivedField(name, function, **kwargs)</p>
<pre>def load_all_plugins(self, ftype="gas"):
    loaded = []</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/fluid_fields.py --- a/yt/fields/fluid_fields.py +++ b/yt/fields/fluid_fields.py @@ -54,6 +54,7 @@</p>
<pre>    unit_system = registry.ds.unit_system

    create_vector_fields(registry, "velocity", unit_system["velocity"], ftype, slice_info)</pre>
<p>+    create_vector_fields(registry, “magnetic_field”, unit_system["magnetic_field"], ftype, slice_info)</p>
<pre>def _cell_mass(field, data):
    return data[ftype, "density"] * data[ftype, "cell_volume"]</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/local_fields.py --- a/yt/fields/local_fields.py +++ b/yt/fields/local_fields.py @@ -25,7 +25,10 @@</p>
<pre>class LocalFieldInfoContainer(FieldInfoContainer):
    def add_field(self, name, function=None, **kwargs):
        if not isinstance(name, tuple):</pre>
<ul><li><p>name = ('gas', name)</p></li></ul>
<p>+            if kwargs.setdefault('particle_type', False): +                name = ('all', name) +            else: +                name = ('gas', name)</p>
<pre>override = kwargs.get("force_override", False)
# Handle the case where the field has already been added.
if not override and name in self:</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/particle_fields.py --- a/yt/fields/particle_fields.py +++ b/yt/fields/particle_fields.py @@ -783,7 +783,8 @@</p>
<pre>mass = data[ptype, mass_name].in_base(unit_system.name)
dens = data[ptype, density_name].in_base(unit_system.name)
quan = data[ptype, smoothed_field]</pre>
<ul><li><p>quan = quan.convert_to_units(field_units)</p></li></ul>
<p>+        if hasattr(quan, "units"): +            quan = quan.convert_to_units(field_units)</p>
<pre>         if smoothing_length_name is None:
hsml = np.zeros(quan.shape, dtype='float64') - 1</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/tests/test_fields.py --- a/yt/fields/tests/test_fields.py +++ b/yt/fields/tests/test_fields.py @@ -4,6 +4,7 @@</p>
<pre>    load
from yt.testing import \
    fake_random_ds, \</pre>
<p>+    fake_particle_ds, \</p>
<pre>assert_almost_equal, \
assert_equal, \
assert_array_almost_equal_nulp, \</pre>
<p>@@ -313,6 +314,28 @@</p>
<pre>    ad['density_alias']
    assert ds.derived_field_list[0] == 'density_alias'
</pre>
<p>+def test_add_field_string_aliasing(): +    ds = fake_random_ds(16) + +    def density_alias(field, data): +        return data['density'] + +    ds.add_field('density_alias', function=density_alias, units='g/cm**3') + +    ds.field_info['density_alias'] +    ds.field_info['gas', ‘density_alias’] + +    ds = fake_particle_ds() + +    def pmass_alias(field, data): +        return data['particle_mass'] + +    ds.add_field('particle_mass_alias', function=pmass_alias, +                 units='g', particle_type=True) + +    ds.field_info['particle_mass_alias'] +    ds.field_info['all', ‘particle_mass_alias’] +</p>
<pre>if __name__ == "__main__":
    setup()</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/fields/vector_operations.py --- a/yt/fields/vector_operations.py +++ b/yt/fields/vector_operations.py @@ -183,13 +183,15 @@</p>
<pre>     def _cp_vectors(ax):
         def _cp_val(field, data):
vec = data.get_field_parameter("cp_%s_vec" % (ax))</pre>
<ul><li><p>bv = data.get_field_parameter("bulk_%s" % basename)</p></li>
<li><p>if bv is None: bv = np.zeros(3)</p></li>
<li><p>tr  = (data[xn] – bv[0]) * vec[0]</p></li>
<li><p>tr += (data[yn] – bv[1]) * vec[1]</p></li>
<li><p>tr += (data[zn] – bv[2]) * vec[2]</p></li></ul>
<p>+            bv = data.get_field_parameter("bulk_%s" % basename, None) +            if bv is None: +                bv = data.ds.arr(np.zeros(3), data[xn].units) +            tr  = (data[xn] – bv[0]) * vec.d[0] +            tr += (data[yn] – bv[1]) * vec.d[1] +            tr += (data[zn] – bv[2]) * vec.d[2]</p>
<pre>return tr
         return _cp_val</pre>
<p>+</p>
<pre>     registry.add_field((ftype, "cutting_plane_%s_x" % basename),
function=_cp_vectors('x'),
units=field_units)</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/frontends/_skeleton/data_structures.py --- a/yt/frontends/_skeleton/data_structures.py +++ b/yt/frontends/_skeleton/data_structures.py @@ -14,6 +14,8 @@</p>
<pre>#-----------------------------------------------------------------------------

import os</pre>
<p>+import numpy as np +import weakref</p>
<pre>from yt.data_objects.grid_patch import \
    AMRGridPatch</pre>
<p>@@ -25,15 +27,12 @@</p>
<pre>class SkeletonGrid(AMRGridPatch):
    _id_offset = 0</pre>
<ul><li><p>def __init__(self, id, index, level, start, dimensions):</p></li></ul>
<p>+    def __init__(self, id, index, level):</p>
<pre>         AMRGridPatch.__init__(self, id, filename=index.index_filename,
index=index)</pre>
<ul><li><p>self.Parent = []</p></li></ul>
<p>+        self.Parent = None</p>
<pre>self.Children = []
self.Level = level</pre>
<ul><li><p>self.start_index = start.copy()</p></li>
<li><p>self.stop_index = self.start_index + dimensions</p></li>
<li><p>self.ActiveDimensions = dimensions.copy()</p></li></ul>
<pre>def __repr__(self):
    return "SkeletonGrid_%04i (%s)" % (self.id, self.ActiveDimensions)</pre>
<p>@@ -43,14 +42,17 @@</p>
<pre>def __init__(self, ds, dataset_type='skeleton'):
    self.dataset_type = dataset_type</pre>
<p>+        self.dataset = weakref.proxy(ds)</p>
<pre># for now, the index file is the dataset!
self.index_filename = self.dataset.parameter_filename
self.directory = os.path.dirname(self.index_filename)</pre>
<p>+        # float type for the simulation edges and must be float64 now +        self.float_type = np.float64</p>
<pre>        GridIndex.__init__(self, ds, dataset_type)

    def _detect_output_fields(self):
        # This needs to set a self.field_list that contains all the available,</pre>
<ul><li><p># on-disk fields.</p></li></ul>
<p>+        # on-disk fields. No derived fields should be defined here.</p>
<pre># NOTE: Each should be a tuple, where the first element is the on-disk
# fluid type or particle type.  Convention suggests that the on-disk
# fluid type is usually the dataset_type and the on-disk particle type</pre>
<p>@@ -69,7 +71,7 @@</p>
<pre>#   self.grid_particle_count    (N, 1) <= int
#   self.grid_levels            (N, 1) <= int
#   self.grids                  (N, 1) <= grid objects</pre>
<ul><li><p>#</p></li></ul>
<p>+        #   self.max_level = self.grid_levels.max()</p>
<pre>        pass

    def _populate_grid_objects(self):</pre>
<p>@@ -94,6 +96,8 @@</p>
<pre>         Dataset.__init__(self, filename, dataset_type,
units_override=units_override)
         self.storage_filename = storage_filename</pre>
<p>+        # refinement factor between a grid and its subgrid +        # self.refine_by = 2</p>
<pre>def _set_code_unit_attributes(self):
    # This is where quantities are created that represent the various</pre>
<p>@@ -114,10 +118,11 @@</p>
<pre>def _parse_parameter_file(self):
    # This needs to set up the following items.  Note that these are all
    # assumed to be in code units; domain_left_edge and domain_right_edge</pre>
<ul><li><p># will be updated to be in code units at a later time.  This includes</p></li>
<li><p># the cosmological parameters.</p></li></ul>
<p>+        # will be converted to YTArray automatically at a later time. +        # This includes the cosmological parameters.</p>
<pre>#</pre>
<ul><li><p>#   self.unique_identifier</p></li></ul>
<p>+        #   self.unique_identifier      <= unique identifier for the dataset +        #                                  being read (e.g., UUID or ST_CTIME)</p>
<pre>#   self.parameters             <= full of code-specific items of use
#   self.domain_left_edge       <= array of float64
#   self.domain_right_edge      <= array of float64</pre>
<p>diff -r e7f00268f51b3c78b0013dffdbb00c87c4e6842c -r a33c31184bc1fe0da3a42fe62b7d8583a730293e yt/frontends/_skeleton/fields.py --- a/yt/frontends/_skeleton/fields.py +++ b/yt/frontends/_skeleton/fields.py @@ -31,13 +31,14 @@</p>
<pre>        # ( "name", ("units", ["fields", "to", "alias"], # "display_name")),
    )
</pre>
<ul><li><p>def __init__(self, ds):</p></li>
<li><p>super(SkeletonFieldInfo, self).__init__(ds)</p></li></ul>
<p>+    def __init__(self, ds, field_list): +        super(SkeletonFieldInfo, self).__init__(ds, field_list)</p>
<pre>        # If you want, you can check self.field_list

    def setup_fluid_fields(self):
        # Here we do anything that might need info about the dataset.</pre>
<ul><li><p># You can use self.alias, self.add_output_field and self.add_field .</p></li></ul>
<p>+        # You can use self.alias, self.add_output_field (for on-disk fields) +        # and self.add_field (for derived fields).</p>
<pre>        pass

    def setup_particle_fields(self, ptype):</pre>
<p>This diff is so big that we needed to truncate the remainder.</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/e936e8f5c538/">https://bitbucket.org/yt_analysis/yt/commits/e936e8f5c538/</a> Changeset:   e936e8f5c538 Branch:      yt User:        chummels Date:        2016-05-11 19:42:34+00:00 Summary:     Adding answer test entry for gizmo Affected #:  1 file</p>
<p>diff -r a33c31184bc1fe0da3a42fe62b7d8583a730293e -r e936e8f5c538cb3a1bc51974c5a3952645ea7397 tests/tests.yaml --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -26,6 +26,9 @@</p>
<pre>  local_gdf_000:
    - yt/frontends/gdf/tests/test_outputs.py
</pre>
<p>+  local_gizmo_000: +    – yt/frontends/gizmo/tests/test_outputs.py +</p>
<pre>local_halos_000:
  - yt/analysis_modules/halo_analysis/tests/test_halo_finders.py  # [py2]
  - yt/analysis_modules/halo_finding/tests/test_rockstar.py  # [py2]</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/9eb20a27b1bd/">https://bitbucket.org/yt_analysis/yt/commits/9eb20a27b1bd/</a> Changeset:   9eb20a27b1bd Branch:      yt User:        brittonsmith Date:        2016-05-12 06:48:59+00:00 Summary:     Fixing color on the bikeshed. Affected #:  2 files</p>
<p>diff -r e936e8f5c538cb3a1bc51974c5a3952645ea7397 -r 9eb20a27b1bdcb344ba338d4a1290511b820c5e6 yt/frontends/api.py --- a/yt/frontends/api.py +++ b/yt/frontends/api.py @@ -25,13 +25,13 @@</p>
<pre>'eagle',
'enzo',
'exodus_ii',</pre>
<ul><li><p>‘fire’, ‘fits’, ‘flash’, ‘gadget’, ‘gadget_fof’, ‘gamer’, ‘gdf’,</p></li></ul>
<p>+    ‘gizmo’,</p>
<pre>'halo_catalog',
'http_stream',
'moab',</pre>
<p>diff -r e936e8f5c538cb3a1bc51974c5a3952645ea7397 -r 9eb20a27b1bdcb344ba338d4a1290511b820c5e6 yt/frontends/gizmo/api.py --- a/yt/frontends/gizmo/api.py +++ b/yt/frontends/gizmo/api.py @@ -1,5 +1,5 @@</p>
<pre>"""</pre>
<p>-API for FIRE frontend. +API for Gizmo frontend.</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/5fa56c085d67/">https://bitbucket.org/yt_analysis/yt/commits/5fa56c085d67/</a> Changeset:   5fa56c085d67 Branch:      yt User:        brittonsmith Date:        2016-05-12 07:07:30+00:00 Summary:     Adding deposited versions of metal fields and gas aliases. Affected #:  1 file</p>
<p>diff -r 9eb20a27b1bdcb344ba338d4a1290511b820c5e6 -r 5fa56c085d67436ce563b68ebd6cdae7147c7bfe yt/frontends/gizmo/fields.py --- a/yt/frontends/gizmo/fields.py +++ b/yt/frontends/gizmo/fields.py @@ -14,6 +14,8 @@</p>
<pre># The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
</pre>
<p>+from yt.fields.particle_fields import \ +    add_volume_weighted_smoothed_field</p>
<pre>from yt.fields.species_fields import \
    add_species_field_by_density
from yt.frontends.gadget.fields import \</pre>
<p>@@ -96,9 +98,19 @@</p>
<pre>            return data[ptype, "density"] * \
              data[ptype, "%s_metallicity" % species]
</pre>
<p>+        num_neighbors = 64</p>
<pre>         for species in self.nuclei_names:
self.add_field(
    (ptype, "%s_nuclei_mass_density" % species),
    function=_nuclei_mass_density_field,
    particle_type=True,
    units=self.ds.unit_system["density"])</pre>
<p>+ +            for suf in ["_nuclei_mass_density", “_metallicity"]: +                field = “%s%s” % (species, suf) +                fn = add_volume_weighted_smoothed_field( +                    ptype, “particle_position”, “particle_mass”, +                    “smoothing_length”, “density”, field, +                    self, num_neighbors) + +                self.alias(("gas”, field), fn[0])</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/ee3d232be4d7/">https://bitbucket.org/yt_analysis/yt/commits/ee3d232be4d7/</a> Changeset:   ee3d232be4d7 Branch:      yt User:        brittonsmith Date:        2016-05-12 15:52:04+00:00 Summary:     Returning metallicity to field list. Affected #:  1 file</p>
<p>diff -r 5fa56c085d67436ce563b68ebd6cdae7147c7bfe -r ee3d232be4d7d3fb014ca89e717cef312d6207d6 yt/frontends/sph/fields.py --- a/yt/frontends/sph/fields.py +++ b/yt/frontends/sph/fields.py @@ -41,6 +41,7 @@</p>
<pre>("Phi", ("code_length", [], None)),
("StarFormationRate", ("Msun / yr", [], None)),
("FormationTime", ("code_time", ["creation_time"], None)),</pre>
<p>+        ("Metallicity_00", ("", ["metallicity"], None)),</p>
<pre>    )

    def setup_particle_fields(self, ptype, *args, **kwargs):</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/e092b580d094/">https://bitbucket.org/yt_analysis/yt/commits/e092b580d094/</a> Changeset:   e092b580d094 Branch:      yt User:        brittonsmith Date:        2016-05-12 15:53:15+00:00 Summary:     Change one more FIRE to Gizmo. Affected #:  1 file</p>
<p>diff -r ee3d232be4d7d3fb014ca89e717cef312d6207d6 -r e092b580d09453c5eb894167a208761d47b594f2 yt/frontends/gizmo/tests/test_outputs.py --- a/yt/frontends/gizmo/tests/test_outputs.py +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -41,7 +41,7 @@</p>
<pre>@requires_ds(FIRE_m12i)
def test_GizmoDataset():
    ds = data_dir_load(FIRE_m12i)</pre>
<ul><li><p>assert isinstance(ds, FIREDataset)</p></li></ul>
<p>+    assert isinstance(ds, GizmoDataset)</p>
<pre>for test in sph_answer(ds, 'FIRE_m12i', 4786950, fields):
    test_GizmoDataset.__name__ = test.description
    yield test</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/09a8105d77d1/">https://bitbucket.org/yt_analysis/yt/commits/09a8105d77d1/</a> Changeset:   09a8105d77d1 Branch:      yt User:        brittonsmith Date:        2016-05-13 09:45:38+00:00 Summary:     Wrong name. Affected #:  1 file</p>
<p>diff -r e092b580d09453c5eb894167a208761d47b594f2 -r 09a8105d77d18f2aacf63da054f78305fe50b395 yt/frontends/gizmo/tests/test_outputs.py --- a/yt/frontends/gizmo/tests/test_outputs.py +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -42,7 +42,7 @@</p>
<pre>def test_GizmoDataset():
    ds = data_dir_load(FIRE_m12i)
    assert isinstance(ds, GizmoDataset)</pre>
<ul><li><p>for test in sph_answer(ds, ‘FIRE_m12i’, 4786950, fields):</p></li></ul>
<p>+    for test in sph_answer(ds, ‘snapshot_600’, 4786950, fields):</p>
<pre>    test_GizmoDataset.__name__ = test.description
    yield test
assert False</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/52544f4f9834/">https://bitbucket.org/yt_analysis/yt/commits/52544f4f9834/</a> Changeset:   52544f4f9834 Branch:      yt User:        brittonsmith Date:        2016-05-13 09:48:59+00:00 Summary:     Changing tests a bit. Affected #:  1 file</p>
<p>diff -r 09a8105d77d18f2aacf63da054f78305fe50b395 -r 52544f4f9834012fbd67f28ba93b6b2149def44c yt/frontends/gizmo/tests/test_outputs.py --- a/yt/frontends/gizmo/tests/test_outputs.py +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -28,13 +28,12 @@</p>
<pre>fields = OrderedDict(
    [
        (("gas", "density"), None),</pre>
<ul><li><p>(("gas", “temperature"), None), (("gas”, "temperature"), ('gas', 'density')),</p></li></ul>
<p>+        (("gas", “metallicity"), ('gas', ‘density')), +        (("gas”, "O_metallicity"), ('gas’, 'density')),</p>
<pre>(('gas', 'velocity_magnitude'), None),</pre>
<ul><li><p>(("deposit", “all_density"), None), (("deposit”, “all_count"), None), (("deposit”, "all_cic"), None),</p></li>
<li><p>(("deposit", "PartType0_density"), None),</p></li></ul>
<pre>    ]
)
</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/bbf532bc0680/">https://bitbucket.org/yt_analysis/yt/commits/bbf532bc0680/</a> Changeset:   bbf532bc0680 Branch:      yt User:        brittonsmith Date:        2016-05-19 09:50:12+00:00 Summary:     Fixing table. Affected #:  1 file</p>
<p>diff -r 52544f4f9834012fbd67f28ba93b6b2149def44c -r bbf532bc0680d70497571a89beafa69aecbcc655 doc/source/reference/code_support.rst --- a/doc/source/reference/code_support.rst +++ b/doc/source/reference/code_support.rst @@ -29,9 +29,9 @@</p>
<pre>| Enzo                  |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| FITS                  |     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |</pre>
<p>-++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+ ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| FLASH                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |</pre>
<p>------------------------+------------+-----------+------------+-------+----------+----------+------------+----------+ ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Gadget                |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| GAMER                 |     Y      |     N     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/436b6de403e8/">https://bitbucket.org/yt_analysis/yt/commits/436b6de403e8/</a> Changeset:   436b6de403e8 Branch:      yt User:        brittonsmith Date:        2016-05-19 15:51:14+00:00 Summary:     Removing explicit test failure. Affected #:  1 file</p>
<p>diff -r bbf532bc0680d70497571a89beafa69aecbcc655 -r 436b6de403e814e6d2bed77f66511ad4f1dff740 yt/frontends/gizmo/tests/test_outputs.py --- a/yt/frontends/gizmo/tests/test_outputs.py +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -44,4 +44,3 @@</p>
<pre>for test in sph_answer(ds, 'snapshot_600', 4786950, fields):
    test_GizmoDataset.__name__ = test.description
    yield test</pre>
<ul><li><p>assert False</p></li></ul>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/b3c23ff06040/">https://bitbucket.org/yt_analysis/yt/commits/b3c23ff06040/</a> Changeset:   b3c23ff06040 Branch:      yt User:        ngoldbaum Date:        2016-05-19 17:43:36+00:00 Summary:     Merged in brittonsmith/yt (pull request #2136)</p>
<p>Adding Gizmo frontend Affected #:  11 files</p>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a doc/source/examining/loading_data.rst --- a/doc/source/examining/loading_data.rst +++ b/doc/source/examining/loading_data.rst @@ -1319,6 +1319,31 @@</p>
<pre>``bbox``
       The bounding box for the particle positions.
</pre>
<p>+.. _loading-gizmo-data: + +Gizmo Data +---------- + +Gizmo datasets, including FIRE outputs, can be loaded into yt in the usual +manner.  Like other SPH data formats, yt loads Gizmo data as particle fields +and then uses smoothing kernels to deposit those fields to an underlying +grid structure as spatial fields as described in :ref:`loading-gadget-data`. +To load Gizmo datasets using the standard HDF5 output format:: + +.. code-block:: python + +   import yt +   ds = yt.load("snapshot_600.hdf5") + +Because the Gizmo output format is similar to the Gadget format, yt +may load Gizmo datasets as Gadget depending on the circumstances, but this +should not pose a problem in most situations.  FIRE outputs will be loaded +accordingly due to the number of metallicity fields found (11 or 17). + +For Gizmo outputs written as raw binary outputs, you may have to specify +a bounding box, field specification, and units as are done for standard +Gadget outputs.  See :ref:`loading-gadget-data` for more information. +</p>
<pre>.. _loading-pyne-data:

Halo Catalog Data</pre>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a doc/source/reference/code_support.rst --- a/doc/source/reference/code_support.rst +++ b/doc/source/reference/code_support.rst @@ -28,16 +28,18 @@</p>
<pre>+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Enzo                  |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>+| FITS                  |     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   | ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| FLASH                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>-| FITS                  |     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   | -+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Gadget                |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| GAMER                 |     Y      |     N     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Gasoline              |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</pre>
<p>+| Gizmo                 |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   | ++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+</p>
<pre>| Grid Data Format (GDF)|     Y      |    N/A    |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
+-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
| Maestro               |   Y [#f1]_ |     N     |      Y     |   Y   |    Y     |    Y     |     N      | Partial  |</pre>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a tests/tests.yaml --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -26,6 +26,9 @@</p>
<pre>  local_gdf_000:
    - yt/frontends/gdf/tests/test_outputs.py
</pre>
<p>+  local_gizmo_000: +    – yt/frontends/gizmo/tests/test_outputs.py +</p>
<pre>local_halos_000:
  - yt/analysis_modules/halo_analysis/tests/test_halo_finders.py  # [py2]
  - yt/analysis_modules/halo_finding/tests/test_rockstar.py  # [py2]</pre>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/api.py --- a/yt/frontends/api.py +++ b/yt/frontends/api.py @@ -31,6 +31,7 @@</p>
<pre>'gadget_fof',
'gamer',
'gdf',</pre>
<p>+    ‘gizmo’,</p>
<pre>'halo_catalog',
'http_stream',
'moab',</pre>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/gizmo/api.py --- /dev/null +++ b/yt/frontends/gizmo/api.py @@ -0,0 +1,21 @@ +""" +API for Gizmo frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from .data_structures import \ +    GizmoDataset + +from .fields import \ +    GizmoFieldInfo</p>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/gizmo/data_structures.py --- /dev/null +++ b/yt/frontends/gizmo/data_structures.py @@ -0,0 +1,44 @@ +""" +Data structures for Gizmo frontend. + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.utilities.on_demand_imports import _h5py as h5py + +from yt.frontends.gadget.data_structures import \ +    GadgetHDF5Dataset + +from .fields import \ +    GizmoFieldInfo + +class GizmoDataset(GadgetHDF5Dataset): +    _field_info_class = GizmoFieldInfo + +    @classmethod +    def _is_valid(self, *args, **kwargs): +        need_groups = ['Header'] +        veto_groups = ['FOF', ‘Group’, ‘Subhalo’] +        valid = True +        try: +            fh = h5py.File(args[0], mode='r') +            valid = all(ng in fh["/"] for ng in need_groups) and \ +              not any(vg in fh["/"] for vg in veto_groups) +            dmetal = “/PartType0/Metallicity” +            if dmetal not in fh or fh[dmetal].shape[1] not in (11, 17): +                valid = False +            fh.close() +        except: +            valid = False +            pass +        return valid</p>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/gizmo/fields.py --- /dev/null +++ b/yt/frontends/gizmo/fields.py @@ -0,0 +1,116 @@ +""" +Gizmo-specific fields + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2016, yt Development Team +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from yt.fields.particle_fields import \ +    add_volume_weighted_smoothed_field +from yt.fields.species_fields import \ +    add_species_field_by_density +from yt.frontends.gadget.fields import \ +    GadgetFieldInfo +from yt.frontends.sph.fields import \ +    SPHFieldInfo + +class GizmoFieldInfo(GadgetFieldInfo): +    known_particle_fields = ( +        ("Mass", ("code_mass", ["particle_mass"], None)), +        ("Masses", ("code_mass", ["particle_mass"], None)), +        ("Coordinates", ("code_length", ["particle_position"], None)), +        ("Velocity", ("code_velocity", ["particle_velocity"], None)), +        ("Velocities", ("code_velocity", ["particle_velocity"], None)), +        ("ParticleIDs", ("", ["particle_index"], None)), +        ("InternalEnergy", ("code_velocity ** 2", ["thermal_energy"], None)), +        ("SmoothingLength", ("code_length", ["smoothing_length"], None)), +        ("Density", ("code_mass / code_length**3", ["density"], None)), +        ("MaximumTemperature", ("K", [], None)), +        ("Temperature", ("K", ["temperature"], None)), +        ("Epsilon", ("code_length", [], None)), +        ("Metals", ("code_metallicity", ["metallicity"], None)), +        ("Metallicity", ("code_metallicity", ["metallicity"], None)), +        ("Phi", ("code_length", [], None)), +        ("StarFormationRate", ("Msun / yr", [], None)), +        ("FormationTime", ("code_time", ["creation_time"], None)), +        ("Metallicity_00", ("", ["metallicity"], None)), +        ("Metallicity_01", ("", ["He_metallicity"], None)), +        ("Metallicity_02", ("", ["C_metallicity"], None)), +        ("Metallicity_03", ("", ["N_metallicity"], None)), +        ("Metallicity_04", ("", ["O_metallicity"], None)), +        ("Metallicity_05", ("", ["Ne_metallicity"], None)), +        ("Metallicity_06", ("", ["Mg_metallicity"], None)), +        ("Metallicity_07", ("", ["Si_metallicity"], None)), +        ("Metallicity_08", ("", ["S_metallicity"], None)), +        ("Metallicity_09", ("", ["Ca_metallicity"], None)), +        ("Metallicity_10", ("", ["Fe_metallicity"], None)), +    ) + +    def __init__(self, *args, **kwargs): +        super(SPHFieldInfo, self).__init__(*args, **kwargs) +        if ("PartType0", “Metallicity_00”) in self.field_list: +            self.nuclei_names = ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”, +                                 “Ca”, “Fe”] + +    def setup_gas_particle_fields(self, ptype): +        super(GizmoFieldInfo, self).setup_gas_particle_fields(ptype) +        self.alias((ptype, “temperature"), (ptype, “Temperature")) + +        def _h_density(field, data): +            x_H = 1.0 – data[(ptype, “He_metallicity")] – \ +              data[(ptype, “metallicity")] +            return x_H * data[(ptype, “density")] * \ +              data[(ptype, “NeutralHydrogenAbundance")] + +        self.add_field( +            (ptype, “H_density"), +            function=_h_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, “H”, particle_type=True) +        for suffix in ["density”, “fraction”, “mass”, “number_density"]: +            self.alias((ptype, “H_p0_%s” % suffix), (ptype, “H_%s” % suffix)) + +        def _h_p1_density(field, data): +            x_H = 1.0 – data[(ptype, “He_metallicity")] – \ +              data[(ptype, “metallicity")] +            return x_H * data[(ptype, “density")] * \ +              (1.0 – data[(ptype, “NeutralHydrogenAbundance")]) + +        self.add_field( +            (ptype, "H_p1_density"), +            function=_h_p1_density, +            particle_type=True, +            units=self.ds.unit_system["density"]) +        add_species_field_by_density(self, ptype, "H_p1”, particle_type=True) + +        def _nuclei_mass_density_field(field, data): +            species = field.name[1][:field.name[1].find("_")] +            return data[ptype, "density”] * \ +              data[ptype, "%s_metallicity” % species] + +        num_neighbors = 64 +        for species in self.nuclei_names: +            self.add_field( +                (ptype, "%s_nuclei_mass_density” % species), +                function=_nuclei_mass_density_field, +                particle_type=True, +                units=self.ds.unit_system["density"]) + +            for suf in ["_nuclei_mass_density”, "_metallicity"]: +                field = "%s%s” % (species, suf) +                fn = add_volume_weighted_smoothed_field( +                    ptype, "particle_position”, "particle_mass”, +                    "smoothing_length”, "density”, field, +                    self, num_neighbors) + +                self.alias(("gas”, field), fn[0])</p>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/gizmo/tests/test_outputs.py --- /dev/null +++ b/yt/frontends/gizmo/tests/test_outputs.py @@ -0,0 +1,46 @@ +""" +Gizmo frontend tests + + + + +""" + +#----------------------------------------------------------------------------- +# Copyright © 2015, yt Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +from collections import OrderedDict + +from yt.utilities.answer_testing.framework import \ +    data_dir_load, \ +    requires_ds, \ +    sph_answer +from yt.frontends.gizmo.api import GizmoDataset + +FIRE_m12i = ‘FIRE_M12i_ref11/snapshot_600.hdf5’ + +# This maps from field names to weight field names to use for projections +fields = OrderedDict( +    [ +        (("gas", “density"), None), +        (("gas”, “temperature"), ('gas', ‘density')), +        (("gas”, “metallicity"), ('gas’, ‘density')), +        (("gas”, “O_metallicity"), ('gas’, ‘density')), +        (('gas’, ‘velocity_magnitude'), None), +        (("deposit”, “all_count"), None), +        (("deposit”, "all_cic"), None), +    ] +) + +@requires_ds(FIRE_m12i) +def test_GizmoDataset(): +    ds = data_dir_load(FIRE_m12i) +    assert isinstance(ds, GizmoDataset) +    for test in sph_answer(ds, 'snapshot_600’, 4786950, fields): +        test_GizmoDataset.__name__ = test.description +        yield test</p>
<p>diff -r de4aaa4344b2ffd78d9e4411074b9b398f5e6ad4 -r b3c23ff06040ef967b7c9ac041d5ad3dc4edb79a yt/frontends/sph/fields.py --- a/yt/frontends/sph/fields.py +++ b/yt/frontends/sph/fields.py @@ -41,27 +41,9 @@</p>
<pre>("Phi", ("code_length", [], None)),
("StarFormationRate", ("Msun / yr", [], None)),
("FormationTime", ("code_time", ["creation_time"], None)),</pre>
<ul><li><p># These are metallicity fields that get discovered for FIRE simulations ("Metallicity_00", ("", ["metallicity"], None)),</p></li>
<li><p>("Metallicity_01", ("", ["He_fraction"], None)),</p></li>
<li><p>("Metallicity_02", ("", ["C_fraction"], None)),</p></li>
<li><p>("Metallicity_03", ("", ["N_fraction"], None)),</p></li>
<li><p>("Metallicity_04", ("", ["O_fraction"], None)),</p></li>
<li><p>("Metallicity_05", ("", ["Ne_fraction"], None)),</p></li>
<li><p>("Metallicity_06", ("", ["Mg_fraction"], None)),</p></li>
<li><p>("Metallicity_07", ("", ["Si_fraction"], None)),</p></li>
<li><p>("Metallicity_08", ("", ["S_fraction"], None)),</p></li>
<li><p>("Metallicity_09", ("", ["Ca_fraction"], None)),</p></li>
<li><p>("Metallicity_10", ("", ["Fe_fraction"], None)),</p></li></ul>
<pre>    )
</pre>
<ul><li><p>def __init__(self, *args, **kwargs):</p></li>
<li><p>super(SPHFieldInfo, self).__init__(*args, **kwargs)</p></li>
<li><p># Special case for FIRE</p></li>
<li><p>if ("PartType0", “Metallicity_00”) in self.field_list:</p></li>
<li><p>self.species_names += ["He", “C”, “N”, “O”, “Ne”, “Mg”, “Si”, “S”,</p></li>
<li><p>“Ca”, “Fe”]</p></li></ul>
<p>–</p>
<pre>def setup_particle_fields(self, ptype, *args, **kwargs):
    super(SPHFieldInfo, self).setup_particle_fields(ptype, *args, **kwargs)
    setup_species_fields(self, ptype)</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27ASCo4ZRgZmv4IKQKjdpoJ55atOC2HWN2i3EAu1tHKSYT-2BV4T7qmeSqOU6StQFsA05bsANQ-2FrZT2JAC-2Fxp0En6qv5bDYPk8vl8aHpdfi5jD1NnMg3BMHHefWDby7KV-2Ffnwy1M0auOjaGiCMDaRay2Zxt7rhwQ4SMicgjdR0t4fjxTN7DT5mm-2Bxno4dGZOzK4-2Bo-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>