Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
renamed to "Choose filters..." after editing box filters
- fix: the help button of the statistical significance dialog
opened the dclab documentation instead of the R-lme4 quick guide
- fix: the "What are encrypted tokens?" link in the DCOR preferences
could not be clicked
- enh: user-defined default settings for new plots ("Save as default"
in the plot settings) and default Young's modulus viscosity model
and look-up table for new datasets (preferences) (#129)
Expand All @@ -40,6 +42,13 @@
the viscosity model) in the plots (#144)
- enh: help links for fluorescence crosstalk correction (Dataset tab)
and S3 basins (preferences)
- enh: list the Young's modulus media with the names used by dclab
(no aliases) and the product name as a hint (e.g. "0.49% MC-PBS
(CellCarrier)")
- enh: use the same viscosity model names ("Buyukurganci (2022)",
"Herold (2017)") in the Dataset tab, bulk action, and preferences
- enh: tooltips for the polygon filter button in the Quick View and
the isoelasticity line look-up table selection
- docs: add quick guide for fluorescence crosstalk correction (#120)
- docs: screenshot scripts download missing datasets from figshare
and use the icon theme of DCscope
Expand All @@ -63,6 +72,7 @@
encrypted DCOR access tokens, S3 basins, Quick View, Filter, Plot,
and Block Matrix options)
- docs: link to the dclab documentation where applicable
- docs: remove outdated QtCreator version requirement
2.28.4
- setup: bump dclab to 0.73.0 (chopped image basins support)
2.28.3
Expand Down
1 change: 1 addition & 0 deletions dcscope/gui/analysis/ana_plot_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def retranslateUi(self, Form):
self.label_17.setText(_translate("Form", "Y"))
self.toolButton_spacing_find_best.setText(_translate("Form", "Find best spacing"))
self.checkBox_isoelastics.setText(_translate("Form", "Isoelasticity lines"))
self.comboBox_lut.setToolTip(_translate("Form", "Look-up table for the isoelasticity lines"))
self.label_18.setText(_translate("Form", "After clicking apply, set:"))
self.toolButton_auto_xy_range.setToolTip(_translate("Form", "from minimum to maximum with 5% margin"))
self.toolButton_auto_xy_range.setText(_translate("Form", "default XY range"))
Expand Down
25 changes: 13 additions & 12 deletions dcscope/gui/analysis/ana_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import dclab
from dclab.features.emodulus.viscosity import (
ALIAS_MEDIA, KNOWN_MEDIA, TemperatureOutOfRangeWarning
ALIAS_MEDIA, KNOWN_MEDIA, SAME_MEDIA, TemperatureOutOfRangeWarning
)
import numpy as np
from PyQt6 import QtCore, QtWidgets

from ... import meta_tool
from .. import defaults
from .ana_slot_ui import Ui_Form
from .dlg_slot_reorder import DlgSlotReorder

Expand Down Expand Up @@ -125,7 +126,11 @@ def write_pipeline_state(self, state):
self._update_emodulus_temp_choices()
emodulus = state["emodulus"]
self.ui.groupBox_emod.setVisible(emodulus["emodulus enabled"])
idx_med = self.ui.comboBox_medium.findData(emodulus["emodulus medium"])
medium = emodulus["emodulus medium"]
idx_med = self.ui.comboBox_medium.findData(medium)
if idx_med == -1 and medium in ALIAS_MEDIA:
# alias of a medium (e.g. "CellCarrier" from older sessions)
idx_med = self.ui.comboBox_medium.findData(ALIAS_MEDIA[medium])
if idx_med == -1: # empty medium string
idx_med = self.ui.comboBox_medium.findData("other")
self.ui.comboBox_medium.setCurrentIndex(idx_med)
Expand Down Expand Up @@ -208,16 +213,14 @@ def get_dataset_choices_medium(ds):
else:
medium = "undefined"
if medium in KNOWN_MEDIA:
# The medium is defined in the metadata and cannot be changed.
valid_media = [medium]
else:
valid_media = KNOWN_MEDIA + [medium, "other", "undefined"]
# Only offer the media names preferred by dclab (no aliases).
valid_media = list(SAME_MEDIA) + [medium, "other", "undefined"]
choices = []
for vm in valid_media:
if vm == "CellCarrierB":
name = "CellCarrier B" # [sic]
else:
name = vm
choices.append([name, vm])
for vm in dict.fromkeys(valid_media): # remove duplicates
choices.append([defaults.get_emodulus_medium_name(vm), vm])
return choices

@staticmethod
Expand Down Expand Up @@ -295,9 +298,7 @@ def _update_emodulus_visc_model_choices(self):
self.ui.comboBox_visc_model.blockSignals(True)
self.ui.comboBox_visc_model.clear()

choices = {"Herold (2017)": "herold-2017",
"Buyukurganci (2022)": "buyukurganci-2022"}
for name, data in choices.items():
for name, data in defaults.EMODULUS_VISC_MODELS.items():
self.ui.comboBox_visc_model.addItem(name, data)
self.ui.comboBox_visc_model.blockSignals(False)

Expand Down
16 changes: 5 additions & 11 deletions dcscope/gui/bulk/bulk_emodulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ def __init__(self, parent, pipeline, *args, **kwargs):
self.ui.comboBox_medium.clear()
self.ui.comboBox_medium.addItem("Other", "other")
for name in SAME_MEDIA:
for sk in SAME_MEDIA[name]:
if sk.count("Cell"): # just add CellCarrier information
info = f" ({sk})"
break
else:
info = ""
self.ui.comboBox_medium.addItem(name + info, name)
self.ui.comboBox_medium.addItem(
defaults.get_emodulus_medium_name(name), name)

self.ui.comboBox_medium.addItem("Not defined", "undefined")
self.ui.comboBox_medium.addItem("Unchanged", "unchanged")
Expand All @@ -60,9 +55,8 @@ def __init__(self, parent, pipeline, *args, **kwargs):
emod_defaults = defaults.get_emodulus_defaults(QtCore.QSettings())

self.ui.comboBox_visc_model.clear()
self.ui.comboBox_visc_model.addItem("buyukurganci-2022",
"buyukurganci-2022")
self.ui.comboBox_visc_model.addItem("herold-2017", "herold-2017")
for name, data in defaults.EMODULUS_VISC_MODELS.items():
self.ui.comboBox_visc_model.addItem(name, data)
self.ui.comboBox_visc_model.setCurrentIndex(
self.ui.comboBox_visc_model.findData(
emod_defaults["emodulus viscosity model"]))
Expand Down Expand Up @@ -96,7 +90,7 @@ def on_ok(self):
# Tell the user that the medium of some datasets was not
# changed (#124).
names = "\n".join(
f"- {name} ({medium})" for name, medium in skipped)
f"- {name}: {medium}" for name, medium in skipped)
QtWidgets.QMessageBox.warning(
self,
"Medium not changed for some datasets",
Expand Down
19 changes: 19 additions & 0 deletions dcscope/gui/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging

import dclab
from dclab.features.emodulus.viscosity import ALIAS_MEDIA
from PyQt6 import QtCore

from ..pipeline.plot import DEFAULT_STATE as PLOT_DEFAULT_STATE
Expand All @@ -25,6 +26,24 @@
EMODULUS_VISC_MODELS = {"Buyukurganci (2022)": "buyukurganci-2022",
"Herold (2017)": "herold-2017"}

#: product names of MC-PBS media shown as a hint next to the medium name
EMODULUS_MEDIUM_HINTS = {"0.49% MC-PBS": "CellCarrier",
"0.59% MC-PBS": "CellCarrierB"}


def get_emodulus_medium_name(medium):
"""Return the medium name preferred by dclab for display

Aliases (e.g. "CellCarrier") are replaced by the name preferred
by dclab (e.g. "0.49% MC-PBS") and the product name is appended
as a hint (e.g. "0.49% MC-PBS (CellCarrier)"). Unknown media
are returned unchanged.
"""
name = ALIAS_MEDIA.get(medium, medium)
hint = EMODULUS_MEDIUM_HINTS.get(name)
return f"{name} ({hint})" if hint else name


#: plot state keys that depend on a specific plot or on the data
#: and are thus not stored as defaults
PLOT_STATE_EXCLUDED = {
Expand Down
1 change: 1 addition & 0 deletions dcscope/gui/preferences_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def setupUi(self, Dialog):
self.pushButton_enc_token.setObjectName("pushButton_enc_token")
self.horizontalLayout_2.addWidget(self.pushButton_enc_token)
self.label_6 = QtWidgets.QLabel(parent=self.tab_dcor)
self.label_6.setOpenExternalLinks(True)
self.label_6.setObjectName("label_6")
self.horizontalLayout_2.addWidget(self.label_6)
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
Expand Down
2 changes: 2 additions & 0 deletions dcscope/gui/quick_view/qv_main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def retranslateUi(self, Form):
self.toolButton_settings.setText(_translate("Form", "S"))
self.toolButton_event.setToolTip(_translate("Form", "Event"))
self.toolButton_event.setText(_translate("Form", "E"))
self.toolButton_poly.setToolTip(_translate("Form", "Polygon filters"))
self.toolButton_poly.setText(_translate("Form", "P"))
self.label_7.setText(_translate("Form", "<html><head/><body><p><span style=\" font-weight:600;\">Plot</span></p></body></html>"))
self.label.setText(_translate("Form", "X"))
Expand All @@ -594,6 +595,7 @@ def retranslateUi(self, Form):
self.checkBox_downsample.setText(_translate("Form", "Downsampling"))
self.spinBox_downsample.setSuffix(_translate("Form", " events"))
self.checkBox_isoelastics.setText(_translate("Form", "Show isoelasticity lines"))
self.comboBox_lut.setToolTip(_translate("Form", "Look-up table for the isoelasticity lines"))
self.checkBox_hue.setText(_translate("Form", "Colorize markers"))
self.comboBox_hue.setItemText(0, _translate("Form", "KDE"))
self.comboBox_hue.setItemText(1, _translate("Form", "Feature"))
Expand Down
6 changes: 3 additions & 3 deletions docs/scrots/make_scrots_qg_emodulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@
wsl.ui.groupBox_emod.setFixedSize(420, 140)

wsl.ui.comboBox_medium.setCurrentIndex(
wsl.ui.comboBox_medium.findData("CellCarrier"))
wsl.ui.comboBox_medium.findData("0.49% MC-PBS"))
wsl.ui.comboBox_temp.setCurrentIndex(wsl.ui.comboBox_temp.findData("config"))
app.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
wsl.ui.groupBox_emod.grab().save("_qg_emodulus_config.png")

wsl.ui.comboBox_medium.setCurrentIndex(
wsl.ui.comboBox_medium.findData("CellCarrier"))
wsl.ui.comboBox_medium.findData("0.49% MC-PBS"))
wsl.ui.comboBox_temp.setCurrentIndex(wsl.ui.comboBox_temp.findData("feature"))
app.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
wsl.ui.groupBox_emod.grab().save("_qg_emodulus_feature.png")

wsl.ui.comboBox_medium.setCurrentIndex(
wsl.ui.comboBox_medium.findData("CellCarrier"))
wsl.ui.comboBox_medium.findData("0.49% MC-PBS"))
wsl.ui.comboBox_temp.setCurrentIndex(wsl.ui.comboBox_temp.findData("manual"))
wsl.ui.doubleSpinBox_temp.setValue(38)
app.processEvents(QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)
Expand Down
6 changes: 0 additions & 6 deletions docs/sec_devs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ to graphically design the user interface. The `.ui` files are located in the
`ui` directory in the root of the repository.
We use `PyQt6` (not `PySide6`) to interface with Qt.

