Skip to content

Commit

Permalink
enh: add developer mode for loading creep-compliance data (close #14)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 9, 2021
1 parent 02f74d3 commit 504c7f6
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.9.2
- ref: improve speed when displaying QMap data
- enh: add developer mode for loading creep-compliance data (#14)
- setup: bump afmformats from 0.13.3 to 0.14.3 (mostly speed,
support AFM workshop maps)
- setup: bump nanite from 1.7.4 to 1.7.6 (mostly speed)
Expand Down
12 changes: 12 additions & 0 deletions docs/sec_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,15 @@ documentation <nanite:sec_rating>`.
The button at the bottom starts the PyJibe curve rater which is compatible
to the nanite rating workflow. If you would like to import your own training
set, please read the quick guide :ref:`sec_qg_import_ts`.


Developer mode
==============
Under *Edit | Developer mode*, you can enable developer mode which will:

- Allow you to open experimental data that were not recorded via
force-distance modality (e.g. creep-compliance). Related issues are
`nanite #11 <https://github.com/AFM-analysis/nanite/issues/11>`_ and
`afmformats #15 <https://github.com/AFM-analysis/afmformats/issues/15>`_.
- Slow down loading of large datasets (because the modality has to be
determined first).
29 changes: 26 additions & 3 deletions pyjibe/head/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import h5py
import lmfit
import nanite
import nanite.read
import numpy
import scipy
import sklearn
Expand Down Expand Up @@ -67,6 +68,11 @@ def __init__(self, *args, **kwargs):
self.action_open_bulk.triggered.connect(self.on_open_bulk)
self.action_open_single.triggered.connect(self.on_open_single)
self.action_open_multiple.triggered.connect(self.on_open_multiple)
# Edit menu
is_dev_mode = bool(int(self.settings.value("developer mode", "0")))
self.action_developer_mode.setChecked(is_dev_mode)
self.on_developer_mode(is_dev_mode)
self.action_developer_mode.triggered.connect(self.on_developer_mode)
# Tool menu
self.actionConvert_AFM_data.triggered.connect(self.on_tool_convert)
# Help menu
Expand Down Expand Up @@ -146,6 +152,7 @@ def rem_subwindow(self, title):
self.menuExport.removeAction(action)
break

@QtCore.pyqtSlot()
def on_about(self):
about_text = "PyJibe is a user interface for data analysis in " \
+ "atomic force microscopy with an emphasis on biological " \
Expand All @@ -157,10 +164,22 @@ def on_about(self):
"PyJibe {}".format(__version__),
about_text)

@QtCore.pyqtSlot(bool)
def on_developer_mode(self, checked):
# remember in settings
self.settings.setValue("developer mode", str(int(checked)))
# set nanite
if checked:
nanite.read.DEFAULT_MODALITY = None
else:
nanite.read.DEFAULT_MODALITY = "force-distance"

@QtCore.pyqtSlot()
def on_documentation(self):
webbrowser.open("https://pyjibe.readthedocs.io")

def on_open_bulk(self, evt=None):
@QtCore.pyqtSlot()
def on_open_bulk(self):
dlg = custom_widgets.DirectoryDialogMultiSelect(self)
search_dir = self.settings.value("paths/load data", "")
dlg.setDirectory(search_dir)
Expand All @@ -172,7 +191,8 @@ def on_open_bulk(self, evt=None):
self.settings.setValue("paths/load data",
str(dlg.getDirectory()))

def on_open_multiple(self, evt=None):
@QtCore.pyqtSlot()
def on_open_multiple(self):
dlg = custom_widgets.DirectoryDialogMultiSelect(self)
search_dir = self.settings.value("paths/load data", "")
dlg.setDirectory(search_dir)
Expand All @@ -185,7 +205,8 @@ def on_open_multiple(self, evt=None):
self.settings.setValue("paths/load data",
str(dlg.getDirectory()))

def on_open_single(self, evt=None):
@QtCore.pyqtSlot()
def on_open_single(self):
ext_opts = []
# all
exts = ["*"+e for e in registry.known_suffixes]
Expand All @@ -206,6 +227,7 @@ def on_open_single(self, evt=None):
self.settings.setValue("paths/load data",
str(pathlib.Path(n[0]).parent))

@QtCore.pyqtSlot()
def on_software(self):
libs = [afmformats,
h5py,
Expand All @@ -228,6 +250,7 @@ def on_software(self):
"Software",
sw_text)

@QtCore.pyqtSlot()
def on_tool_convert(self):
dlg = ConvertDialog(self)
dlg.show()
Expand Down
15 changes: 15 additions & 0 deletions pyjibe/head/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@
</property>
<addaction name="actionConvert_AFM_data"/>
</widget>
<widget class="QMenu" name="menuPreferences">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="action_developer_mode"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menuPreferences"/>
<addaction name="menuExport"/>
<addaction name="menuTools"/>
<addaction name="menuHelp"/>
Expand Down Expand Up @@ -174,6 +181,14 @@
<string>Convert AFM data</string>
</property>
</action>
<action name="action_developer_mode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Developer mode</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down

0 comments on commit 504c7f6

Please sign in to comment.