diff --git a/CHANGELOG b/CHANGELOG index 1cdf1e3..ec9c114 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +0.4.0 + - fix: bump bmlab from 0.2.3 to 0.6.1 (file format changes) (#53) 0.3.1 - fix: bump bmlab from 0.1.10 to 0.2.3 (file format changes) (#49) 0.3.0 diff --git a/setup.py b/setup.py index a739844..3ccb26e 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ description=description, long_description=open('README.rst').read() if exists('README.rst') else '', install_requires=["czifile==2019.7.2", # bc cgohlke and used for signature - "bmlab==0.5.1", + "bmlab==0.6.1", "h5py>=2.10.0", "numpy>=1.17.0", "pyqt6>=6.2.0", diff --git a/tests/data/fmt_brillouin-h5_bmlab-session_2022_water.zip b/tests/data/fmt_brillouin-h5_bmlab-session_2022_water.zip new file mode 100644 index 0000000..4ff894e Binary files /dev/null and b/tests/data/fmt_brillouin-h5_bmlab-session_2022_water.zip differ diff --git a/tests/data/fmt_brillouin-h5_bmlab-session_2022_water_2-rep.zip b/tests/data/fmt_brillouin-h5_bmlab-session_2022_water_2-rep.zip new file mode 100644 index 0000000..8e31d33 Binary files /dev/null and b/tests/data/fmt_brillouin-h5_bmlab-session_2022_water_2-rep.zip differ diff --git a/tests/test_fmt_h5_brillouin_bmlab.py b/tests/test_fmt_h5_brillouin_bmlab.py index 66c92f0..12ea5c5 100644 --- a/tests/test_fmt_h5_brillouin_bmlab.py +++ b/tests/test_fmt_h5_brillouin_bmlab.py @@ -6,7 +6,7 @@ def test_load_bmlab_brillouin(): - paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022.zip") + paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022_water.zip") data, meta = formats.load(paths[0]) # check metadata @@ -14,17 +14,18 @@ def test_load_bmlab_brillouin(): assert meta["pixel size y"] == 1 assert np.isnan(meta["pixel size z"]) assert meta["shape"] == (3, 5, 1) - assert "brillouin_peak_position" in meta["channel hues"] + assert "brillouin_peak_position_f" in meta["channel hues"] # check data - assert "brillouin_peak_position" in data - assert data["brillouin_peak_position"].shape == (3, 5, 1) - assert data["brillouin_peak_position"][2, 3, 0] == 62.28071301762982 - assert meta["signature"] == "25d6ae8774fc29417facc6c9dfe061e6" + assert "brillouin_peak_position_f" in data + assert data["brillouin_peak_position_f"].shape == (3, 5, 1) + assert data["brillouin_peak_position_f"][2, 3, 0] == 7.418597699375756 + assert meta["signature"] == "7692028641e09f26ad0c8caf010ecaeb" def test_load_bmlab_brillouin_2rep(): - paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022_2-rep.zip") + paths =\ + retrieve_data("fmt_brillouin-h5_bmlab-session_2022_water_2-rep.zip") data, meta = formats.load(paths[0]) # check metadata @@ -32,22 +33,24 @@ def test_load_bmlab_brillouin_2rep(): assert meta["pixel size y"] == 1 assert np.isnan(meta["pixel size z"]) assert meta["shape"] == (3, 5, 1) - assert "rep-0_brillouin_peak_position" in meta["channel hues"] - assert "rep-1_brillouin_peak_position" in meta["channel hues"] + assert "rep-0_brillouin_peak_position_f" in meta["channel hues"] + assert "rep-1_brillouin_peak_position_f" in meta["channel hues"] # check data - assert "rep-0_brillouin_peak_position" in data - assert data["rep-0_brillouin_peak_position"].shape == (3, 5, 1) - assert data["rep-0_brillouin_peak_position"][2, 3, 0] == 55.53730853499501 - assert "rep-1_brillouin_peak_position" in data - assert data["rep-1_brillouin_peak_position"].shape == (3, 5, 1) - assert data["rep-1_brillouin_peak_position"][2, 3, 0] == 101.47705516241298 + assert "rep-0_brillouin_peak_position_f" in data + assert data["rep-0_brillouin_peak_position_f"].shape == (3, 5, 1) + assert data["rep-0_brillouin_peak_position_f"][2, 3, 0] ==\ + 7.414767296701641 + assert "rep-1_brillouin_peak_position_f" in data + assert data["rep-1_brillouin_peak_position_f"].shape == (3, 5, 1) + assert data["rep-1_brillouin_peak_position_f"][2, 3, 0] ==\ + 7.4293433545770124 - assert meta["signature"] == "0f9dfe4cfe549859ac09ec0ead5bf58f" + assert meta["signature"] == "0fa3675745a06d6c54184aa95873280e" def test_load_bmlab_brillouin_signature(): - paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022.zip") + paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022_water.zip") _, meta1 = formats.load(paths[0]) _, meta2 = formats.load(paths[1]) assert meta1["signature"] == meta2["signature"] diff --git a/tests/test_gui_collect.py b/tests/test_gui_collect.py index 4669c30..55b060c 100644 --- a/tests/test_gui_collect.py +++ b/tests/test_gui_collect.py @@ -17,6 +17,30 @@ def test_basic(qtbot): mw.close() +def test_load_bmlab_brillouin_data(qtbot, monkeypatch): + paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022_water.zip") + + mw = Impose() + qtbot.addWidget(mw) + monkeypatch.setattr(QtWidgets.QFileDialog, "getOpenFileNames", + lambda *args: ([str(paths[0])], None)) + qtbot.mouseClick(mw.tab_collect.toolButton_add_data, + QtCore.Qt.MouseButton.LeftButton) + QtWidgets.QApplication.processEvents( + QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300) + + # select the first entry in the datasets list (actual data) + qtbot.mouseClick(mw.tab_collect.tableWidget_paths.cellWidget(0, 0), + QtCore.Qt.MouseButton.LeftButton) + # sanity check (no data displayed) + assert mw.tab_collect.groupBox_struct.isEnabled() + + # select the second entry in the visualization list + item = mw.tab_collect.vis.listWidget_chan.item(1) + item.setCheckState(QtCore.Qt.CheckState.Checked) + assert mw.tab_collect.groupBox_struct.isEnabled() + + def test_load_bmlab_brillouin_with_nan_data(qtbot, monkeypatch): paths = retrieve_data("fmt_brillouin-h5_bmlab-session_2022.zip") @@ -36,10 +60,9 @@ def test_load_bmlab_brillouin_with_nan_data(qtbot, monkeypatch): assert not mw.tab_collect.groupBox_struct.isEnabled() # select the second entry in the visualization list - # (the first entry contains nans, the second entry contains data) item = mw.tab_collect.vis.listWidget_chan.item(1) item.setCheckState(QtCore.Qt.CheckState.Checked) - assert mw.tab_collect.groupBox_struct.isEnabled() + assert not mw.tab_collect.groupBox_struct.isEnabled() def test_load_dataset(qtbot, monkeypatch):