Skip to content

Commit 697a3d5

Browse files
authored
Gui testing take two (#119)
* first draft * Added first version of GUI testing - browse tabs * Added first version of GUI testing - browse tabs * Fixing setup.py * arrayqueues dep fix * disabled GUI testing * Testing only python 3.8 * fixed tests * Not testing on windows because of vispy/OpenGL problems with pytest-qt * Update main.yml * Update main.yml * Full exp test running now * comments added * removed unnecessary print, minor refactoring in streaming_save.py while debugging
1 parent 25f98ee commit 697a3d5

12 files changed

Lines changed: 119 additions & 119 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ jobs:
2525
runs-on: ${{ matrix.os }}
2626
strategy:
2727
matrix:
28-
os: [ubuntu-latest, macos-latest, windows-latest]
29-
python-version: [3.7, 3.8.6]
30-
exclude:
31-
- os: macos-latest
32-
python-version: 3.7
33-
- os: windows-latest
34-
python-version: 3.7
28+
os: [macos-latest]
29+
python-version: [3.8.6]
3530
steps:
3631
- uses: actions/checkout@v2
3732
- name: Set up Python

.travis.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

noxfile.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
arrayqueues==1.2.0b0
2-
flammkuchen==0.9
1+
arrayqueues==1.3.1
2+
split_dataset
33
lightparam>=0.4, <0.5
44
pyqt5>=5.15
55
pyzmq

requirements_dev.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pytest-cov
2+
pytest-qt
3+
pytest
4+
gitpython
5+
coverage
6+
pre-commit
7+
black
8+
flake8
9+
isort

sashimi/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@
5656
},
5757
"camera": {
5858
"id": 0,
59-
"name": "hamamatsu",
59+
"name": "mock",
6060
"max_sensor_resolution": [2048, 2048],
6161
"default_exposure": 60,
6262
"default_binning": 1,
6363
},
64-
"light_source": {"name": "cobolt", "port": "COM4", "intensity_units": "mA"},
64+
"light_source": {"name": "mock", "port": "COM4", "intensity_units": "mock"},
6565
"external_communication": {"name": "stytra", "address": "tcp://O1-589:5555"},
6666
"notifier": "none",
6767
"notifier_options": {},

sashimi/hardware/cameras/hamamatsu/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def get_camera_properties(self):
511511
"dcamprop_getname",
512512
)
513513

514-
if properties == {'': 0}:
514+
if properties == {"": 0}:
515515
raise ConnectionError("The Hamamatsu camera seems to be off!")
516516

517517
return properties

sashimi/processes/streaming_save.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from sashimi.config import read_config
1313
from sashimi.processes.logging import LoggingProcess
1414
from sashimi.events import LoggedEvent, SashimiEvents
15+
from sashimi.utilities import get_last_parameters
1516

1617
conf = read_config()
1718

@@ -130,7 +131,8 @@ def fill_dataset(self, volume):
130131
if self.current_data is None:
131132
self.calculate_optimal_size(volume)
132133
self.current_data = np.empty(
133-
(self.save_parameters.chunk_size, *volume.shape), dtype=self.dtype,
134+
(self.save_parameters.chunk_size, *volume.shape),
135+
dtype=self.dtype,
134136
)
135137

