It seems that in Mayavi, the lower and upper thresholds reset
to a different range when stepping through a timeseries, which
is quite annoying. I realize that this happens because the range
of values changes from step to step, but it'd still be nice to
have the option of stepping through a fixed threshold range.
I've added two checkboxes to the Threshold class so I can control
which of the upper/lower thresholds to fix. Mostly, I've been using
this for visualizing how an error field evolves through time by
cutting off all values less than some fixed value and by allowing
the upper threshold to reset itself. That way, I can easily
visualize the space-time distribution of the large errors greater
than my lower threshold value.
I've attached a quick and dirty implementation of this idea
that is good enough for my purposes. Hopefully this sounds useful
enough to get added into the Mayavi svn eventually!
-Luis
Index: threshold.py
===================================================================
--- threshold.py (revision 12760)
+++ threshold.py (working copy)
@@ -40,9 +40,15 @@
high_name='_data_max',
desc='the upper threshold of the filter')
+ # Whether to reset the ranges or not
+ reset_lower = Bool(True)
+ reset_upper = Bool(True)
+
# Our view.
view = View(Group(Item(name='lower_threshold'),
- Item(name='upper_threshold'))
+ Item(name='upper_threshold')),
+ Group(Item(name='reset_lower'),
+ Item(name='reset_upper')),
)
########################################
@@ -141,10 +147,14 @@
data_range = cs.range
if len(data_range) > 0:
- self._data_min, self._data_max = dr = data_range
+ dr = data_range
if self._first:
- self.set(lower_threshold = dr[0], trait_change_notify=False)
- self.upper_threshold = dr[1]
+ if self.reset_lower:
+ self._data_min = dr[0]
+ self.set(lower_threshold = dr[0],
trait_change_notify=False)
+ if self.reset_upper:
+ self._data_max = dr[1]
+ self.upper_threshold = dr[1]
def _threshold_filter_changed(self, old, new):
if old is not None:
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users