class documentation

A thing for creating timelapses.

Method __enter__ Open database engine when the Thing context manager is opened.
Method __exit__ Close database engine when the Thing context manager is closed.
Method __init__ Initialise the thing by creating a save queue.
Method capture_timelapse Capture a timelapse.
Method delete_all_gallery_items Delete all the timelapses on the microscope.
Method delete_timelapse Delete the specified timelapse.
Method download_zip Return zip of the files captured in the timelapse.
Method get_gallery_bulk_actions Return the bulk gallery actions for timelapse.
Method tab_ui Return the UI specification for the tab in the webapp.
Class Variable autofocus_dz Z range in steps over which autofocus is performed.
Class Variable autofocus_enabled Set to True to autofocus prior to each image.
Class Variable dt Time interval between captures in seconds.
Class Variable duration Total duration of the timelapse in seconds.
Class Variable tab_description Undocumented
Property gallery_db_engine The database engine.
Method _capture Capture a single image in the timelapse and update json data.
Method _completion_routine Tidy up and add to gallery after the timelapse.
Method _generate_gallery_info Generate a TimelapseGalleryInfo object with the current data.
Method _run_timelapse Run the internal main loop of the timelapse.
Method _save_thread_loop Loop and save all queued data. Runs in a separate thread.
Class Variable _autofocus Undocumented
Class Variable _cam Undocumented
Class Variable _class_settings Undocumented
Class Variable _show_data_in_gallery Undocumented
Instance Variable _gallery_db_engine Undocumented
Instance Variable _save_queue Undocumented

Inherited from OFMThing:

Method create_data_path Create a RelativeDataPath object with this Thing set as the saving Thing.
Property data_dir The data directory for this thing.
Property show_data_in_gallery Whether to show in the Gallery.
Instance Variable _data_dir Undocumented
def __enter__(self) -> Self: (source)

Open database engine when the Thing context manager is opened.

def __exit__(self, _exc_type: type[BaseException], _exc_value: BaseException | None, _traceback: TracebackType | None): (source)

Close database engine when the Thing context manager is closed.

def __init__(self, thing_server_interface: lt.ThingServerInterface): (source)

Initialise the thing by creating a save queue.

@lt.action
def capture_timelapse(self, name: str | None = None): (source)

Capture a timelapse.

A directory will be created with all timelapse images. These will show in the gallery.

Parameters
name:str | NoneThe name of the timelapse. The date will be appended to the name. If no name is given the name "Timelapse" is used.
def delete_all_gallery_items(self): (source)

Delete all the timelapses on the microscope.

Use with extreme caution.

@lt.endpoint('delete', 'timelapse/{name}', responses={200: {'description': 'Successfully deleted timelapse'}, 400: {'description': 'An error occurred while trying to delete timelapse'}})
def delete_timelapse(self, name: str): (source)

Delete the specified timelapse.

This endpoint allows timelapses to be deleted from disk.

Parameters
name:strThe name of the timelapse to delete
@lt.action(use_global_lock=False)
def download_zip(self, name: str) -> lt.blob.Blob: (source)

Return zip of the files captured in the timelapse.

def get_gallery_bulk_actions(self) -> list[ui.ActionButton]: (source)

Return the bulk gallery actions for timelapse.

Currently there are no bulk actions.

@lt.endpoint('get', 'tab_ui', responses=ui.WEBAPP_TAB_RESPONSE)
def tab_ui(self) -> ui.UIElementList: (source)

Return the UI specification for the tab in the webapp.

autofocus_dz: int = (source)

Z range in steps over which autofocus is performed.

autofocus_enabled: bool = (source)

Set to True to autofocus prior to each image.

dt: float = (source)

Time interval between captures in seconds.

duration: int = (source)

Total duration of the timelapse in seconds.

Undocumented

@property
gallery_db_engine: TimelapseGalleryDBEngine = (source)

The database engine.

def _capture(self, dir_name: str, all_captures: list[TimelapseCaptureData], start_time: float): (source)

Capture a single image in the timelapse and update json data.

Parameters
dir_name:strDirectory to write to
all_captures:list[TimelapseCaptureData]A list of all captures already captured. When the capture is taken, this will be added to.
start_time:floatThe time that the timelapse started.
def _completion_routine(self, name: str, all_captures: list[TimelapseCaptureData]): (source)

Tidy up and add to gallery after the timelapse.

This runs even if there is an error. It is run in a finally block so must never error!

Parameters
name:strThe name of the timelapse directory.
all_captures:list[TimelapseCaptureData]All captures recorded during the run.
def _generate_gallery_info(self, all_captures: list[TimelapseCaptureData], start_time: float) -> TimelapseGalleryInfo: (source)

Generate a TimelapseGalleryInfo object with the current data.

Parameters
all_captures:list[TimelapseCaptureData]A list of all captures already captured.
start_time:floatThe time that the timelapse started.
Returns
TimelapseGalleryInfoUndocumented
def _run_timelapse(self, name: str, all_captures: list[TimelapseCaptureData]): (source)

Run the internal main loop of the timelapse.

Parameters
name:strThe name of the timelapse directory.
all_captures:list[TimelapseCaptureData]An empty list to add each capture object to during the run.
def _save_thread_loop(self): (source)

Loop and save all queued data. Runs in a separate thread.

Undocumented

Undocumented

_class_settings: dict[str, bool] = (source)

Undocumented

_gallery_db_engine: TimelapseGalleryDBEngine | None = (source)

Undocumented

_save_queue: queue.Queue[SaveQueueData | None] = (source)

Undocumented