[yt-svn] commit/yt: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jan 10 08:34:45 PST 2014
5 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/a308a8d60859/
Changeset: a308a8d60859
Branch: yt-3.0
User: MatthewTurk
Date: 2014-01-06 19:19:38
Summary: Adding on header_spec option to GadgetStaticOutput.
Affected #: 2 files
diff -r 009bbf295f0a1dcb3a48ecd51c848294fd815992 -r a308a8d60859efa017eb486e38652d097b735cf0 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -22,6 +22,7 @@
import glob
import time
import os
+import types
from yt.utilities.fortran_utils import read_record
from yt.utilities.logger import ytLogger as mylog
@@ -50,6 +51,8 @@
from yt.fields.particle_fields import \
particle_deposition_functions, \
standard_particle_fields
+from .definitions import \
+ gadget_header_specs
try:
import requests
@@ -147,29 +150,16 @@
_particle_coordinates_name = "Coordinates"
_particle_velocity_name = "Velocities"
_suffix = ""
- _header_spec = (('Npart', 6, 'i'),
- ('Massarr', 6, 'd'),
- ('Time', 1, 'd'),
- ('Redshift', 1, 'd'),
- ('FlagSfr', 1, 'i'),
- ('FlagFeedback', 1, 'i'),
- ('Nall', 6, 'i'),
- ('FlagCooling', 1, 'i'),
- ('NumFiles', 1, 'i'),
- ('BoxSize', 1, 'd'),
- ('Omega0', 1, 'd'),
- ('OmegaLambda', 1, 'd'),
- ('HubbleParam', 1, 'd'),
- ('FlagAge', 1, 'i'),
- ('FlagMEtals', 1, 'i'),
- ('NallHW', 6, 'i'),
- ('unused', 16, 'i'))
def __init__(self, filename, data_style="gadget_binary",
additional_fields=(),
unit_base=None, n_ref=64,
over_refine_factor=1,
- bounding_box = None):
+ bounding_box = None,
+ header_spec = "default"):
+ if isinstance(header_spec, types.StringTypes):
+ header_spec = gadget_header_specs[header_spec]
+ self._header_spec = header_spec
self.n_ref = n_ref
self.over_refine_factor = over_refine_factor
self.storage_filename = None
diff -r 009bbf295f0a1dcb3a48ecd51c848294fd815992 -r a308a8d60859efa017eb486e38652d097b735cf0 yt/frontends/sph/definitions.py
--- a/yt/frontends/sph/definitions.py
+++ b/yt/frontends/sph/definitions.py
@@ -3,3 +3,22 @@
ghdf5_ptypes = ("PartType0", "PartType1", "PartType2", "PartType3",
"PartType4", "PartType5")
+gadget_header_specs = dict(
+ default = (('Npart', 6, 'i'),
+ ('Massarr', 6, 'd'),
+ ('Time', 1, 'd'),
+ ('Redshift', 1, 'd'),
+ ('FlagSfr', 1, 'i'),
+ ('FlagFeedback', 1, 'i'),
+ ('Nall', 6, 'i'),
+ ('FlagCooling', 1, 'i'),
+ ('NumFiles', 1, 'i'),
+ ('BoxSize', 1, 'd'),
+ ('Omega0', 1, 'd'),
+ ('OmegaLambda', 1, 'd'),
+ ('HubbleParam', 1, 'd'),
+ ('FlagAge', 1, 'i'),
+ ('FlagMEtals', 1, 'i'),
+ ('NallHW', 6, 'i'),
+ ('unused', 16, 'i')),
+)
https://bitbucket.org/yt_analysis/yt/commits/15f55316da00/
Changeset: 15f55316da00
Branch: yt-3.0
User: MatthewTurk
Date: 2014-01-06 19:24:26
Summary: Enable easy concatenation.
Affected #: 1 file
diff -r a308a8d60859efa017eb486e38652d097b735cf0 -r 15f55316da00a69a16a5e6d408f66b9a741f09ae yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -158,7 +158,10 @@
bounding_box = None,
header_spec = "default"):
if isinstance(header_spec, types.StringTypes):
- header_spec = gadget_header_specs[header_spec]
+ _hs = ()
+ for hs in header_spec.split("+"):
+ _hs += gadget_header_specs[hs]
+ header_spec = _hs
self._header_spec = header_spec
self.n_ref = n_ref
self.over_refine_factor = over_refine_factor
https://bitbucket.org/yt_analysis/yt/commits/049480feed22/
Changeset: 049480feed22
Branch: yt-3.0
User: MatthewTurk
Date: 2014-01-06 19:25:21
Summary: Adding a few pad headers.
Affected #: 1 file
diff -r 15f55316da00a69a16a5e6d408f66b9a741f09ae -r 049480feed224450dbe987b58ed44de775ccfe1c yt/frontends/sph/definitions.py
--- a/yt/frontends/sph/definitions.py
+++ b/yt/frontends/sph/definitions.py
@@ -21,4 +21,8 @@
('FlagMEtals', 1, 'i'),
('NallHW', 6, 'i'),
('unused', 16, 'i')),
+ pad32 = (('empty', 32, 'c'),),
+ pad64 = (('empty', 64, 'c'),),
+ pad128 = (('empty', 128, 'c'),),
+ pad256 = (('empty', 256, 'c'),),
)
https://bitbucket.org/yt_analysis/yt/commits/468f1f23d156/
Changeset: 468f1f23d156
Branch: yt-3.0
User: MatthewTurk
Date: 2014-01-07 18:37:33
Summary: Add header_spec, field_spec, ptype_spec options to GadgetStaticOutput.
Affected #: 3 files
diff -r 049480feed224450dbe987b58ed44de775ccfe1c -r 468f1f23d156cba617f9b4338bfa3269dbebe65f yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -52,7 +52,9 @@
particle_deposition_functions, \
standard_particle_fields
from .definitions import \
- gadget_header_specs
+ gadget_header_specs, \
+ gadget_field_specs, \
+ gadget_ptype_specs
try:
import requests
@@ -156,13 +158,15 @@
unit_base=None, n_ref=64,
over_refine_factor=1,
bounding_box = None,
- header_spec = "default"):
- if isinstance(header_spec, types.StringTypes):
- _hs = ()
- for hs in header_spec.split("+"):
- _hs += gadget_header_specs[hs]
- header_spec = _hs
- self._header_spec = header_spec
+ header_spec = "default",
+ field_spec = "default",
+ ptype_spec = "default"):
+ self._header_spec = self._setup_binary_spec(
+ header_spec, gadget_header_specs)
+ self._field_spec = self._setup_binary_spec(
+ field_spec, gadget_field_specs)
+ self._ptype_spec = self._setup_binary_spec(
+ ptype_spec, gadget_ptype_specs)
self.n_ref = n_ref
self.over_refine_factor = over_refine_factor
self.storage_filename = None
@@ -181,6 +185,14 @@
self.domain_left_edge = self.domain_right_edge = None
super(GadgetStaticOutput, self).__init__(filename, data_style)
+ def _setup_binary_spec(self, spec, spec_dict):
+ if isinstance(spec, types.StringTypes):
+ _hs = ()
+ for hs in spec.split("+"):
+ _hs += spec_dict[hs]
+ spec = _hs
+ return spec
+
def __repr__(self):
return os.path.basename(self.parameter_filename).split(".")[0]
diff -r 049480feed224450dbe987b58ed44de775ccfe1c -r 468f1f23d156cba617f9b4338bfa3269dbebe65f yt/frontends/sph/definitions.py
--- a/yt/frontends/sph/definitions.py
+++ b/yt/frontends/sph/definitions.py
@@ -26,3 +26,23 @@
pad128 = (('empty', 128, 'c'),),
pad256 = (('empty', 256, 'c'),),
)
+
+gadget_ptype_specs = dict(
+ default = ( "Gas",
+ "Halo",
+ "Disk",
+ "Bulge",
+ "Stars",
+ "Bndry" )
+)
+
+gadget_field_specs = dict(
+ default = ( "Coordinates",
+ "Velocities",
+ "ParticleIDs",
+ "Mass",
+ ("InternalEnergy", "Gas"),
+ ("Density", "Gas"),
+ ("SmoothingLength", "Gas"),
+ )
+)
diff -r 049480feed224450dbe987b58ed44de775ccfe1c -r 468f1f23d156cba617f9b4338bfa3269dbebe65f yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -174,12 +174,6 @@
_vector_fields = ("Coordinates", "Velocity", "Velocities")
# Particle types (Table 3 in GADGET-2 user guide)
- _ptypes = ( "Gas",
- "Halo",
- "Disk",
- "Bulge",
- "Stars",
- "Bndry" )
#
# Blocks in the file:
# HEAD
@@ -195,16 +189,12 @@
# ENDT (only if enabled in makefile)
# TSTP (only if enabled in makefile)
- _fields = ( "Coordinates",
- "Velocities",
- "ParticleIDs",
- "Mass",
- ("InternalEnergy", "Gas"),
- ("Density", "Gas"),
- ("SmoothingLength", "Gas"),
- )
+ _var_mass = None
- _var_mass = None
+ def __init__(self, pf, *args, **kwargs):
+ self._fields = pf._field_spec
+ self._ptypes = pf._ptype_spec
+ super(IOHandlerGadgetBinary, self).__init__(pf, *args, **kwargs)
@property
def var_mass(self):
https://bitbucket.org/yt_analysis/yt/commits/d5cca31212f2/
Changeset: d5cca31212f2
Branch: yt-3.0
User: MatthewTurk
Date: 2014-01-10 17:34:40
Summary: Merged in MatthewTurk/yt/yt-3.0 (pull request #683)
Enable on-the-fly gadget header specification
Affected #: 3 files
diff -r 4547da83703b0fa9d84b2b51ae0fd03bf5ce537f -r d5cca31212f24b464e89554730af34d462225165 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -22,6 +22,7 @@
import glob
import time
import os
+import types
from yt.utilities.fortran_utils import read_record
from yt.utilities.logger import ytLogger as mylog
@@ -50,6 +51,10 @@
from yt.fields.particle_fields import \
particle_deposition_functions, \
standard_particle_fields
+from .definitions import \
+ gadget_header_specs, \
+ gadget_field_specs, \
+ gadget_ptype_specs
try:
import requests
@@ -147,29 +152,21 @@
_particle_coordinates_name = "Coordinates"
_particle_velocity_name = "Velocities"
_suffix = ""
- _header_spec = (('Npart', 6, 'i'),
- ('Massarr', 6, 'd'),
- ('Time', 1, 'd'),
- ('Redshift', 1, 'd'),
- ('FlagSfr', 1, 'i'),
- ('FlagFeedback', 1, 'i'),
- ('Nall', 6, 'i'),
- ('FlagCooling', 1, 'i'),
- ('NumFiles', 1, 'i'),
- ('BoxSize', 1, 'd'),
- ('Omega0', 1, 'd'),
- ('OmegaLambda', 1, 'd'),
- ('HubbleParam', 1, 'd'),
- ('FlagAge', 1, 'i'),
- ('FlagMEtals', 1, 'i'),
- ('NallHW', 6, 'i'),
- ('unused', 16, 'i'))
def __init__(self, filename, data_style="gadget_binary",
additional_fields=(),
unit_base=None, n_ref=64,
over_refine_factor=1,
- bounding_box = None):
+ bounding_box = None,
+ header_spec = "default",
+ field_spec = "default",
+ ptype_spec = "default"):
+ self._header_spec = self._setup_binary_spec(
+ header_spec, gadget_header_specs)
+ self._field_spec = self._setup_binary_spec(
+ field_spec, gadget_field_specs)
+ self._ptype_spec = self._setup_binary_spec(
+ ptype_spec, gadget_ptype_specs)
self.n_ref = n_ref
self.over_refine_factor = over_refine_factor
self.storage_filename = None
@@ -188,6 +185,14 @@
self.domain_left_edge = self.domain_right_edge = None
super(GadgetStaticOutput, self).__init__(filename, data_style)
+ def _setup_binary_spec(self, spec, spec_dict):
+ if isinstance(spec, types.StringTypes):
+ _hs = ()
+ for hs in spec.split("+"):
+ _hs += spec_dict[hs]
+ spec = _hs
+ return spec
+
def __repr__(self):
return os.path.basename(self.parameter_filename).split(".")[0]
diff -r 4547da83703b0fa9d84b2b51ae0fd03bf5ce537f -r d5cca31212f24b464e89554730af34d462225165 yt/frontends/sph/definitions.py
--- a/yt/frontends/sph/definitions.py
+++ b/yt/frontends/sph/definitions.py
@@ -3,3 +3,46 @@
ghdf5_ptypes = ("PartType0", "PartType1", "PartType2", "PartType3",
"PartType4", "PartType5")
+gadget_header_specs = dict(
+ default = (('Npart', 6, 'i'),
+ ('Massarr', 6, 'd'),
+ ('Time', 1, 'd'),
+ ('Redshift', 1, 'd'),
+ ('FlagSfr', 1, 'i'),
+ ('FlagFeedback', 1, 'i'),
+ ('Nall', 6, 'i'),
+ ('FlagCooling', 1, 'i'),
+ ('NumFiles', 1, 'i'),
+ ('BoxSize', 1, 'd'),
+ ('Omega0', 1, 'd'),
+ ('OmegaLambda', 1, 'd'),
+ ('HubbleParam', 1, 'd'),
+ ('FlagAge', 1, 'i'),
+ ('FlagMEtals', 1, 'i'),
+ ('NallHW', 6, 'i'),
+ ('unused', 16, 'i')),
+ pad32 = (('empty', 32, 'c'),),
+ pad64 = (('empty', 64, 'c'),),
+ pad128 = (('empty', 128, 'c'),),
+ pad256 = (('empty', 256, 'c'),),
+)
+
+gadget_ptype_specs = dict(
+ default = ( "Gas",
+ "Halo",
+ "Disk",
+ "Bulge",
+ "Stars",
+ "Bndry" )
+)
+
+gadget_field_specs = dict(
+ default = ( "Coordinates",
+ "Velocities",
+ "ParticleIDs",
+ "Mass",
+ ("InternalEnergy", "Gas"),
+ ("Density", "Gas"),
+ ("SmoothingLength", "Gas"),
+ )
+)
diff -r 4547da83703b0fa9d84b2b51ae0fd03bf5ce537f -r d5cca31212f24b464e89554730af34d462225165 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -174,12 +174,6 @@
_vector_fields = ("Coordinates", "Velocity", "Velocities")
# Particle types (Table 3 in GADGET-2 user guide)
- _ptypes = ( "Gas",
- "Halo",
- "Disk",
- "Bulge",
- "Stars",
- "Bndry" )
#
# Blocks in the file:
# HEAD
@@ -195,16 +189,12 @@
# ENDT (only if enabled in makefile)
# TSTP (only if enabled in makefile)
- _fields = ( "Coordinates",
- "Velocities",
- "ParticleIDs",
- "Mass",
- ("InternalEnergy", "Gas"),
- ("Density", "Gas"),
- ("SmoothingLength", "Gas"),
- )
+ _var_mass = None
- _var_mass = None
+ def __init__(self, pf, *args, **kwargs):
+ self._fields = pf._field_spec
+ self._ptypes = pf._ptype_spec
+ super(IOHandlerGadgetBinary, self).__init__(pf, *args, **kwargs)
@property
def var_mass(self):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list