@@ -654,9 +654,9 @@ def get_position(self, axis=None, timeout=1):
654654 _physicalOffsets = np .array ((self .offsetA , self .offsetX , self .offsetY , self .offsetZ ))
655655
656656 # this may be an asynchronous call.. #FIXME!
657- r = self ._parent .post_json (path , payload , getReturn = True , nResponses = 1 , timeout = timeout )
657+ r = self ._parent .post_json (path , payload , getReturn = True , nResponses = 1 , timeout = timeout )[ 0 ]
658658 # returns {"motor": }
659- if "motor" in r :
659+ if "motor" in r :
660660 for index , istepper in enumerate (r ["motor" ]["steppers" ]):
661661 if index > 3 : break # TODO: We would need to handle other values too soon
662662 _position [istepper ["stepperid" ]]= istepper ["position" ]* _physicalStepSizes [self .motorAxisOrder [index ]]- _physicalOffsets [self .motorAxisOrder [index ]]
@@ -775,6 +775,32 @@ def start_stage_scanning(self, xstart=0, xstep=1000, nx=20, ystart=0, ystep=1000
775775 r = self ._parent .post_json (path , payload )
776776 return r
777777
778+ def start_stage_scanning_by_coordinates (self , coordinates , tPre = 50 , tPost = 50 , led = 100 , illumination = [50 , 75 , 100 , 125 ], stopped = 0 ):
779+ '''
780+ Example: {"task": "/motor_act", "stagescan": {"coordinates": [{"x": 100, "y": 200}, {"x": 300, "y": 400}, {"x": 500, "y": 600}], "tPre": 50, "tPost": 50, "led": 100, "illumination": [50, 75, 100, 125], "stopped": 0}}
781+
782+ coordinates: list of dictionaries with x and y coordinates
783+ tPre: time before exposure in ms
784+ tPost: exposure time - time after action
785+ led: led value for illumination
786+ illumination: list of values for each channel of the illumination
787+ stopped: 0 for start, 1 for stop
788+ '''
789+ path = "/motor_act"
790+ payload = {
791+ "task" : path ,
792+ "stagescan" : {
793+ "coordinates" : coordinates ,
794+ "tPre" : tPre ,
795+ "tPost" : tPost ,
796+ "led" : led ,
797+ "illumination" : illumination ,
798+ "stopped" : stopped
799+ }
800+ }
801+ r = self ._parent .post_json (path , payload )
802+ return r
803+
778804 def set_tmc_parameters (self , axis = 0 , msteps = None , rms_current = None , stall_value = None , sgthrs = None , semin = None , semax = None , blank_time = None , toff = None , timeout = 1 ):
779805 ''' set the TMC parameters for a specific axis
780806 msteps: microsteps
0 commit comments