[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Oct 10 03:24:02 PDT 2014
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/3e959f1b402c/
Changeset: 3e959f1b402c
Branch: yt
User: ngoldbaum
Date: 2014-10-08 03:33:25+00:00
Summary: Removing out of date references from generic data loading docstrings.
Affected #: 1 file
diff -r 0f7b97ccc551773ca725ba3209d0364b391793af -r 3e959f1b402ca5265a7d426c9fa26c5e004c9b41 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -763,12 +763,13 @@
... dimensions = [32, 32, 32],
... number_of_particles = 0)
... ]
- ...
+ ...
>>> for g in grid_data:
- ... g["Density"] = np.random.random(g["dimensions"]) * 2**g["level"]
+ ... g["density"] = np.random.random(g["dimensions"]) * 2**g["level"]
...
- >>> units = dict(Density='g/cm**3')
- >>> ds = load_amr_grids(grid_data, [32, 32, 32], 1.0)
+ >>> units = dict(density='g/cm**3')
+ >>> ds = load_amr_grids(grid_data, [8, 8, 8], field_units=units,
+ ... length_unit=1.0)
"""
domain_dimensions = np.array(domain_dimensions)
@@ -1018,7 +1019,7 @@
magnetic_unit : float
Conversion factor from simulation magnetic units to gauss
bbox : array_like (xdim:zdim, LE:RE), optional
- Size of computational domain in units sim_unit_to_cm
+ Size of computational domain in units of the length_unit
sim_time : float, optional
The simulation time in seconds
periodicity : tuple of booleans
@@ -1191,10 +1192,8 @@
coordinates : array_like
This should be of size (M,3) where M is the number of vertices
indicated in the connectivity matrix.
- sim_unit_to_cm : float
- Conversion factor from simulation units to centimeters
bbox : array_like (xdim:zdim, LE:RE), optional
- Size of computational domain in units sim_unit_to_cm
+ Size of computational domain in units of the length unit.
sim_time : float, optional
The simulation time in seconds
mass_unit : string
https://bitbucket.org/yt_analysis/yt/commits/02e605456bfd/
Changeset: 02e605456bfd
Branch: yt
User: ngoldbaum
Date: 2014-10-08 03:34:01+00:00
Summary: Check all grids for fields in load_amr_grids.
Affected #: 1 file
diff -r 3e959f1b402ca5265a7d426c9fa26c5e004c9b41 -r 02e605456bfdd7c7c9b9ebb9fea56648bb0d8b76 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -364,8 +364,10 @@
_additional_fields = ()
@property
- def all_fields(self):
- fields = list(self._additional_fields) + self[0].keys()
+ def all_fields(self):
+ self_fields = chain.from_iterable(s.keys() for s in self.values())
+ self_fields = list(set(self_fields))
+ fields = list(self._additional_fields) + self_fields
fields = list(set(fields))
return fields
@@ -471,8 +473,9 @@
field_units[k] = v.units
new_data[k] = v.copy().d
data = new_data
- elif all([isinstance(val, np.ndarray) for val in data.values()]):
+ elif all([iterable(val) for val in data.values()]):
field_units = {field:'' for field in data.keys()}
+ data = dict((field, np.array(val)) for field, val in data.iteritems())
elif all([(len(val) == 2) for val in data.values()]):
new_data, field_units = {}, {}
for field in data:
@@ -823,6 +826,11 @@
if magnetic_unit is None:
magnetic_unit = 'code_magnetic'
+ particle_types = {}
+
+ for grid in grid_data:
+ particle_types.update(set_particle_types(grid))
+
handler = StreamHandler(
grid_left_edges,
grid_right_edges,
@@ -834,7 +842,7 @@
sfh,
field_units,
(length_unit, mass_unit, time_unit, velocity_unit, magnetic_unit),
- particle_types=set_particle_types(grid_data[0])
+ particle_types=particle_types
)
handler.name = "AMRGridData"
https://bitbucket.org/yt_analysis/yt/commits/4929d05bcfaa/
Changeset: 4929d05bcfaa
Branch: yt
User: ngoldbaum
Date: 2014-10-08 05:07:30+00:00
Summary: Fix test failures.
Affected #: 1 file
diff -r 02e605456bfdd7c7c9b9ebb9fea56648bb0d8b76 -r 4929d05bcfaa8e416c99cdb6967d57813df6cb16 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -473,9 +473,6 @@
field_units[k] = v.units
new_data[k] = v.copy().d
data = new_data
- elif all([iterable(val) for val in data.values()]):
- field_units = {field:'' for field in data.keys()}
- data = dict((field, np.array(val)) for field, val in data.iteritems())
elif all([(len(val) == 2) for val in data.values()]):
new_data, field_units = {}, {}
for field in data:
@@ -492,6 +489,9 @@
raise RuntimeError("The data dict appears to be invalid.\n" +
str(e))
data = new_data
+ elif all([iterable(val) for val in data.values()]):
+ field_units = {field:'' for field in data.keys()}
+ data = dict((field, np.array(val)) for field, val in data.iteritems())
else:
raise RuntimeError("The data dict appears to be invalid. "
"The data dictionary must map from field "
https://bitbucket.org/yt_analysis/yt/commits/5ba254a71989/
Changeset: 5ba254a71989
Branch: yt
User: MatthewTurk
Date: 2014-10-10 10:23:53+00:00
Summary: Merged in ngoldbaum/yt (pull request #1242)
Generic data loading fixes
Affected #: 1 file
diff -r 88b61bedaddf676bf3499a6c52e4a14aa28e1ee9 -r 5ba254a71989d47a89c40e81c3cdefd710ee8341 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -364,8 +364,10 @@
_additional_fields = ()
@property
- def all_fields(self):
- fields = list(self._additional_fields) + self[0].keys()
+ def all_fields(self):
+ self_fields = chain.from_iterable(s.keys() for s in self.values())
+ self_fields = list(set(self_fields))
+ fields = list(self._additional_fields) + self_fields
fields = list(set(fields))
return fields
@@ -471,8 +473,6 @@
field_units[k] = v.units
new_data[k] = v.copy().d
data = new_data
- elif all([isinstance(val, np.ndarray) for val in data.values()]):
- field_units = {field:'' for field in data.keys()}
elif all([(len(val) == 2) for val in data.values()]):
new_data, field_units = {}, {}
for field in data:
@@ -489,6 +489,9 @@
raise RuntimeError("The data dict appears to be invalid.\n" +
str(e))
data = new_data
+ elif all([iterable(val) for val in data.values()]):
+ field_units = {field:'' for field in data.keys()}
+ data = dict((field, np.array(val)) for field, val in data.iteritems())
else:
raise RuntimeError("The data dict appears to be invalid. "
"The data dictionary must map from field "
@@ -763,12 +766,13 @@
... dimensions = [32, 32, 32],
... number_of_particles = 0)
... ]
- ...
+ ...
>>> for g in grid_data:
- ... g["Density"] = np.random.random(g["dimensions"]) * 2**g["level"]
+ ... g["density"] = np.random.random(g["dimensions"]) * 2**g["level"]
...
- >>> units = dict(Density='g/cm**3')
- >>> ds = load_amr_grids(grid_data, [32, 32, 32], 1.0)
+ >>> units = dict(density='g/cm**3')
+ >>> ds = load_amr_grids(grid_data, [8, 8, 8], field_units=units,
+ ... length_unit=1.0)
"""
domain_dimensions = np.array(domain_dimensions)
@@ -822,6 +826,11 @@
if magnetic_unit is None:
magnetic_unit = 'code_magnetic'
+ particle_types = {}
+
+ for grid in grid_data:
+ particle_types.update(set_particle_types(grid))
+
handler = StreamHandler(
grid_left_edges,
grid_right_edges,
@@ -833,7 +842,7 @@
sfh,
field_units,
(length_unit, mass_unit, time_unit, velocity_unit, magnetic_unit),
- particle_types=set_particle_types(grid_data[0])
+ particle_types=particle_types
)
handler.name = "AMRGridData"
@@ -1018,7 +1027,7 @@
magnetic_unit : float
Conversion factor from simulation magnetic units to gauss
bbox : array_like (xdim:zdim, LE:RE), optional
- Size of computational domain in units sim_unit_to_cm
+ Size of computational domain in units of the length_unit
sim_time : float, optional
The simulation time in seconds
periodicity : tuple of booleans
@@ -1191,10 +1200,8 @@
coordinates : array_like
This should be of size (M,3) where M is the number of vertices
indicated in the connectivity matrix.
- sim_unit_to_cm : float
- Conversion factor from simulation units to centimeters
bbox : array_like (xdim:zdim, LE:RE), optional
- Size of computational domain in units sim_unit_to_cm
+ Size of computational domain in units of the length unit.
sim_time : float, optional
The simulation time in seconds
mass_unit : string
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