Skip to content

Commit

Permalink
MA Mini barcode update (#583)
Browse files Browse the repository at this point in the history
- pulse3d 0.33.13 (fixes MA Mini barcode handling)
  • Loading branch information
tannermpeterson authored Jul 18, 2023
1 parent 2406621 commit dc983c1
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 65 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Changed:
^^^^^^^^
- Removed unnecessary log lines from log files.

Fixed:
^^^^^^
- Support for barcodes of MA Mini Plates.


1.1.4 (unreleased)
------------------
Expand Down
3 changes: 2 additions & 1 deletion controller/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ types-requests = "2.31.0.1"
websocket-client = "==1.1.0" # this is used by socketio in tests

[packages]
dnspython = "==2.3.0"
eventlet = "==0.33.3"
flask = "==1.1.2"
flask-cors = "==3.0.10"
Expand All @@ -37,7 +38,7 @@ jsonschema = "==4.1.0" # Tanner (11/8/21): latest version is having issues in c
nptyping = "==1.4.4" # Tanner (4/7/22): pinned for pulse3D
numpy = "==1.23.4"
psutil = "==5.8.0"
pulse3d = "==0.33.11"
pulse3d = "==0.33.13"
pyserial = "==3.5"
scipy = "==1.9.3"
semver = "==2.13.0"
Expand Down
128 changes: 69 additions & 59 deletions controller/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion controller/src/mantarray_desktop_app/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from pulse3D.constants import MAIN_FIRMWARE_VERSION_UUID
from pulse3D.constants import MANTARRAY_NICKNAME_UUID
from pulse3D.constants import MANTARRAY_SERIAL_NUMBER_UUID
from pulse3D.constants import MAX_MINI_SKM_EXPERIMENT_ID
from pulse3D.constants import NOT_APPLICABLE_H5_METADATA
from pulse3D.constants import PLATE_BARCODE_IS_FROM_SCANNER_UUID
from pulse3D.constants import PLATE_BARCODE_UUID
Expand Down Expand Up @@ -271,7 +272,7 @@ def _check_new_barcode(barcode: str, beta_2_mode: bool) -> str:
return f"barcode contains invalid year: '{barcode[2:4]}'"
if not 0 < int(barcode[4:7]) < 366:
return f"barcode contains invalid Julian date: '{barcode[4:7]}'"
if not 0 <= int(barcode[7:10]) < 400:
if not 0 <= int(barcode[7:10]) <= MAX_MINI_SKM_EXPERIMENT_ID:
return f"barcode contains invalid experiment id: '{barcode[7:10]}'"
# final digit must equal beta version (1/2)
last_digit = int(barcode[-1])
Expand Down
17 changes: 13 additions & 4 deletions controller/tests/server/test_calling_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from mantarray_desktop_app.main_process import server
from mantarray_desktop_app.utils.stimulation import get_pulse_duty_cycle_dur_us
from mantarray_desktop_app.utils.stimulation import SUBPROTOCOL_DUTY_CYCLE_DUR_COMPONENTS
from pulse3D.constants import MAX_MINI_SKM_EXPERIMENT_ID
from pulse3D.constants import MAX_VARIABLE_EXPERIMENT_ID
import pytest
from tests.fixtures_file_writer import GENERIC_STIM_INFO

Expand Down Expand Up @@ -598,7 +600,7 @@ def test_start_managed_acquisition__returns_error_code_if_already_running(
assert response.status_code == 304


def test_start_managed_acquisition__returns_200_when_mini_barcode_is_used(
def test_start_managed_acquisition__returns_no_error_when_mini_barcode_is_used(
client_and_server_manager_and_shared_values, mocker
):
test_client, _, shared_values_dict = client_and_server_manager_and_shared_values
Expand All @@ -608,7 +610,8 @@ def test_start_managed_acquisition__returns_200_when_mini_barcode_is_used(
well_idx: StimulatorCircuitStatuses.MEDIA.name.lower() for well_idx in range(24)
}

test_mini_barcode = "ML22001350-2"
exp_id = randint(MAX_VARIABLE_EXPERIMENT_ID + 1, MAX_MINI_SKM_EXPERIMENT_ID)
test_mini_barcode = f"ML22001{exp_id}-2"

response = test_client.get(f"/start_managed_acquisition?plate_barcode={test_mini_barcode}")
assert response.status_code == 200
Expand Down Expand Up @@ -828,12 +831,18 @@ def test_start_recording__returns_error_code_and_message_if_stim_barcode_is_not_
assert response.status.endswith("Request missing 'stim_barcode' parameter")


def test_start_recording__returns_200_when_mini_barcode_is_sent(client_and_server_manager_and_shared_values):
def test_start_recording__returns_no_error_when_mini_barcode_is_sent(
client_and_server_manager_and_shared_values,
):
test_client, _, shared_values_dict = client_and_server_manager_and_shared_values
put_generic_beta_2_start_recording_info_in_dict(shared_values_dict)
shared_values_dict["stimulation_running"] = [True] * 24

barcodes = {"plate_barcode": "ML22001350-2", "stim_barcode": MantarrayMcSimulator.default_stim_barcode}
exp_id = randint(MAX_VARIABLE_EXPERIMENT_ID + 1, MAX_MINI_SKM_EXPERIMENT_ID)
barcodes = {
"plate_barcode": f"ML22001{exp_id}-2",
"stim_barcode": MantarrayMcSimulator.default_stim_barcode,
}

response = test_client.get(f"/start_recording?{urllib.parse.urlencode(barcodes)}")
assert response.status_code == 200
Expand Down

0 comments on commit dc983c1

Please sign in to comment.