darsia.ImagingProtocol#

class ImagingProtocol(path, blacklist=None)[source]#

Bases: object

Imaging protocol mapping image file names to acquisition times.

Methods

find_ideal_images_for_datetimes(datetimes)

Find images in the folder that are closest to the specified times.

find_images_for_datetimes(paths, datetimes)

Find images in the folder that are closest to the specified times.

find_images_for_paths(paths)

Find image paths for given paths.

get_datetime(file_name)

Get the datetime of the image based on its path.

is_blacklisted(file_name)

Check if the image is blacklisted based on its path.

Attributes

df

DataFrame containing the protocol.

find_ideal_images_for_datetimes(datetimes)[source]#

Find images in the folder that are closest to the specified times.

Parameters:
datetimeslist of datetime

List of datetimes to find corresponding images for.

Returns:
list

List of image ids corresponding to the specified datetimes.

find_images_for_datetimes(paths, datetimes, tol=None)[source]#

Find images in the folder that are closest to the specified times.

Parameters:
pathsPath | list[Path]

Path to the folder containing images.

datetimeslist of datetime

List of datetimes to find corresponding images for.

tolfloat | None

Tolerance (in seconds) for finding closest images.

Returns:
list[Path]

List of image paths corresponding to the specified datetimes.

find_images_for_paths(paths)[source]#

Find image paths for given paths.

Parameters:
pathslist[Path]

Paths to search for.

Returns:
list[Path]

Image paths found for the given paths skipping blacklisted.

get_datetime(file_name)[source]#

Get the datetime of the image based on its path.

Parameters:
file_namePath

Path to the image file. The file name should end with a number. If contained in a considered imaging interval, the id can be correlated to a datetime.

Returns:
Optional[datetime]

The datetime of the image. None, if the file name is not contained in any of the imaging intervals.

is_blacklisted(file_name)[source]#

Check if the image is blacklisted based on its path.

Parameters:
file_namePath

Path to the image file. The file name should end with a number. If contained in a considered imaging interval, the id can be correlated to a datetime.

Returns:
bool

True if the image is blacklisted, False otherwise.

df#

DataFrame containing the protocol.