Camera scripting Andreas Mittelberger
Outline 1. Nion Swift camera API 2. Scientific cameras 3. Webcams 4. “Simple” scientific cameras
Nion Swift camera API User interface ... (nionui) Core (nionswift) hardware control extensions (nionswift-instrumentation)
Nion Swift camera API scan device camera device video device nionswift-instrumentation
Nion Swift camera API camera device video device ● Meant for scientific cameras ● Meant for “simple” cameras ● Full control over the device (via the ● Only supports “Play” and “Pause” frame_parameters object) ● No extra control panel, just the buttons in ● Usually comes with a graphical user the data item panel interface (control panel) ● Can be controlled via API ● Data acquisition via API ● Usually high data rates (compared to scanning)
Camera panel types camera device camera_panel_type = "ronchigram" camera_panel_type = "eels" camera_panel_type = "andor_eels"
Webcams - built-in support video device First we have to install the nionswift-video-capture plugin: conda install -n nionswift -c nion nionswift-video-capture opencv pip install nionswift-video-capture opencv-python
Webcams - built-in support video device Edit Preferences
Webcams - third party video device Edit Preferences
“Simple” scientific camera video device
“Simple” scientific camera video device
“Simple” scientific camera video device
Camera scripting from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") ronchigram = stem_controller.ronchigram_camera frame_parameters = ronchigram.get_current_frame_parameters() # adjust frame_parameters here if desired frame_parameters["exposure_ms"] = 200 # start the camera ronchigram.start_playing(frame_parameters) # grab two consecutive frames, with a guaranteed start time after the first call frame1 = ronchigram.grab_next_to_start()[0] frame2 = ronchigram.grab_next_to_finish()[0] # stop the camera ronchigram.stop_playing()
Get the code ● Webcam plugin: https://github.com/Brow71189/SwiftCam ● “Simple” scientific camera: (careful this experimental code!) https://github.com/Brow71189/matrix_vision 18
Thank you for your attention
Recommend
More recommend