[yt-svn] commit/yt: 7 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sun Mar 13 11:22:48 PDT 2016
7 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/50de061d9006/
Changeset: 50de061d9006
Branch: yt
User: atmyers
Date: 2016-03-08 04:45:16+00:00
Summary: Adding a Simulation type for ExodusII Datasets.
Affected #: 2 files
diff -r bdb4a8a9139ed14202d0e55c30eae8a9dc9c0977 -r 50de061d900656293fcfa27311480ca9e85e5a70 yt/frontends/exodus_ii/api.py
--- a/yt/frontends/exodus_ii/api.py
+++ b/yt/frontends/exodus_ii/api.py
@@ -18,6 +18,9 @@
ExodusIIUnstructuredIndex, \
ExodusIIDataset
+from .simulation_handling import \
+ ExodusIISimulation
+
from .fields import \
ExodusIIFieldInfo
diff -r bdb4a8a9139ed14202d0e55c30eae8a9dc9c0977 -r 50de061d900656293fcfa27311480ca9e85e5a70 yt/frontends/exodus_ii/simulation_handling.py
--- /dev/null
+++ b/yt/frontends/exodus_ii/simulation_handling.py
@@ -0,0 +1,95 @@
+import yt
+import glob
+import os
+from yt.extern.six import add_metaclass
+from yt.convenience import \
+ load
+from yt.funcs import \
+ only_on_root
+from yt.utilities.exceptions import \
+ YTOutputNotIdentified
+from yt.utilities.logger import ytLogger as \
+ mylog
+from yt.utilities.parallel_tools.parallel_analysis_interface import \
+ parallel_objects
+from yt.utilities.file_handler import NetCDF4FileHandler
+from yt.data_objects.time_series import \
+ DatasetSeries, \
+ RegisteredSimulationTimeSeries
+from yt.frontends.exodus_ii.api import ExodusIIDataset
+
+
+ at add_metaclass(RegisteredSimulationTimeSeries)
+class ExodusIISimulation(DatasetSeries):
+ r"""
+ Initialize an ExodusII Simulation object.
+
+ Upon creation, the input directoy is searched for valid ExodusIIDatasets.
+ The get_time_series can be used to generate a DatasetSeries object.
+
+ simulation_directory : str
+ The directory that contain the simulation data.
+
+ Examples
+ --------
+ >>> import yt
+ >>> sim = yt.simulation("demo_second", "ExodusII")
+ >>> sim.get_time_series()
+ >>> for ds in sim:
+ ... print ds.current_time
+
+ """
+
+ def __init__(self, simulation_directory, find_outputs=False):
+ self.simulation_directory = simulation_directory
+ fn_pattern = "%s/*" % self.simulation_directory
+ potential_outputs = glob.glob(fn_pattern)
+ self.all_outputs = self._check_for_outputs(potential_outputs)
+ self.all_outputs.sort(key=lambda obj: obj["filename"])
+
+ def get_time_series(self, parallel=False, setup_function=None):
+ r"""
+ Instantiate a DatasetSeries object for a set of outputs.
+
+ If no additional keywords given, a DatasetSeries object will be
+ created with all potential datasets created by the simulation.
+
+ Fine-level filtering is currently not implemented.
+
+ """
+
+ all_outputs = self.all_outputs
+ ds_list = []
+ for output in all_outputs:
+ num_steps = output['num_steps']
+ fn = output['filename']
+ for step in range(num_steps):
+ ds = ExodusIIDataset(fn, step=step)
+ ds_list.append(ds)
+ super(ExodusIISimulation, self).__init__(ds_list,
+ parallel=parallel,
+ setup_function=setup_function)
+
+ def _check_for_outputs(self, potential_outputs):
+ r"""
+ Check a list of files to see if they are valid datasets.
+ """
+
+ only_on_root(mylog.info, "Checking %d potential outputs.",
+ len(potential_outputs))
+
+ my_outputs = {}
+ for my_storage, output in parallel_objects(potential_outputs,
+ storage=my_outputs):
+ if os.path.exists(output):
+ try:
+ ds = load(output)
+ if ds is not None:
+ num_steps = ds.num_steps
+ my_storage.result = {"filename": output,
+ "num_steps": num_steps}
+ except YTOutputNotIdentified:
+ mylog.error("Failed to load %s", output)
+ my_outputs = [my_output for my_output in my_outputs.values() \
+ if my_output is not None]
+ return my_outputs
https://bitbucket.org/yt_analysis/yt/commits/7bc8de0d4ade/
Changeset: 7bc8de0d4ade
Branch: yt
User: atmyers
Date: 2016-03-08 06:46:04+00:00
Summary: remove unused import
Affected #: 1 file
diff -r 50de061d900656293fcfa27311480ca9e85e5a70 -r 7bc8de0d4ade74cc4e2dc2234db7d062f0feadec yt/frontends/exodus_ii/simulation_handling.py
--- a/yt/frontends/exodus_ii/simulation_handling.py
+++ b/yt/frontends/exodus_ii/simulation_handling.py
@@ -12,7 +12,6 @@
mylog
from yt.utilities.parallel_tools.parallel_analysis_interface import \
parallel_objects
-from yt.utilities.file_handler import NetCDF4FileHandler
from yt.data_objects.time_series import \
DatasetSeries, \
RegisteredSimulationTimeSeries
https://bitbucket.org/yt_analysis/yt/commits/fa0e72baeecf/
Changeset: fa0e72baeecf
Branch: yt
User: atmyers
Date: 2016-03-08 08:44:08+00:00
Summary: fix another missing import
Affected #: 1 file
diff -r 7bc8de0d4ade74cc4e2dc2234db7d062f0feadec -r fa0e72baeecf9452942db738e058b7ac5f6d31eb yt/frontends/exodus_ii/simulation_handling.py
--- a/yt/frontends/exodus_ii/simulation_handling.py
+++ b/yt/frontends/exodus_ii/simulation_handling.py
@@ -1,4 +1,3 @@
-import yt
import glob
import os
from yt.extern.six import add_metaclass
https://bitbucket.org/yt_analysis/yt/commits/266ec273c71e/
Changeset: 266ec273c71e
Branch: yt
User: atmyers
Date: 2016-03-10 00:52:07+00:00
Summary: make the position property setter act exactly like set_position.
Affected #: 1 file
diff -r fa0e72baeecf9452942db738e058b7ac5f6d31eb -r 266ec273c71e68aace2ebeb5b88c79aab6cc640d yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -169,7 +169,8 @@
raise RuntimeError(
'Cannot set the camera focus and position to the same value')
self._position = position
- self.switch_orientation()
+ self.switch_orientation(normal_vector=self.focus - self.position,
+ north_vector=None)
def fdel(self):
del self._position
https://bitbucket.org/yt_analysis/yt/commits/827ac2e7a963/
Changeset: 827ac2e7a963
Branch: yt
User: atmyers
Date: 2016-03-10 02:25:17+00:00
Summary: reverting my last change
Affected #: 1 file
diff -r 266ec273c71e68aace2ebeb5b88c79aab6cc640d -r 827ac2e7a9637521cc782d453c45cfb219bbca57 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -169,8 +169,7 @@
raise RuntimeError(
'Cannot set the camera focus and position to the same value')
self._position = position
- self.switch_orientation(normal_vector=self.focus - self.position,
- north_vector=None)
+ self.switch_orientation()
def fdel(self):
del self._position
https://bitbucket.org/yt_analysis/yt/commits/c5eb50569b93/
Changeset: c5eb50569b93
Branch: yt
User: atmyers
Date: 2016-03-13 16:58:39+00:00
Summary: adding a note that there is a Simulation type for Exodus II in the docs.
Affected #: 1 file
diff -r 827ac2e7a9637521cc782d453c45cfb219bbca57 -r c5eb50569b9345adbc3566e9acb6c51046932ac4 doc/source/analyzing/time_series_analysis.rst
--- a/doc/source/analyzing/time_series_analysis.rst
+++ b/doc/source/analyzing/time_series_analysis.rst
@@ -79,7 +79,7 @@
Analyzing an Entire Simulation
------------------------------
-.. note:: Implemented for: Enzo, Gadget, OWLS.
+.. note:: Implemented for the Enzo, Gadget, OWLS, and Exodus II frontends.
The parameter file used to run a simulation contains all the information
necessary to know what datasets should be available. The ``simulation``
https://bitbucket.org/yt_analysis/yt/commits/9c26b9791511/
Changeset: 9c26b9791511
Branch: yt
User: ngoldbaum
Date: 2016-03-13 18:22:41+00:00
Summary: Merged in atmyers/yt (pull request #2030)
Adding a Simulation type for ExodusII Datasets.
Affected #: 4 files
diff -r e93907ab891413d8f78db4aac567852aa7e14cbe -r 9c26b97915111f171177465e79d6381aae16d4f0 doc/source/analyzing/time_series_analysis.rst
--- a/doc/source/analyzing/time_series_analysis.rst
+++ b/doc/source/analyzing/time_series_analysis.rst
@@ -79,7 +79,7 @@
Analyzing an Entire Simulation
------------------------------
-.. note:: Implemented for: Enzo, Gadget, OWLS.
+.. note:: Implemented for the Enzo, Gadget, OWLS, and Exodus II frontends.
The parameter file used to run a simulation contains all the information
necessary to know what datasets should be available. The ``simulation``
diff -r e93907ab891413d8f78db4aac567852aa7e14cbe -r 9c26b97915111f171177465e79d6381aae16d4f0 yt/frontends/exodus_ii/api.py
--- a/yt/frontends/exodus_ii/api.py
+++ b/yt/frontends/exodus_ii/api.py
@@ -18,6 +18,9 @@
ExodusIIUnstructuredIndex, \
ExodusIIDataset
+from .simulation_handling import \
+ ExodusIISimulation
+
from .fields import \
ExodusIIFieldInfo
diff -r e93907ab891413d8f78db4aac567852aa7e14cbe -r 9c26b97915111f171177465e79d6381aae16d4f0 yt/frontends/exodus_ii/simulation_handling.py
--- /dev/null
+++ b/yt/frontends/exodus_ii/simulation_handling.py
@@ -0,0 +1,93 @@
+import glob
+import os
+from yt.extern.six import add_metaclass
+from yt.convenience import \
+ load
+from yt.funcs import \
+ only_on_root
+from yt.utilities.exceptions import \
+ YTOutputNotIdentified
+from yt.utilities.logger import ytLogger as \
+ mylog
+from yt.utilities.parallel_tools.parallel_analysis_interface import \
+ parallel_objects
+from yt.data_objects.time_series import \
+ DatasetSeries, \
+ RegisteredSimulationTimeSeries
+from yt.frontends.exodus_ii.api import ExodusIIDataset
+
+
+ at add_metaclass(RegisteredSimulationTimeSeries)
+class ExodusIISimulation(DatasetSeries):
+ r"""
+ Initialize an ExodusII Simulation object.
+
+ Upon creation, the input directoy is searched for valid ExodusIIDatasets.
+ The get_time_series can be used to generate a DatasetSeries object.
+
+ simulation_directory : str
+ The directory that contain the simulation data.
+
+ Examples
+ --------
+ >>> import yt
+ >>> sim = yt.simulation("demo_second", "ExodusII")
+ >>> sim.get_time_series()
+ >>> for ds in sim:
+ ... print ds.current_time
+
+ """
+
+ def __init__(self, simulation_directory, find_outputs=False):
+ self.simulation_directory = simulation_directory
+ fn_pattern = "%s/*" % self.simulation_directory
+ potential_outputs = glob.glob(fn_pattern)
+ self.all_outputs = self._check_for_outputs(potential_outputs)
+ self.all_outputs.sort(key=lambda obj: obj["filename"])
+
+ def get_time_series(self, parallel=False, setup_function=None):
+ r"""
+ Instantiate a DatasetSeries object for a set of outputs.
+
+ If no additional keywords given, a DatasetSeries object will be
+ created with all potential datasets created by the simulation.
+
+ Fine-level filtering is currently not implemented.
+
+ """
+
+ all_outputs = self.all_outputs
+ ds_list = []
+ for output in all_outputs:
+ num_steps = output['num_steps']
+ fn = output['filename']
+ for step in range(num_steps):
+ ds = ExodusIIDataset(fn, step=step)
+ ds_list.append(ds)
+ super(ExodusIISimulation, self).__init__(ds_list,
+ parallel=parallel,
+ setup_function=setup_function)
+
+ def _check_for_outputs(self, potential_outputs):
+ r"""
+ Check a list of files to see if they are valid datasets.
+ """
+
+ only_on_root(mylog.info, "Checking %d potential outputs.",
+ len(potential_outputs))
+
+ my_outputs = {}
+ for my_storage, output in parallel_objects(potential_outputs,
+ storage=my_outputs):
+ if os.path.exists(output):
+ try:
+ ds = load(output)
+ if ds is not None:
+ num_steps = ds.num_steps
+ my_storage.result = {"filename": output,
+ "num_steps": num_steps}
+ except YTOutputNotIdentified:
+ mylog.error("Failed to load %s", output)
+ my_outputs = [my_output for my_output in my_outputs.values() \
+ if my_output is not None]
+ return my_outputs
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