.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/live_imaging/viewing_the_sensor_tem.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_live_imaging_viewing_the_sensor_tem.py: Viewing the Sensor in TEM Mode ============================== This example shows how to view the sensor in TEM mode using the DEAPI. .. GENERATED FROM PYTHON SOURCE LINES 6-62 .. rst-class:: sphx-glr-script-out .. code-block:: none Command Version: 13 Summed Frames Per Second: 20.0 Total Frames (4.0) /home/runner/work/deapi/deapi/deapi/wrappers.py:49: VisibleDeprecationWarning: Argument `frameType` is deprecated. To avoid this warning, please do not use `frameType`. Use `frame_type` instead. See the documentation of `get_result()` for more details. def wrapped(*args, **kwargs): Response: 1806 Frame Index: 0 Max intensity: 10 | .. code-block:: Python import deapi from deapi.data_types import Attributes, ContrastStretchType import time import sys c = deapi.Client() if not sys.platform.startswith("win"): c.usingMmf = False # True if on same machine as DE Server and a Windows machine c.connect() # Set the autosave directory loc_time = time.localtime() c["Autosave Directory"] = ( f"D:\\Insitu\\{loc_time.tm_year}-{loc_time.tm_mon}-{loc_time.tm_mday}" ) c["Autosave Movie"] = "On" # Save the individual frames c["Autosave Final Image"] = "On" # Save the final summed image sum_frames = 10 c["Autosave Movie Sum Count"] = ( sum_frames # The total number of frames summed `c.start_acquisition`. ) c["Frames Per Second"] = 200 # The number of frames per second to acquire c["Frame Count"] = 40 # The number of frames to acquire print( f"Summed Frames Per Second: {c['Frames Per Second']/c['Autosave Movie Sum Count']}\n" f" Total Frames ({c['Frame Count'] / c['Autosave Movie Sum Count']})" ) c.start_acquisition(1) # Acquire 500 frames # While the acquisition is running, we can continuously poll the result # You can also pass an Attributes object to the get_result method # which will stretch the image to a specific size or adjust the LUT etc. # this isn't recommended but might be useful for display purposes. # attributes = Attributes() # attributes.stretchType = ContrastStretchType.NATURAL # attributes.windowWidth = c.image_sizex * 2 # 2x larger image # attributes.windowHeight = c.image_sizey * 2 # 2x larger image while c.acquiring: image, pixelFormat, attributes, histogram = c.get_result( frameType="singleframe_integrated", # atributes=attributes, ) # Do something with the image print(f"Frame Index: {(attributes.imageIndex+1)//sum_frames}") print(f"Max intensity: {image.max()}") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.066 seconds) .. _sphx_glr_download_examples_live_imaging_viewing_the_sensor_tem.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viewing_the_sensor_tem.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viewing_the_sensor_tem.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: viewing_the_sensor_tem.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_