Note that for some reason, new versions of QtDesigner produce .ui files
that are incompatible with `pyuic6` (which converts the .ui files into
Python code). As a result, we have to use QtCreator 8 in order for things
to work (If you have a better solution, please let us know.):
https://github.com/qt-creator/qt-creator/releases/tag/v8.0.2

The .ui files are converted to Python files (`*_ui.py`) in the
corresponding locations in the `dcscope/gui` directory with the
`ui/run_uic.sh` script (which calls `pyuic6`). The generated `*_ui.py`
Expand Down
14 changes: 9 additions & 5 deletions docs/sec_qg_youngs_modulus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ The parameters for computing the Young's modulus can be set in the
*Dataset* tab of the :ref:`Analysis View <sec_analysis_view>`.
The Young's modulus is computed using a precomputed look-up table and
additionally depends on channel width, flow rate, pixel size (pixelation
correction), and viscosity. For known media, such as CellCarrier, the
viscosity can be derived from channel width, flow rate, and temperature.
correction), and viscosity. For known media, such as 0.49% MC-PBS
(CellCarrier), the viscosity can be derived from channel width, flow rate,
and temperature. DCscope lists the media with the names used by dclab and,
for the MC-PBS media sold by Zellmechanik Dresden, the product name in
brackets.
In some RT-DC setups, the chip temperature is recorded during the measurement.
For instance, in :numref:`qg_emodulus_config`, the average chip temperature
of 22.5°C from the [setup] metadata section is used. The value of the
Expand All @@ -46,9 +49,10 @@ If the chip temperature is recorded for each event, then the user may select
the *From feature* option (:numref:`qg_emodulus_feature`). In this case,
the Young's modulus is computed from the individual viscosities for each event.

