Last active
August 14, 2023 20:48
-
-
Save nclack/5690df039d2206fedfb5abf8e9d64aff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import acquire | |
runtime = acquire.Runtime() # initializes driver adapters | |
# All the settings are in the `props` | |
# Configuration objects are typed. | |
# They can all be made into a dict. e.g: props.dict() | |
# They can also be read from a dict. e.g. Properties(**json.load('acquire.json'))) | |
p = runtime.get_configuration() | |
# Camera configuration | |
p.video[0].camera.identifier = runtime.device_manager().select(acquire.DeviceKind.Camera, 'Hamamatsu C15440.*') | |
p.video[0].camera.settings.binning = 1 | |
p.video[0].camera.settings.shape = (1700, 512) | |
p.video[0].camera.settings.offset = (302, 896) # centers the roi | |
p.video[0].camera.settings.pixel_type = acquire.SampleType.U16 | |
p.video[0].max_frame_count = 10 # finite acquisition of 10 frames. Use 0 for infinite. | |
# Internal triggering is used when no input_triggers are enabled. | |
# By default, internal triggering is used. | |
# To explicitly disable external input triggers: | |
p.video[0].camera.settings.input_triggers = acquire.InputTriggers() # default: disabled | |
# Output trigger on "Timing 1" | |
# Can also construct Trigger from a json, like: acquire.Trigger(**json.loads(open('trigger.json'))) | |
p.video[0].camera.settings.output_triggers.exposure = acquire.Trigger( | |
enable=True, line=1, edge="Rising" | |
) | |
# Save to zarr | |
p.video[0].storage.identifier = runtime.device_manager().select(acquire.DeviceKind.Storage,'zarr') | |
p.video[0].storage.settings.filename="out.zarr" | |
# Nothing happens until you call set_configuration | |
# The returned `props` reads back what actually got set on the devices. | |
# Since the devices are set here, the returned `props` will have the | |
# settings read from those devices. | |
p = runtime.set_configuration(p) | |
# # Print out the settings | |
# from rich.pretty import pprint | |
# pprint(p.dict()) | |
runtime.start() | |
runtime.stop() # wait till done. Alternatively use runtime.abort() to immediately stop. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment