@@ -241,49 +241,29 @@ def move(self, value, axis, is_absolute=True, is_blocking=True):
241
241
Args:
242
242
value (float): The physical distance to move the stage by.
243
243
axis (str): The axis along which the stage should be moved. Valid values are 'X', 'Y', 'Z', and 'A'.
244
- is_absolute (bool, optional): Specifies whether the movement should be relative or absolute.
245
- If True (default), the movement is performed in absolute coordinates.
246
- If False, the movement is performed in relative coordinates.
247
- is_blocking (bool, optional): Specifies whether the function should block until the stage has arrived at the destination.
248
- If True (default), the function will wait until the stage has arrived.
249
- If False, the function will not wait and return immediately after initiating the movement.
244
+ is_absolute (bool, optional): Specifies whether the movement should be relative or absolute. Default is True (absolute).
245
+ is_blocking (bool, optional): Specifies whether the function should block until the stage has arrived at the destination. Default is True.
250
246
251
247
Returns:
252
248
None
253
249
254
- Raises:
255
- ValueError: If an invalid axis is provided.
250
+ Example Use:
251
+ # Move the stage 10000 µm in the positive X direction in absolute coordinates and wait for the stage to arrive.
252
+ self.move(value=10000, axis="X", is_absolute=True, is_blocking=True)
253
+
254
+ # move the stage 10000 µm in the negative Y direction in relative coordinates and return immediately.
255
+ self.move(value=-10000, axis="Y", is_absolute=False, is_blocking=False)
256
256
257
257
Notes:
258
- - The stage must support the specified axis for the movement to be successful.
259
- - The value represents the physical distance to move the stage by. Positive values move the stage in the positive direction
260
- along the specified axis, while negative values move the stage in the negative direction.
261
- - If is_absolute is True, the value represents the absolute position to move the stage to along the specified axis.
262
- If is_absolute is False, the value represents the relative distance to move the stage from its current position.
263
- - If is_blocking is True, the function will wait until the stage has arrived at the destination before returning.
264
- If is_blocking is False, the function will initiate the movement and return immediately.
258
+ - Successful movement requires supported axis.
259
+ - Positive values move stage forward, negative values move it backward.
260
+ - `is_absolute=True` for absolute position, `is_absolute=False` for relative distance.
261
+ - `is_blocking=True` waits until stage arrives, `is_blocking=False` initiates and returns.
265
262
266
263
Explanation:
267
- This function allows you to move a microscope stage in the specified axis by a certain distance. The stage can be moved
268
- along the 'x', 'y', 'z', or 'a' axis. The distance is specified by the 'value' parameter, which represents the physical
269
- distance to move the stage by. Positive values move the stage in the positive direction along the specified axis,
270
- while negative values move the stage in the negative direction.
271
-
272
- By default, the movement is performed in absolute coordinates. This means that if 'is_absolute' is set to True (default),
273
- the value represents the absolute position to move the stage to along the specified axis. However, you can also choose
274
- to perform the movement in relative coordinates by setting 'is_absolute' to False. In this case, the value represents
275
- the relative distance to move the stage from its current position.
276
-
277
- Additionally, you can control whether the function blocks until the stage has arrived at the destination. If 'is_blocking'
278
- is set to True (default), the function will wait until the stage has arrived at the destination before returning. This
279
- can be useful if you want to ensure that the stage has completed the movement before executing further instructions.
280
- On the other hand, if 'is_blocking' is set to False, the function will initiate the movement and return immediately
281
- without waiting for the stage to arrive.
282
-
283
- Please note that if an invalid axis is provided, a ValueError will be raised. Make sure to use one of the valid axis
284
- values: 'X', 'Y', 'Z', or 'A'. Also, ensure that the microscope stage supports the specified axis for the movement
285
- to be successful.
286
-
264
+ This function allows moving the microscope stage along the 'x', 'y', 'z', or 'a' axis by a certain distance. "\
265
+ "Use 'value' for the distance, 'is_absolute' for absolute or relative coordinates, and 'is_blocking' to control waiting behavior. "\
266
+ "Ensure valid axis values and stage support.
287
267
"""
288
268
print (f"Moving stage to { value } along { axis } " )
289
269
self .stages .move (value = value , axis = axis , is_absolute = is_absolute , is_blocking = is_blocking )
@@ -302,8 +282,13 @@ def start_service(self, service_id, server_url="https://ai.imjoy.io/", workspace
302
282
server .register_service (
303
283
{
304
284
"id" : "microscope-control" ,
305
- "name" : "Microscope Control" , # <------------change this
306
- "description" : "Control the microscope stage" , # <------------change this
285
+ "name" : "openUC2 Microscope" ,
286
+ "description" : "The OpenUC2 Microscope Digital Interface grants precise control over an openuc2 microscope," \
287
+ "featuring essential components like a monochrome camera, laser, LED matrix, focusing stage, and XY stage. " \
288
+ "Standout features include easy manipulation of transparent samples with the XY stage, autofocus for accurate " \
289
+ "long-distance movements, and fluorescence microscopy capabilities with the laser. The LED matrix enhances phase " \
290
+ "contrast, while the monochrome camera captures high-quality grayscale images, facilitating diverse research" \
291
+ "applications. Researchers enjoy unparalleled precision and control over their experiments with this powerful tool." ,
307
292
"config" :{
308
293
"visibility" : "protected" ,
309
294
"run_in_executor" : True ,
@@ -314,8 +299,7 @@ def start_service(self, service_id, server_url="https://ai.imjoy.io/", workspace
314
299
"laserActivate" : self .laserActivate ,
315
300
"laserValue" : self .laserValue ,
316
301
"ledValue" : self .ledValue ,
317
- "snapImage" : self .snapImage ,
318
- # <------------add more functions here
302
+ "snapImage" : self .snapImage
319
303
}
320
304
)
321
305
# print("Workspace: ", workspace, "Token:", await server.generate_token({"expires_in": 3600*24*100}))
0 commit comments