<html><body>
<p>1 new commit in yt:</p>
<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-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27B6MoJiIElDZ-2Bgkudb93bOi3ViA9iel2CCOhMYMb5T-2BA-2FCphPxtr7eenRH-2Bqzv8RvrLPrRpj02bcz8vfHLUA5Rh4poywpaEU62SA0vWSXJ3UQlOGKhCiakyJjtqPTFySgljiOONQdieQ5rNiqjs0bgXakYSo7i-2FhA9CS5UFvcGADHGMnIo7l2PbKHI85jbTpiY-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>