136138
self.current_data[self.i_in_chunk, :, :, :] = volume
@@ -165,7 +167,10 @@ def finalize_dataset(self):
165167
) as f:
166168
json.dump(
167169
{
168-
"shape_full": (self.n_volumes, *self.current_data.shape[1:],),
170+
"shape_full": (
171+
self.n_volumes,
172+
*self.current_data.shape[1:],
173+
),
169174
"shape_block": (
170175
self.save_parameters.chunk_size,
171176
*self.current_data.shape[1:],
@@ -201,16 +206,17 @@ def calculate_optimal_size(self, volume):
201206
)
202207

203208
def receive_save_parameters(self):
204-
try:
205-
self.save_parameters = self.saving_parameter_queue.get(timeout=0.001)
206-
except Empty:
207-
pass
208-
try:
209-
new_duration = self.duration_queue.get(timeout=0.001)
210-
print(new_duration)
209+
"""Receive parameters on the stack shape from the `State` obj and new duration
210+
from either the `EsternalTrigger` or the `State` if triggering is disabled.
211+
"""
212+
# Get parameters:
213+
parameters = get_last_parameters(self.saving_parameter_queue)
214+
if parameters is not None:
215+
self.save_parameters = parameters
216+
217+
# Get duration and update number of volumes:
218+
new_duration = get_last_parameters(self.duration_queue)
219+
if new_duration is not None:
211220
self.n_volumes = int(
212221
np.ceil(self.save_parameters.volumerate * new_duration)
213222
)
214-
print(self.n_volumes)
215-
except Empty:
216-
pass

sashimi/state.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class TriggerSettings(ParametrizedQt):
6262
def __init__(self):
6363
super().__init__(self)
6464
self.name = "trigger_settings"
65-
self.experiment_duration = Param(2_000, (1, 10_000), unit="s")
65+
self.experiment_duration = Param(5, (1, 50_000), unit="s")
6666
self.is_triggered = Param(True, [True, False], gui=False)
6767

6868

@@ -71,7 +71,8 @@ def __init__(self):
7171
super().__init__()
7272
self.name = "general/scanning_state"
7373
self.scanning_state = Param(
74-
"Paused", ["Paused", "Calibration", "Planar", "Volume"],
74+
"Paused",
75+
["Paused", "Calibration", "Planar", "Volume"],
7576
)
7677

7778

@@ -183,7 +184,11 @@ def __init__(self):
183184

184185
def add_calibration_point(self):
185186
self.calibrations_points.append(
186-
(self.z_settings.piezo, self.z_settings.lateral, self.z_settings.frontal,)
187+
(
188+
self.z_settings.piezo,
189+
self.z_settings.lateral,
190+
self.z_settings.frontal,
191+
)
187192
)
188193
self.calculate_calibration()
189194

@@ -219,7 +224,8 @@ def calculate_calibration(self):
219224

220225

221226
def get_voxel_size(
222-
scanning_settings: ZRecordingSettings, camera_settings: CameraSettings,
227+
scanning_settings: ZRecordingSettings,
228+
camera_settings: CameraSettings,
223229
):
224230
scan_length = (
225231
scanning_settings.piezo_scan_range[1] - scanning_settings.piezo_scan_range[0]
@@ -522,7 +528,9 @@ def send_scansave_settings(self):
522528

523529
elif self.global_state == GlobalState.PLANAR_PREVIEW:
524530
params = convert_single_plane_params(
525-
self.planar_setting, self.single_plane_settings, self.calibration,
531+
self.planar_setting,
532+
self.single_plane_settings,
533+
self.calibration,
526534
)
527535

528536
elif self.global_state == GlobalState.VOLUME_PREVIEW:
@@ -644,10 +652,13 @@ def get_waveform(self):
644652
return None
645653

646654
def calculate_pulse_times(self):
647-
return np.arange(
648-
self.volume_setting.n_skip_start,
649-
self.volume_setting.n_planes - self.volume_setting.n_skip_end,
650-
) / (self.volume_setting.frequency * self.volume_setting.n_planes)
655+
return (
656+
np.arange(
657+
self.volume_setting.n_skip_start,
658+
self.volume_setting.n_planes - self.volume_setting.n_skip_end,
659+
)
660+
/ (self.volume_setting.frequency * self.volume_setting.n_planes)
661+
)
651662

652663
def set_trigger_mode(self, mode: bool):
653664
if mode:

setup.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@
44
with open("requirements.txt") as f:
55
requirements = f.read().splitlines()
66

7+
with open("requirements_dev.txt") as f:
8+
requirements_dev = f.read().splitlines()
9+
10+
with open("README.md") as f:
11+
long_description = f.read()
12+
713
setup(
814
name="sashimi",
915
version="0.2.0",
1016
author="Vilim Stih @portugueslab",
1117
author_email="vilim@neuro.mpg.de",
1218
packages=find_packages(),
1319
install_requires=requirements,
14-
python_requires=">=3.7",
20+
extras_require=dict(dev=requirements_dev),
21+
python_requires=">=3.8",
1522
classifiers=[
1623
"Development Status :: 2 - Pre-Alpha",
1724
"Intended Audience :: Science/Research",
1825
"Natural Language :: English",
19-
"Programming Language :: Python :: 3.7",
2026
"Programming Language :: Python :: 3.8",
2127
],
2228
keywords="imaging microscopy lightsheet",
2329
description="A user-friendly software for efficient control of digital scanned light sheet microscopes (DSLMs).",
30+
long_description=long_description,
31+
long_description_content_type="text/markdown",
32+
url="https://github.com/portugueslab/sashimi",
2433
entry_points={
2534
"console_scripts": [
2635
"sashimi=sashimi.main:main",

0 commit comments

Comments
 (0)