For MC-PBS media (e.g. CellCarrier and CellCarrier B), you can choose the
viscosity model (Herold 2017 :cite:`Herold2017` or
Buyukurganci 2022 :cite:`Buyukurganci2022`) next to the viscosity value.
For MC-PBS media (e.g. 0.49% MC-PBS (CellCarrier) and 0.59% MC-PBS
(CellCarrierB)), you can choose the viscosity model
(*Buyukurganci (2022)* :cite:`Buyukurganci2022` or
*Herold (2017)* :cite:`Herold2017`) next to the viscosity value.
The models are compared in the
:ref:`dclab documentation <dclab:sec_emodulus_viscosity>`
(see also :ref:`this example <dclab:example_viscosity_models>`).
Expand Down
8 changes: 6 additions & 2 deletions tests/test_gui_bulk_emodulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def test_manual_basic(qtbot, mw):
# sanity check: default viscosity model should be "buyukurganci-2022"
ivdm = dlg.ui.comboBox_visc_model.findData("buyukurganci-2022")
assert dlg.ui.comboBox_visc_model.currentIndex() == ivdm
assert dlg.ui.comboBox_visc_model.currentText() == "Buyukurganci (2022)"
imed = dlg.ui.comboBox_medium.findData("0.59% MC-PBS")
assert dlg.ui.comboBox_medium.itemText(imed) == \
"0.59% MC-PBS (CellCarrierB)"

