Skip to content

Commit

Permalink
enh: add expert mode which is just a parital developer mode (close #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jan 7, 2022
1 parent 799f866 commit b31967b
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.13.1
- feat: allow to specify the geometrical correction factor for
non-single-contact experiments (#16)
- enh: add expert mode which is just a parital developer mode (#22)
- fix: export fitting method and method kwargs with initial
parameters
- enh: add links to docs in two places (#19)
Expand Down
50 changes: 33 additions & 17 deletions docs/sec_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,36 @@ 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).
- Add the force-distance fitting model :ref:`sneddon_spher
<nanite:sec_ref_model_sneddon_spher>` to the list of available fit models
(it is excluded by default, because it is virtually identical to the
:ref:`sneddon_spher_approx <nanite:sec_ref_model_sneddon_spher_approx>`
model which is much faster).
- Enable you to manually set the minimizer method and the corresponding
keyword arguments applied by lmfit
Advanced options
================

Extensions
----------
Under *Edit | Preferences | Extensions*, you may import your own custom
fit models. See :ref:`sec_qg_extensions` for more information.

Expert and Developer mode
-------------------------

Under *Edit | Preferences | Advanced*, you can enable expert and developer
mode.

- Expert mode:

- Enables you to manually set the minimizer method and the corresponding
keyword arguments applied by lmfit.

- Developer mode:

- Everything that is available in expert mode.
- Allows 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>`_.
- Slows down loading of large datasets (because the modality has to be
determined first).
- Adds the force-distance fitting model :ref:`sneddon_spher
<nanite:sec_ref_model_sneddon_spher>` to the list of available fit models
(it is excluded by default, because it is virtually identical to the
:ref:`sneddon_spher_approx <nanite:sec_ref_model_sneddon_spher_approx>`
model which is much faster).
12 changes: 9 additions & 3 deletions pyjibe/fd/tab_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def __init__(self, *args, **kwargs):
# Exact spherical model is only available in developer mode
self.settings = QtCore.QSettings()
self.settings.setIniCodec("utf-8")
if not bool(int(self.settings.value("advanced/developer mode", "0"))):
dev_mode = bool(int(
self.settings.value("advanced/developer mode", "0")))
exp_mode = bool(int(
self.settings.value("advanced/expert mode", "0")))
if not (dev_mode or exp_mode):
models_av.remove("sneddon_spher")
self.widget_method.hide()
models_av.sort(key=lambda x: nmodel.models_available[x].model_name)
Expand Down Expand Up @@ -171,6 +175,8 @@ def fit_approach_retract(self, fdist, update_ui=True):
"""
dev_mode = bool(int(
self.settings.value("advanced/developer mode", "0")))
exp_mode = bool(int(
self.settings.value("advanced/expert mode", "0")))
# segment
segment = self.cb_segment.currentText().lower()
# x axis
Expand Down Expand Up @@ -211,8 +217,8 @@ def fit_approach_retract(self, fdist, update_ui=True):
params = self.fit_parameters()
# fit method (if in developer mode)
kwargs = {}
if dev_mode:
# We are in developer mode.
if dev_mode or exp_mode:
# We are in developer or expert mode.
# Populate the user-defined keyword arguments. Note that
# these are not passed as "options", but directly to the
# minimizer method.
Expand Down
1 change: 1 addition & 0 deletions pyjibe/head/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, parent, *args, **kwargs):
#: configuration keys, corresponding widgets, and defaults
self.config_pairs = [
["advanced/developer mode", self.advanced_developer_mode, 0],
["advanced/expert mode", self.advanced_expert_mode, 0],
["check for updates", self.general_check_for_updates, 1],
]

Expand Down
41 changes: 40 additions & 1 deletion pyjibe/head/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab_general">
<attribute name="title">
Expand Down Expand Up @@ -211,6 +211,13 @@
<string>Advanced</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="advanced_expert_mode">
<property name="text">
<string>Expert mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advanced_developer_mode">
<property name="text">
Expand Down Expand Up @@ -284,5 +291,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>advanced_developer_mode</sender>
<signal>clicked(bool)</signal>
<receiver>advanced_expert_mode</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>351</x>
<y>87</y>
</hint>
<hint type="destinationlabel">
<x>351</x>
<y>59</y>
</hint>
</hints>
</connection>
<connection>
<sender>advanced_developer_mode</sender>
<signal>clicked(bool)</signal>
<receiver>advanced_expert_mode</receiver>
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>351</x>
<y>87</y>
</hint>
<hint type="destinationlabel">
<x>351</x>
<y>59</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit b31967b

Please sign in to comment.