Skip to content

Commit 4328ffe

Browse files
committed
bug: fix experiment.create_gates()
1 parent be6d1b2 commit 4328ffe

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

cellengine/resources/experiment.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,14 @@ def get_gate(self, _id: str) -> Gate:
508508

509509
def create_gates(self, gates: List):
510510
"""Save a collection of gate objects."""
511-
return Gate.bulk_create(self._id, gates)
511+
for gate in gates:
512+
gate["experiment_id"] = self._id
513+
formatted_gates = [Gate._format_gate(gate) for gate in gates]
514+
return ce.APIClient().post_gates(
515+
self._id,
516+
formatted_gates,
517+
{"create_population": False},
518+
)
512519

513520
def delete_gate(
514521
self,

tests/integration/test_experiment.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,24 @@ def test_update_experiment(blank_experiment):
240240
blank_experiment.name = "new name"
241241
blank_experiment.update()
242242
assert blank_experiment.name == "new name"
243+
244+
245+
def test_create_gates(full_experiment):
246+
full_experiment["experiment"].create_gates(
247+
[
248+
{
249+
"type": "RectangleGate",
250+
"name": "rect",
251+
"model": {
252+
"rectangle": {
253+
"x1": -1.16,
254+
"y1": 2284526,
255+
"x2": -0.7123,
256+
"y2": 2893493,
257+
}
258+
},
259+
"x_channel": "BUV805-A",
260+
"y_channel": "FSC-H",
261+
}
262+
]
263+
)

0 commit comments

Comments
 (0)