Skip to content

Commit 504c7f6

Browse files
committed
enh: add developer mode for loading creep-compliance data (close #14)
1 parent 02f74d3 commit 504c7f6

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
0.9.2
22
- ref: improve speed when displaying QMap data
3+
- enh: add developer mode for loading creep-compliance data (#14)
34
- setup: bump afmformats from 0.13.3 to 0.14.3 (mostly speed,
45
support AFM workshop maps)
56
- setup: bump nanite from 1.7.4 to 1.7.6 (mostly speed)

docs/sec_interface.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,15 @@ documentation <nanite:sec_rating>`.
244244
The button at the bottom starts the PyJibe curve rater which is compatible
245245
to the nanite rating workflow. If you would like to import your own training
246246
set, please read the quick guide :ref:`sec_qg_import_ts`.
247+
248+
249+
Developer mode
250+
==============
251+
Under *Edit | Developer mode*, you can enable developer mode which will:
252+
253+
- Allow you to open experimental data that were not recorded via
254+
force-distance modality (e.g. creep-compliance). Related issues are
255+
`nanite #11 <https://github.com/AFM-analysis/nanite/issues/11>`_ and
256+
`afmformats #15 <https://github.com/AFM-analysis/afmformats/issues/15>`_.
257+
- Slow down loading of large datasets (because the modality has to be
258+
determined first).

pyjibe/head/main.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import h5py
1616
import lmfit
1717
import nanite
18+
import nanite.read
1819
import numpy
1920
import scipy
2021
import sklearn
@@ -67,6 +68,11 @@ def __init__(self, *args, **kwargs):
6768
self.action_open_bulk.triggered.connect(self.on_open_bulk)
6869
self.action_open_single.triggered.connect(self.on_open_single)
6970
self.action_open_multiple.triggered.connect(self.on_open_multiple)
71+
# Edit menu
72+
is_dev_mode = bool(int(self.settings.value("developer mode", "0")))
73+
self.action_developer_mode.setChecked(is_dev_mode)
74+
self.on_developer_mode(is_dev_mode)
75+
self.action_developer_mode.triggered.connect(self.on_developer_mode)
7076
# Tool menu
7177
self.actionConvert_AFM_data.triggered.connect(self.on_tool_convert)
7278
# Help menu
@@ -146,6 +152,7 @@ def rem_subwindow(self, title):
146152
self.menuExport.removeAction(action)
147153
break
148154

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

167+
@QtCore.pyqtSlot(bool)
168+
def on_developer_mode(self, checked):
169+
# remember in settings
170+
self.settings.setValue("developer mode", str(int(checked)))
171+
# set nanite
172+
if checked:
173+
nanite.read.DEFAULT_MODALITY = None
174+
else:
175+
nanite.read.DEFAULT_MODALITY = "force-distance"
176+
177+
@QtCore.pyqtSlot()
160178
def on_documentation(self):
161179
webbrowser.open("https://pyjibe.readthedocs.io")
162180

163-
def on_open_bulk(self, evt=None):
181+
@QtCore.pyqtSlot()
182+
def on_open_bulk(self):
164183
dlg = custom_widgets.DirectoryDialogMultiSelect(self)
165184
search_dir = self.settings.value("paths/load data", "")
166185
dlg.setDirectory(search_dir)
@@ -172,7 +191,8 @@ def on_open_bulk(self, evt=None):
172191
self.settings.setValue("paths/load data",
173192
str(dlg.getDirectory()))
174193

175-
def on_open_multiple(self, evt=None):
194+
@QtCore.pyqtSlot()
195+
def on_open_multiple(self):
176196
dlg = custom_widgets.DirectoryDialogMultiSelect(self)
177197
search_dir = self.settings.value("paths/load data", "")
178198
dlg.setDirectory(search_dir)
@@ -185,7 +205,8 @@ def on_open_multiple(self, evt=None):
185205
self.settings.setValue("paths/load data",
186206
str(dlg.getDirectory()))
187207

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

230+
@QtCore.pyqtSlot()
209231
def on_software(self):
210232
libs = [afmformats,
211233
h5py,
@@ -228,6 +250,7 @@ def on_software(self):
228250
"Software",
229251
sw_text)
230252

253+
@QtCore.pyqtSlot()
231254
def on_tool_convert(self):
232255
dlg = ConvertDialog(self)
233256
dlg.show()

pyjibe/head/main.ui

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@
109109
</property>
110110
<addaction name="actionConvert_AFM_data"/>
111111
</widget>
112+
<widget class="QMenu" name="menuPreferences">
113+
<property name="title">
114+
<string>&amp;Edit</string>
115+
</property>
116+
<addaction name="action_developer_mode"/>
117+
</widget>
112118
<addaction name="menu_File"/>
119+
<addaction name="menuPreferences"/>
113120
<addaction name="menuExport"/>
114121
<addaction name="menuTools"/>
115122
<addaction name="menuHelp"/>
@@ -174,6 +181,14 @@
174181
<string>Convert AFM data</string>
175182
</property>
176183
</action>
184+
<action name="action_developer_mode">
185+
<property name="checkable">
186+
<bool>true</bool>
187+
</property>
188+
<property name="text">
189+
<string>&amp;Developer mode</string>
190+
</property>
191+
</action>
177192
</widget>
178193
<resources/>
179194
<connections/>

0 commit comments

Comments
 (0)