Skip to content

Commit c76ef1f

Browse files
committed
enh: write maximum indentation in statistics (close #3) and minor bugfix
1 parent 93dee35 commit c76ef1f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.5.4
2+
- enh: write maximum indentation to statistics file (#3)
3+
- fix: unicode characters were not read correctly from statistics
4+
file by libre office (added UTF-8 BOM)
15
0.5.3
26
- enh: improved visualization of meta data parameters in the Info tab
37
- setup: bump afmformats from 0.3.0 to 0.4.1

pyjibe/fd/export.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ def save_tsv_approach_retract(filename, fdist_list, ratings=[]):
2020
[np.nan]*len(fdist_list)])
2121
columns.append(["Y Position",
2222
[np.nan]*len(fdist_list)])
23+
# Add maximum indentation
24+
maxindent = []
25+
for fd in fdist_list:
26+
if "tip position" in fd:
27+
cp = fd.fit_properties["params_fitted"]["contact_point"].value
28+
idmax = fd.data.appr["fit"].argmax()
29+
mi = fd.data.appr["tip position"][idmax]
30+
mival = (cp-mi)*1e6
31+
else:
32+
mival = np.nan
33+
maxindent.append(mival)
34+
columns.append(["Maximum indentation [µm]", maxindent])
2335
# Add fit parameters
2436
model_key = fdist_list[0].fit_properties["model_key"]
2537
model = nmodel.models_available[model_key]
@@ -53,7 +65,9 @@ def save_tsv(filename, column_lists):
5365
E.g.: ["Column One", [1.1, 2.2, 3.3, 4.4],
5466
"Column Two", [nan, 2.0, 4.0, 1.0]]
5567
"""
56-
with codecs.open(filename, "w", encoding="utf-8") as fd:
68+
with codecs.open(filename, "wb") as fd:
69+
fd.write(codecs.BOM_UTF8)
70+
with codecs.open(filename, "a", encoding="utf-8") as fd:
5771
# Write header:
5872
header = "\t".join([d[0] for d in column_lists])
5973
fd.write(header+"\r\n")

0 commit comments

Comments
 (0)