acquisition scripting
play

Acquisition Scripting Nion Swift Workshop Chris Meyer 2018 October - PowerPoint PPT Presentation

Nion Swift Acquisition Scripting Nion Swift Workshop Chris Meyer 2018 October 4 Introduce STEM control, scan devices, cameras, and also programming techniques, instrument simulator, and threading concerns. Nion Swift Acquisition Scripting


  1. Nion Swift Acquisition Scripting Nion Swift Workshop Chris Meyer 2018 October 4 Introduce STEM control, scan devices, cameras, and also programming techniques, instrument simulator, and threading concerns.

  2. Nion Swift Acquisition Scripting In this session, we will cover preliminary material regarding STEM control, scan devices, cameras, and also review the programming techniques that we'll be using in the following sessions to access those devices. We will introduce the instrument simulator and show how it can be used to experiment offline with instruments and acquisition devices. We will also discuss issues related to threading.

  3. Nion Swift Acquisition Scripting In this talk you'll learn about: The STEM controller, scan controller, and cameras. The instrument simulator. Acquisition and Python threading.

  4. Nion Swift Acquisition Scripting What is an API? An API is an "application programming interface". It describes the functions that are provided to interface with Nion Swift. The functions are intended to be supported in the long term so that code you write today which uses the API will work the same way in the coming years. But… sometimes things will break. It is up to the maintainers of the code to ensure that the code works with Nion Swift as it evolves.

  5. Nion Swift Acquisition Scripting What is an API? There are more functions than defined in the documentation. Sometimes you may need to use an undocumented function or parameter to work around a bug or access a capability not yet available in the API. Trade-off: undocumented functions may disappear or change behavior. Use the defined API as much as possible. Projects maintained by Nion use different standards since we can coordinate releases.

  6. Nion Swift Acquisition Scripting STEM Controller from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Base object for accessing other objects ● scan = stem_controller.scan_controller ● Access to AS2, scan controller, Ronchigram and EELS cameras, video ronchigram = stem_controller.ronchigram_camera Probe position ● ● Future: Access to additional detectors eels = stem_controller.eels_camera (EDS, CL, etc.) Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  7. Nion Swift Acquisition Scripting AS2 Controls from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Get and set controls in AS2 ● defocus = stem_controller.GetVal("C10") ● GetVal, SetValAndConfirm Gwyn will cover more in later talk ● stem_controller.SetValAndConfirm("C10", -2000E-9, 1.0, 3000) Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  8. Nion Swift Acquisition Scripting Acquisition devices from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Scan, camera, and video ● ronchigram_camera = stem_controller.ronchigram_camera ● General concept is that devices have different modes of operation ronchigram_camera.start_playing() View mode, recording mode ● time.sleep(5.0) ● Also known as "playback" ronchigram_camera.stop_playing() Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  9. Nion Swift Acquisition Scripting Acquisition settings Saved sets of frame parameters, called "settings". ● ● Future API will include ability to access, modify, and use settings. If you need this before API available, talk to us. ● Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  10. Nion Swift Acquisition Scripting Frame parameters from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Acquisition devices use frame parameters ● camera = stem_controller.ronchigram_camera to describe desired acquisition. Frame parameters can be read, modified, ● frame_params = camera.get_current_frame_parameters() and set when playing frame_params["exposure_ms"] = 50 ● Sets of frame parameters configurable by users are called settings; limited support. ronchigram_camera.start_playing(frame_params) Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  11. Nion Swift Acquisition Scripting Frame timing from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Some acquisition devices such as ● camera = stem_controller.ronchigram_camera cameras expose detector. Tricky to ensure that the detector is ● stem_controller.SetValAndConfirm("C10", 1E-9, 1.0, 3000) exposed after a state change. ● Sometimes throwing out frames to camera.grab_next_to_start() # throw away compensate. data_list = camera.grab_next_to_start() # real data Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  12. Nion Swift Acquisition Scripting Data Channels Most data coming from acquisition devices will be sent to a data channel ● ● This is the way that Nion Swift receives the data from an arbitrary thread Easy to view data channels, to see what's going on most of the time ● Some exceptions, SI (work in progress) ● Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  13. Nion Swift Acquisition Scripting Sequence Acquisition from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Some devices (cameras) support sequence ● camera = stem_controller.eels_camera acquisition camera.start_playing() Sequence acquisition grabs consecutive ● frames, must prepare memory if camera.grab_sequence_prepare(10): ● Difficult to synchronize cameras precisely data_list = camera.grab_sequence(10) Returns an xdata sequence for each ● channel Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  14. Nion Swift Acquisition Scripting Buffer Acquisition from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Some devices support buffered acquisition, ● camera = stem_controller.eels_camera grabbing previously acquired data. camera.start_playing() Returns a Python list of xdata tuples (one ● for each channel) data_list = camera.grab_buffer(10) ● Again: difficult to synchronize Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  15. Nion Swift Acquisition Scripting Scan Controller from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Primary interface to control scanning ● scan = stem_controller.scan_controller ● Scan device can acquire multiple channels of data. Scan device: easy to predict frame timing. ● Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  16. Nion Swift Acquisition Scripting Scan Frame Parameters from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") Describe the physical scan area (field of view, ● scan = stem_controller.scan_controller rotation) params = scan.get_current_frame_parameters() Describe the scan resolution (size) ● params["fov_nm"] = 20 Describe the timing (pixel time) ● params["pixel_time_us"] = 4 ● Applications should save/restore frame parameters when finished Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  17. Nion Swift Acquisition Scripting Scan Channels from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") SuperScan can acquire multiple channels ● scan = stem_controller.scan_controller ● Channels are shared between frame parameters (currently) scan.set_enabled_channels([0, 1]) print(scan.get_enabled_channels()) Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  18. Nion Swift Acquisition Scripting Sub-scan and line scan from nion.utils import Registry stem_controller = Registry.get_component("stem_controller") A context scan establishes a reference frame ● scan = stem_controller.scan_controller ● Possible to specify further scans relative to params = scan.get_current_frame_parameters() that reference frame params["subscan_fractional_size"] = (0.40, 0.25) Sub-scan or line scan are special scans ● params["subscan_fractional_center"] = (0.60, 0.70) configured within the reference frame Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

  19. Nion Swift Acquisition Scripting Synchronized scan combined_data = scan.grab_synchronized( scan_frame_parameters=scan_frame_param eters, A synchronized scan synchronizes a camera ● camera=eels, to the scan so that one camera frame is camera_frame_parameters= acquired for each scan position. eels_frame_parameters) Requires hardware trigger to be configured ● scan_datas, camera_datas = combined_data properly. haadf_data = scan_datas[0] Produces scan data and camera data (lots of ● eels_data = camera_datas[0] it, too!) Full documentation: https://nionswift-instrumentation.readthedocs.io/en/latest/

Recommend


More recommend