1- from typing import Optional
1+ from typing import Optional , List
22from synapse .api .node_pb2 import NodeConfig , NodeType
33from synapse .api .nodes .optical_stimulation_pb2 import OpticalStimulationConfig
44from synapse .client .node import Node
@@ -8,40 +8,40 @@ class OpticalStimulation(Node):
88 type = NodeType .kOpticalStimulation
99
1010 def __init__ (
11- self , peripheral_id , pixel_mask , bit_width , sample_rate , gain
11+ self , peripheral_id : int , pixel_mask : List [ int ] , bit_width : int , frame_rate : int , gain : float , send_receipts : bool = False
1212 ):
1313 self .pixel_mask = pixel_mask
1414 self .peripheral_id = peripheral_id
1515 self .bit_width = bit_width
16- self .sample_rate = sample_rate
16+ self .frame_rate = frame_rate
1717 self .gain = gain
18+ self .send_receipts = send_receipts
1819
1920 def _to_proto (self ):
2021 n = NodeConfig ()
2122 p = OpticalStimulationConfig ()
2223 p .peripheral_id = self .peripheral_id
23- for i in self .pixel_mask .iter_channels ():
24- p .pixel_mask .append (i )
24+ p .pixel_mask .extend (self .pixel_mask )
2525 p .bit_width = self .bit_width
26- p .sample_rate = self .sample_rate
26+ p .frame_rate = self .frame_rate
2727 p .gain = self .gain
28-
28+ p . send_receipts = self . send_receipts
2929 n .optical_stimulation .CopyFrom (p )
3030 return n
3131
3232 @staticmethod
3333 def _from_proto (proto : Optional [OpticalStimulationConfig ]):
3434 if proto is None :
35- return OpticalStimulation ()
35+ return OpticalStimulation (0 , [], 0 , 0 , 0.0 , False )
3636
3737 if not isinstance (proto , OpticalStimulationConfig ):
3838 raise ValueError ("proto is not of type OpticalStimulationConfig" )
3939
40- new_node = OpticalStimulation (
40+ return OpticalStimulation (
4141 peripheral_id = proto .peripheral_id ,
42- pixel_mask = proto .pixel_mask ,
42+ pixel_mask = list ( proto .pixel_mask ) ,
4343 bit_width = proto .bit_width ,
44- sample_rate = proto .sample_rate ,
44+ frame_rate = proto .frame_rate ,
4545 gain = proto .gain ,
46+ send_receipts = proto .send_receipts
4647 )
47- return new_node
0 commit comments