dlg.ui.comboBox_temp.setCurrentIndex(
dlg.ui.comboBox_temp.findData("manual"))
Expand Down Expand Up @@ -117,7 +121,7 @@ def test_manual_wrong_medium(qtbot, mw, warnings_shown):

# The user is informed that the medium was not changed (#124)
assert len(warnings_shown) == 1
assert warnings_shown[0][1].count("(CellCarrier B)") == 2
assert warnings_shown[0][1].count(": 0.59% MC-PBS (CellCarrierB)") == 2

for slot in mw.pipeline.slots:
ds = slot.get_dataset()
Expand Down Expand Up @@ -302,7 +306,7 @@ def test_wrong_medium_warning_only_for_fixed_media_issue_124(
text = warnings_shown[0][1]
# only one dataset is listed
assert text.count("\n- ") == 1
assert text.count(f"- {slot_known.name} (CellCarrier)") == 1
assert text.count(f"- {slot_known.name}: 0.49% MC-PBS (CellCarrier)") == 1


def test_no_warning_for_unchanged_medium(qtbot, mw, warnings_shown):
Expand Down
51 changes: 50 additions & 1 deletion tests/test_gui_emodulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_allow_to_set_manual_temperature_for_known_medium(qtbot, mw):
wsl = mw.widget_ana_view.ui.widget_slot

# 1. test whether we can actually select things in comboBox_temp
ccidx = wsl.ui.comboBox_medium.findData("CellCarrier")
ccidx = wsl.ui.comboBox_medium.findData("0.49% MC-PBS")
wsl.ui.comboBox_medium.setCurrentIndex(ccidx)
assert wsl.ui.comboBox_temp.isEnabled()

Expand Down Expand Up @@ -376,3 +376,52 @@ def test_viscosity_defaults_to_buyukurganci_2022(qtbot, mw):
idvm_loc = wsl.ui.comboBox_visc_model.findData("buyukurganci-2022")
idvm_actual = wsl.ui.comboBox_visc_model.currentIndex()
assert idvm_loc == idvm_actual


def test_medium_and_viscosity_model_names(qtbot, mw):
"""Media are listed with the names preferred by dclab (no aliases)"""
qtbot.addWidget(mw)
path1 = make_dataset(medium=None)
mw.add_dataslot(paths=[path1])
mw.widget_ana_view.ui.tabWidget.setCurrentWidget(
mw.widget_ana_view.ui.tab_slot)
wsl = mw.widget_ana_view.ui.widget_slot
cbm = wsl.ui.comboBox_medium
assert [cbm.itemData(ii) for ii in range(cbm.count())] == [
"0.49% MC-PBS", "0.59% MC-PBS", "0.83% MC-PBS", "water",
"other", "undefined"]
assert cbm.itemText(0) == "0.49% MC-PBS (CellCarrier)"
assert cbm.itemText(1) == "0.59% MC-PBS (CellCarrierB)"
assert cbm.itemText(2) == "0.83% MC-PBS"
cbv = wsl.ui.comboBox_visc_model
assert [cbv.itemText(ii) for ii in range(cbv.count())] == [
"Buyukurganci (2022)", "Herold (2017)"]


def test_medium_name_alias_from_metadata(qtbot, mw):
"""A medium alias in the metadata is shown with the preferred name"""
qtbot.addWidget(mw)
path1 = make_dataset(medium="CellCarrier B")
mw.add_dataslot(paths=[path1])
mw.widget_ana_view.ui.tabWidget.setCurrentWidget(
mw.widget_ana_view.ui.tab_slot)
wsl = mw.widget_ana_view.ui.widget_slot
assert not wsl.ui.comboBox_medium.isEnabled()
assert wsl.ui.comboBox_medium.count() == 1
assert wsl.ui.comboBox_medium.currentData() == "CellCarrier B"
assert wsl.ui.comboBox_medium.currentText() == \
"0.59% MC-PBS (CellCarrierB)"


def test_medium_name_alias_from_session(qtbot, mw):
"""A medium alias selected in older versions of DCscope is restored"""
qtbot.addWidget(mw)
path1 = make_dataset(medium=None)
mw.add_dataslot(paths=[path1])
mw.widget_ana_view.ui.tabWidget.setCurrentWidget(
mw.widget_ana_view.ui.tab_slot)
wsl = mw.widget_ana_view.ui.widget_slot
mw.pipeline.slots[0].config["emodulus"]["emodulus medium"] = \
"CellCarrier"
wsl.update_content()
assert wsl.ui.comboBox_medium.currentData() == "0.49% MC-PBS"
6 changes: 5 additions & 1 deletion ui/analysis/ana_plot.ui
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_lut"/>
<widget class="QComboBox" name="comboBox_lut">
<property name="toolTip">
<string>Look-up table for the isoelasticity lines</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
Expand Down
3 changes: 3 additions & 0 deletions ui/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://dc.readthedocs.io/en/latest/sec_self_hosting/operations.html#creating-an-encrypted-access-token&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;What are encrypted tokens?&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down
9 changes: 8 additions & 1 deletion ui/quick_view/qv_main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButton_poly">
<property name="toolTip">
<string>Polygon filters</string>
</property>
<property name="text">
<string>P</string>
</property>
Expand Down Expand Up @@ -400,7 +403,11 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_lut"/>
<widget class="QComboBox" name="comboBox_lut">
<property name="toolTip">
<string>Look-up table for the isoelasticity lines</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
Expand Down
Loading