utils#

Miscellaneous diagnostic helpers.

These utilities are not imported by the runtime; they are convenience functions for use in ad-hoc scripts, notebooks, and the embedded IPython console. nidaqmx is imported lazily inside the NI-DAQ helpers so this module loads cleanly on machines without NI-DAQmx installed.

mesofield.utils.utils.get_fps(mmc)[source]#
Calculate the frames per second (FPS) based on the number of frames and duration of an MDA sequence.
  • num_frames = num_trials × trial_time(5 seconds) × framerate (45 fps)

  • num_trials = num_frames / (trial_time * framerate) (255 frames for a 5 seconds trial at 45 fps)

  • Total duration = num_frames / framerate or num_trials * trial_time

  • num_frames = num_trials × trial_time(5 seconds) × framerate (45 fps)

Parameters:

mmc (CMMCorePlus)

mesofield.utils.utils.load_metadata_from_json(json_file_path)[source]#

load metadata from a JSON file as a Pandas Dataframe.

Return type:

DataFrame

mesofield.utils.utils.list_serial_ports()[source]#

List all available serial ports on the system

mesofield.utils.utils.download_usb_ids()[source]#

Download the USB IDs file from the internet resources

mesofield.utils.utils.parse_usb_ids(usb_ids_content)[source]#

Parse the USB IDs file and return a dictionary of vendor IDs and product IDs

mesofield.utils.utils.identify_device(vendor_id, product_id, usb_ids)[source]#

Identify the vendor and product of a USB device using the USB IDs file

mesofield.utils.utils.list_serial_ports_with_vendors(usb_ids)[source]#

List serial ports and resolve their vendor / product names.

Parameters:

usb_ids – Dictionary produced by parse_usb_ids().

mesofield.utils.utils.list_nidaq_devices()[source]#

List all connected NI-DAQ devices.

mesofield.utils.utils.read_analog_input(device_name, channel='ai0')[source]#

Read a single analog input from a specified channel.

mesofield.utils.utils.test_nidaq_connection(device_name)[source]#

Test connection to a specified NI-DAQ device.

mesofield.utils.utils.sanity_check(mmc)[source]#

Perform a sanity check to ensure that the Core is properly initialized and that the camera is connected.

This function lists: - the loaded devices - configuration groups - current MMCore configuration settings - camera settings.