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
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
of the Quick View (#195)
- enh: add the fluorescence baseline offset ([fluorescence]: "baseline N
offset") to the traces shown in the Quick View (#81)
- enh: button for applying the fluorescence crosstalk coefficients
to all datasets in the Dataset tab of the Analysis View (#198)
- 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 Down
17 changes: 17 additions & 0 deletions dcscope/gui/analysis/ana_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def __init__(self, *args, **kwargs):
self.ui.toolButton_duplicate.clicked.connect(self.on_duplicate_slot)
self.ui.toolButton_remove.clicked.connect(self.on_remove_slot)
self.ui.pushButton_apply.clicked.connect(self.write_slot)
self.ui.pushButton_ct_apply_all.clicked.connect(
self.on_crosstalk_apply_all)
self.ui.pushButton_reset.clicked.connect(self.update_content)
self.ui.comboBox_slots.currentIndexChanged.connect(self.update_content)
self.ui.comboBox_medium.currentIndexChanged.connect(self.on_ui_changed)
Expand Down Expand Up @@ -497,6 +499,21 @@ def update_content(self, slot_index=None, **kwargs):
else:
self.setEnabled(False)

@QtCore.pyqtSlot()
def on_crosstalk_apply_all(self):
"""Set the crosstalk values shown for all datasets (#198)

Only the crosstalk values are applied; other (not yet applied)
changes of the current dataset are not.
"""
crosstalk = self.read_pipeline_state()["crosstalk"]
with self.pipeline.lock:
for slot in self.pipeline.slots:
state = slot.__getstate__()
state["crosstalk"].update(crosstalk)
slot.__setstate__(state)
self.pp_mod_send.emit({"pipeline": {"feature_changed": "crosstalk"}})

def write_slot(self):
"""Update the dcscope.pipeline.Dataslot instance"""
with self.pipeline.lock:
Expand Down
5 changes: 5 additions & 0 deletions dcscope/gui/analysis/ana_slot_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def setupUi(self, Form):
self.doubleSpinBox_ct23.setSingleStep(0.1)
self.doubleSpinBox_ct23.setObjectName("doubleSpinBox_ct23")
self.gridLayout_3.addWidget(self.doubleSpinBox_ct23, 2, 3, 1, 1)
self.pushButton_ct_apply_all = QtWidgets.QPushButton(parent=self.groupBox_fl_cross)
self.pushButton_ct_apply_all.setObjectName("pushButton_ct_apply_all")
self.gridLayout_3.addWidget(self.pushButton_ct_apply_all, 4, 0, 1, 4)
self.verticalLayout_5.addWidget(self.groupBox_fl_cross)
self.groupBox_fl_labels = QtWidgets.QGroupBox(parent=Form)
self.groupBox_fl_labels.setObjectName("groupBox_fl_labels")
Expand Down Expand Up @@ -331,6 +334,8 @@ def retranslateUi(self, Form):
self.label_to_fl3.setText(_translate("Form", "to FL-3"))
self.label_from_fl1.setText(_translate("Form", "from FL-1"))
self.label_from_fl3.setText(_translate("Form", "from FL-3"))
self.pushButton_ct_apply_all.setToolTip(_translate("Form", "Set these crosstalk values for all datasets in the session (other changes in this tab are not applied)"))
self.pushButton_ct_apply_all.setText(_translate("Form", "Apply crosstalk to all datasets"))
self.groupBox_fl_labels.setToolTip(_translate("Form", "Choose user-definde labels that will be used for axes labels."))
self.groupBox_fl_labels.setTitle(_translate("Form", "Fluorescence labels"))
self.label_fl2.setText(_translate("Form", "FL-2"))
Expand Down
2 changes: 1 addition & 1 deletion docs/scrots/make_scrots_qg_fl_crosstalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
mw.on_modify_slot(mw.pipeline.slot_ids[0])
mw.widget_ana_view.repaint()
wsl = mw.widget_ana_view.ui.widget_slot
wsl.ui.groupBox_fl_cross.setFixedSize(360, 150)
wsl.ui.groupBox_fl_cross.setFixedSize(360, 185)

wsl.ui.doubleSpinBox_ct12.setValue(0.214)
wsl.ui.doubleSpinBox_ct13.setValue(0.012)
Expand Down
Binary file modified docs/scrots/qg_fl_crosstalk_matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/sec_qg_fl_crosstalk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ one channel *to* the other channels. For instance, in
additionally detected in FL-2. Only the coefficients between the
fluorescence channels of the dataset are shown. Click *Apply* to apply
the coefficients to the dataset. The coefficients are set for each dataset
individually.
individually. To use the same coefficients for all datasets of the session
(e.g. measured with the same setup), click *Apply crosstalk to all datasets*.

As soon as any of the coefficients is set (not zero), the crosstalk-corrected
features *FL-1 maximum, crosstalk-corrected* (fl1_max_ctc),
Expand Down
46 changes: 46 additions & 0 deletions tests/test_gui_ana_slot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Test the Dataset tab of the Analysis View"""
import pathlib

import pytest

from dcscope import session

import conftest # noqa: F401


datapath = pathlib.Path(__file__).parent / "data"


@pytest.fixture(autouse=True)
def run_around_tests():
session.clear_session()
yield
session.clear_session()


def test_crosstalk_apply_to_all_issue_198(qtbot, mw):
"""Apply the crosstalk values to all datasets (#198)"""
qtbot.addWidget(mw)
path = datapath / "calibration_beads_47.rtdc"
mw.add_dataslot(paths=[path, path, path])
mw.widget_ana_view.ui.tabWidget.setCurrentWidget(
mw.widget_ana_view.ui.tab_slot)
wsl = mw.widget_ana_view.ui.widget_slot

wsl.ui.doubleSpinBox_ct12.setValue(0.1)
wsl.ui.doubleSpinBox_ct31.setValue(0.25)
# this change is not applied with "Apply crosstalk to all datasets"
wsl.ui.lineEdit_name.setText("new name")
# (the Analysis View is not shown, so we cannot use qtbot.mouseClick)
wsl.ui.pushButton_ct_apply_all.click()

for ii, slot in enumerate(mw.pipeline.slots):
state = slot.__getstate__()
assert state["crosstalk"]["crosstalk fl12"] == 0.1
assert state["crosstalk"]["crosstalk fl31"] == 0.25
assert state["crosstalk"]["crosstalk fl13"] == 0
assert state["name"] != "new name"
# the values are used for computing the corrected fluorescence
ds = mw.pipeline.get_dataset(ii)
assert ds.config["calculation"]["crosstalk fl12"] == 0.1
assert ds.config["calculation"]["crosstalk fl31"] == 0.25
10 changes: 10 additions & 0 deletions ui/analysis/ana_slot.ui
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,16 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<widget class="QPushButton" name="pushButton_ct_apply_all">
<property name="toolTip">
<string>Set these crosstalk values for all datasets in the session (other changes in this tab are not applied)</string>
</property>
<property name="text">
<string>Apply crosstalk to all datasets</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
Loading