Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
bugfix: Young's modulus not computed in batch mode (close #149)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed May 3, 2017
1 parent 67aa0fd commit 7f7d7ec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
0.7.4
- Add de-/select all buttons to Batch | Statistical analysis
- Bugfixes:
- Young's modulus not computed in batch mode (#149)
0.7.3
- Add interface to calculate elastic modulus
- Bugfixes:
Expand Down
20 changes: 19 additions & 1 deletion shapeout/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ class Analysis(object):
"""
def __init__(self, data, search_path="./", config={}):
""" Analysis data object.
Parameters
----------
data: str or list of (str, dclab.RTDC_DataSet)
The data to load. The nature of `data` is inferred
from its type:
- str: A session 'index.txt' file
- list: A list of paths of tdms files or RTDC_DataSet
search_path: str
In case `data` is a string, `search_path` is used to
find missing tdms files on disk.
config: dict
A configuration dictionary that will be applied to
each RTDC_DataSet before completing the configuration
and data. The completion of the configuration takes
at the end of the initialization of this class and
the configuration must be applied beforehand to make
sure that parameters such as "emodulus" are computed.
"""
self.measurements = []
if isinstance(data, list):
Expand All @@ -52,7 +70,7 @@ def __init__(self, data, search_path="./", config={}):
raise ValueError("Argument not an index file or list of"+\
" .tdms files: {}".format(data))
# Set configuration (e.g. from previous analysis)
if len(config):
if config:
self.SetParameters(config)
# Complete missing configuration parameters
self._complete_config()
Expand Down
17 changes: 11 additions & 6 deletions shapeout/gui/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,27 @@ def OnBatch(self, e=None):
name = ch.GetName()
if name in col_dict:
columns.append(name)

# Get filter configuration of selected measurement
if self.rbtnhere.GetValue():
mhere = self.analysis.measurements[self.dropdown.GetSelection()]
f_config = mhere.config

# Compute statistics
head = None
rows = []

# Process each tdms file separately to reduce memory usage
for tdms in self.tdms_files:
# Make analysis from tdms file
anal = analysis.Analysis([tdms])
# Apply configuration
anal.SetParameters(f_config)
anal = analysis.Analysis([tdms], config=f_config)
# `Analysis` tries to be as efficient as possible with the data.
# Axes like "emodulus" are not computed unless they are set
# as the plotting axes. To make sure that we compute all data
# before performing statistics, we need to temporarily set the
# plotting axis (issue #149). Since the plotting axes are not
# used in any way in batch analysis, this does not have any
# side effects:
for ax in axes:
anal.SetParameters({"plotting":{"axis x": ax}})
anal._complete_data()
mm = anal.measurements[0]
# Apply filters
mm.ApplyFilter()
Expand Down

0 comments on commit 7f7d7ec

Please sign in to comment.