Skip to content

Commit

Permalink
enh: write maximum indentation in statistics (close #3) and minor bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 29, 2019
1 parent 93dee35 commit c76ef1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.5.4
- enh: write maximum indentation to statistics file (#3)
- fix: unicode characters were not read correctly from statistics
file by libre office (added UTF-8 BOM)
0.5.3
- enh: improved visualization of meta data parameters in the Info tab
- setup: bump afmformats from 0.3.0 to 0.4.1
Expand Down
16 changes: 15 additions & 1 deletion pyjibe/fd/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ def save_tsv_approach_retract(filename, fdist_list, ratings=[]):
[np.nan]*len(fdist_list)])
columns.append(["Y Position",
[np.nan]*len(fdist_list)])
# Add maximum indentation
maxindent = []
for fd in fdist_list:
if "tip position" in fd:
cp = fd.fit_properties["params_fitted"]["contact_point"].value
idmax = fd.data.appr["fit"].argmax()
mi = fd.data.appr["tip position"][idmax]
mival = (cp-mi)*1e6
else:
mival = np.nan
maxindent.append(mival)
columns.append(["Maximum indentation [µm]", maxindent])
# Add fit parameters
model_key = fdist_list[0].fit_properties["model_key"]
model = nmodel.models_available[model_key]
Expand Down Expand Up @@ -53,7 +65,9 @@ def save_tsv(filename, column_lists):
E.g.: ["Column One", [1.1, 2.2, 3.3, 4.4],
"Column Two", [nan, 2.0, 4.0, 1.0]]
"""
with codecs.open(filename, "w", encoding="utf-8") as fd:
with codecs.open(filename, "wb") as fd:
fd.write(codecs.BOM_UTF8)
with codecs.open(filename, "a", encoding="utf-8") as fd:
# Write header:
header = "\t".join([d[0] for d in column_lists])
fd.write(header+"\r\n")
Expand Down

0 comments on commit c76ef1f

Please sign in to comment.