[yt-svn] commit/yt: 4 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Mar 24 08:06:27 PDT 2016


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/2bfe9f0abf0c/
Changeset:   2bfe9f0abf0c
Branch:      yt
User:        MatthewTurk
Date:        2016-03-22 01:43:29+00:00
Summary:     Adding ability to specify DatasetSeries is not a mixed data type.

For cases where identifying and loading datasets can be costly, this caches it.
It defaults to true.  ExodusII in particular can be slow if you're loading lots
of HDF5-based datasets.
Affected #:  1 file

diff -r de823c10fed9f0b5fd4acf0512c45fc7d9cc491a -r 2bfe9f0abf0c84be5440cf3e158bf10bb9a05845 yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -154,8 +154,9 @@
         return ret
 
     def __init__(self, outputs, parallel = True, setup_function = None,
-                 **kwargs):
+                 mixed_dataset_types = False, **kwargs):
         # This is needed to properly set _pre_outputs for Simulation subclasses.
+        self._mixed_dataset_types = mixed_dataset_types
         if iterable(outputs) and not isinstance(outputs, string_types):
             self._pre_outputs = outputs[:]
         self.tasks = AnalysisTaskProxy(self)
@@ -173,7 +174,7 @@
         # We can make this fancier, but this works
         for o in self._pre_outputs:
             if isinstance(o, string_types):
-                ds = load(o, **self.kwargs)
+                ds = self._load(o, **self.kwargs)
                 self._setup_function(ds)
                 yield ds
             else:
@@ -187,7 +188,7 @@
             return DatasetSeries(self._pre_outputs[key], self.parallel)
         o = self._pre_outputs[key]
         if isinstance(o, string_types):
-            o = load(o, **self.kwargs)
+            o = self._load(o, **self.kwargs)
             self._setup_function(o)
         return o
 
@@ -278,7 +279,7 @@
                 sto, output = output
 
             if isinstance(output, string_types):
-                ds = load(output, **self.kwargs)
+                ds = self._load(output, **self.kwargs)
                 self._setup_function(ds)
             else:
                 ds = output
@@ -384,6 +385,16 @@
         obj = cls(filenames, parallel = parallel)
         return obj
 
+    _dataset_cls = None
+    def _load(self, output_fn, **kwargs):
+        if self._dataset_cls is not None:
+            return self._dataset_cls(output_fn, **kwargs)
+        elif self._mixed_dataset_types:
+            return load(output_fn, **kwargs)
+        ds = load(output_fn, **kwargs)
+        self._dataset_cls = ds.__class__
+        return ds
+
 class TimeSeriesQuantitiesContainer(object):
     def __init__(self, data_object, quantities):
         self.data_object = data_object


https://bitbucket.org/yt_analysis/yt/commits/f0c2e2f6f94e/
Changeset:   f0c2e2f6f94e
Branch:      yt
User:        MatthewTurk
Date:        2016-03-24 14:03:31+00:00
Summary:     Adding docstring
Affected #:  1 file

diff -r 2bfe9f0abf0c84be5440cf3e158bf10bb9a05845 -r f0c2e2f6f94e53b807c50825de63796fc2c57f4b yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -123,6 +123,11 @@
         file provided to the loop.
     setup_function : callable, accepts a ds
         This function will be called whenever a dataset is loaded.
+    mixed_dataset_types : True or False, default False
+        If the times of datasets provided are not always going to be generated
+        by the same frontend, this should be True.  Assuming identical datasets
+        will use the frontend Dataset class rather than using ``load``, which
+        provides a considerable speedup in some cases.
 
     Examples
     --------


https://bitbucket.org/yt_analysis/yt/commits/40ea2c54805c/
Changeset:   40ea2c54805c
Branch:      yt
User:        MatthewTurk
Date:        2016-03-24 15:01:02+00:00
Summary:     Rewording
Affected #:  1 file

diff -r f0c2e2f6f94e53b807c50825de63796fc2c57f4b -r 40ea2c54805ced9385cf40630928db33e23c1a38 yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -124,10 +124,9 @@
     setup_function : callable, accepts a ds
         This function will be called whenever a dataset is loaded.
     mixed_dataset_types : True or False, default False
-        If the times of datasets provided are not always going to be generated
-        by the same frontend, this should be True.  Assuming identical datasets
-        will use the frontend Dataset class rather than using ``load``, which
-        provides a considerable speedup in some cases.
+        Set to True if the DatasetSeries will load different dataset types, set
+        to False if loading dataset of a single type as this will result in a
+        considerable speed up from not having to figure out the dataset type.
 
     Examples
     --------


https://bitbucket.org/yt_analysis/yt/commits/f12067d78ef4/
Changeset:   f12067d78ef4
Branch:      yt
User:        chummels
Date:        2016-03-24 15:06:15+00:00
Summary:     Merged in MatthewTurk/yt (pull request #2062)

Adding ability to specify DatasetSeries is not a mixed data type.
Affected #:  1 file

diff -r 66d8895f15b34d51b001a3618ff9c89f5bc765a9 -r f12067d78ef445599aa567bc5e38a6406bef9f06 yt/data_objects/time_series.py
--- a/yt/data_objects/time_series.py
+++ b/yt/data_objects/time_series.py
@@ -123,6 +123,10 @@
         file provided to the loop.
     setup_function : callable, accepts a ds
         This function will be called whenever a dataset is loaded.
+    mixed_dataset_types : True or False, default False
+        Set to True if the DatasetSeries will load different dataset types, set
+        to False if loading dataset of a single type as this will result in a
+        considerable speed up from not having to figure out the dataset type.
 
     Examples
     --------
@@ -154,8 +158,9 @@
         return ret
 
     def __init__(self, outputs, parallel = True, setup_function = None,
-                 **kwargs):
+                 mixed_dataset_types = False, **kwargs):
         # This is needed to properly set _pre_outputs for Simulation subclasses.
+        self._mixed_dataset_types = mixed_dataset_types
         if iterable(outputs) and not isinstance(outputs, string_types):
             self._pre_outputs = outputs[:]
         self.tasks = AnalysisTaskProxy(self)
@@ -173,7 +178,7 @@
         # We can make this fancier, but this works
         for o in self._pre_outputs:
             if isinstance(o, string_types):
-                ds = load(o, **self.kwargs)
+                ds = self._load(o, **self.kwargs)
                 self._setup_function(ds)
                 yield ds
             else:
@@ -187,7 +192,7 @@
             return DatasetSeries(self._pre_outputs[key], self.parallel)
         o = self._pre_outputs[key]
         if isinstance(o, string_types):
-            o = load(o, **self.kwargs)
+            o = self._load(o, **self.kwargs)
             self._setup_function(o)
         return o
 
@@ -278,7 +283,7 @@
                 sto, output = output
 
             if isinstance(output, string_types):
-                ds = load(output, **self.kwargs)
+                ds = self._load(output, **self.kwargs)
                 self._setup_function(ds)
             else:
                 ds = output
@@ -384,6 +389,16 @@
         obj = cls(filenames, parallel = parallel)
         return obj
 
+    _dataset_cls = None
+    def _load(self, output_fn, **kwargs):
+        if self._dataset_cls is not None:
+            return self._dataset_cls(output_fn, **kwargs)
+        elif self._mixed_dataset_types:
+            return load(output_fn, **kwargs)
+        ds = load(output_fn, **kwargs)
+        self._dataset_cls = ds.__class__
+        return ds
+
 class TimeSeriesQuantitiesContainer(object):
     def __init__(self, data_object, quantities):
         self.data_object = data_object

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160324/3d33a18d/attachment.html>


More information about the yt-svn mailing list