Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
This is a package that connects ImSwitch's REST API to the rest of the world (e.g. jupyter lab)
ImSwitchClient
is a Python package designed to connect to the ImSwitch REST API, enabling remote control of ImSwitchUC2 functionalities directly from Jupyter Notebooks. This client facilitates easy integration with the ImSwitch ecosystem, offering programmable access to various features like laser control, stage manipulation, and image acquisition.
ImSwitchClient
is freely available for modification and distribution under the MIT license.To install ImSwitchClient
, use the following pip command:
pip install imswitchclient
This example demonstrates basic usage of ImSwitchClient
for moving a positioner and acquiring an image.
import imswitchclient.ImSwitchClient as imc
import numpy as np
import matplotlib.pyplot as plt
import time
# Initialize the client
client = imc.ImSwitchClient()
# Retrieve the first positioner's name and current position
positioner_names = client.positionersManager.getAllDeviceNames()
positioner_name = positioner_names[0]
currentPositions = client.positionersManager.getPositionerPositions()[positioner_name]
initialPosition = (currentPositions["X"], currentPositions["Y"])
# turn on illumination
mLaserName = client.lasersManager.getLaserNames()[0]
client.lasersManager.setLaserActive(mLaserName, True)
client.lasersManager.setLaserValue(mLaserName, 512)
for ix in range(10):
for iy in range(10):
# Define and move to a new position
newPosition = (initialPosition[0] + ix*50, initialPosition[1] + iy*50)
client.positionersManager.movePositioner(positioner_name, "X", newPosition[0], is_absolute=True, is_blocking=True)
client.positionersManager.movePositioner(positioner_name, "Y", newPosition[1], is_absolute=True, is_blocking=True)
# Acquire and display an image
#time.sleep(0.5) # Allow time for the move
lastFrame = client.recordingManager.snapNumpyToFastAPI()
plt.imshow(lastFrame)
plt.show()
# Return the positioner to its initial position
client.positionersManager.movePositioner(positioner_name, "X", initialPosition[0], is_absolute=True, is_blocking=True)
client.positionersManager.movePositioner(positioner_name, "Y", initialPosition[1], is_absolute=True, is_blocking=True)
Contributions to ImSwitchClient
are welcome! Please refer to the project's GitHub repository for contribution guidelines: https://github.com/openUC2/imswitchclient/.
ImSwitchClient
is licensed under the MIT License. For more details, see the LICENSE file in the project repository.
FAQs
This is a package that connects ImSwitch's REST API to the rest of the world (e.g. jupyter lab)
We found that imswitchclient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.