Skip to content

Commit

Permalink
fix: make sure that AFM metadata contain the spring constant
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 13, 2021
1 parent 62ffdda commit 94d210a
Show file tree
Hide file tree
Showing 4 changed files with 1,273 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
3.1.3
- fix: make sure that AFM metadata contain the spring constant and
raise a MissingMetaDataError if this is not the case
- ref: deprecate `IndentationPreprocessor` class in favor of a more
flat submodule (#17)
3.1.2
Expand Down
20 changes: 20 additions & 0 deletions nanite/group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pathlib

import afmformats
from afmformats.errors import MissingMetaDataError

from .read import get_load_data_modality_kwargs, load_data

Expand Down Expand Up @@ -59,3 +60,22 @@ def __init__(self, path=None, meta_override=None, callback=None):
callback=callback,
**get_load_data_modality_kwargs()
)

def append(self, afmdata):
"""Append a new instance of AFMData
This subclassed method makes sure that "spring constant" is set
if "tip position" has to be computed in the future.
Parameters
----------
afmdata: afmformats.afm_data.AFMData
AFM data
"""
if ("spring constant" not in afmdata.metadata
and "tip position" not in afmdata):
raise MissingMetaDataError(
["spring constant"],
"Please specify the spring constant!")
# Call the original function
super(IndentationGroup, self).append(afmdata)

0 comments on commit 94d210a

Please sign in to comment.