Configuration

ConfigData

class ledsa.core.ConfigData.ConfigData(load_config_file=True, img_directory=None, search_area_radius=10, pixel_value_percentile=99.875, channel=0, max_num_leds=None, num_arrays=None, num_cores=1, date=None, start_time=None, time_img_id=None, time_ref_img_time=None, time_diff_to_image_time=None, img_name_string=None, num_img_overflow=None, first_img_experiment_id=None, last_img_experiment_id=None, ref_img_id=None, ignore_led_indices=None, led_array_edge_indices=None, led_array_edge_coordinates=None, first_img_analysis_id=None, last_img_analysis_id=None, num_skip_imgs=0, num_skip_leds=0, merge_led_array_indices=None)[source]

Bases: ConfigParser

Class responsible for handling configuration data related to LEDSA.

get2dnparray(section, option, num_col=2, dtype=<class 'int'>) ndarray[source]

Extracts a 2D NumPy array from multi-line/ multi-column inputs the configuration.

Parameters:
  • section (str) – Section name in the configuration.

  • option (str) – Option name within the section.

  • num_col (int or 'var') – Number of columns expected in the array. Defaults to 2.

  • dtype (type) – Data type of the elements in the output array. Defaults to int.

Returns:

2D array from the configuration.

Return type:

numpy.ndarray or None

get_datetime(option='start_time') None[source]

Retrieves a datetime object from the configuration based on a provided option.

Parameters:

option (str) – The option name for which the datetime is required. Defaults to ‘start_time’.

Returns:

Datetime object corresponding to the option.

Return type:

datetime.datetime

get_start_time() None[source]

Retrieve and set the start time from the first experiment image.

Extracts the EXIF DateTimeOriginal from the image and then computes the start time. Updates the ‘DEFAULT’ key with the ‘start_time’ computed.

in_first_img_analysis_id() None[source]

Prompts the user for the ID of the first image for analysis and updates the configuration.

in_first_img_experiment_id() None[source]

Prompts the user for the ID of the first image of the experiment and updates the configuration.

in_img_dir() None[source]

Prompts the user for the image directory path and updates the configuration.

in_img_name_string() None[source]

Prompts the user for the image naming convention and updates the configuration.

in_last_img_analysis_id() None[source]

Prompts the user for the ID of the last image for analysis and updates the configuration.

in_last_img_experiment_id() None[source]

Prompts the user for the ID of the last image of the experiment and updates the configuration.

in_led_array_edge_coordinates() None[source]

Prompt the user to input the physical coordinates of the topmost and bottommost LED of each array.

Note

The coordinates should correspond to the order of the led_array edge indices. Coordinates are given in form X Y Z X Y Z and are separated by whitespace.

Raises:

ValueError – If any of the inputs are not formatted correctly.

in_led_array_edge_indices() None[source]

Prompt the user to input the labels of the topmost and bottommost LED of each array.

Note

The edges of the LED arrays are required. Labels for each array are separated by whitespace.

in_max_num_leds() None[source]

Prompts the user for the maximum number of LEDs to be detected on the reference image.

in_num_arrays() None[source]

Prompts the user for the number of LED arrays and updates the configuration.

in_num_img_overflow() None[source]

Prompts the user for the maximal image file ID and updates the configuration.

in_ref_img_id() None[source]

Prompts the user for the ID of the reference image and updates the configuration.

in_time_diff_to_img_time() None[source]

Update the configuration with the time difference between the reference image’s timestamp and the real time. If the ‘time_ref_img_time’ is not set, prompts the user to provide the time shown on the clock in the time reference image.

in_time_img_id() None[source]

Prompts the user for the time reference image name and updates the configuration.

load() None[source]

Loads the configuration data from ‘config.ini’ file.

Raises:

FileNotFoundError – If ‘config.ini’ is not found in the working directory.

save() None[source]

Saves the current configuration to ‘config.ini’ file.

ConfigDataAnalysis

class ledsa.analysis.ConfigDataAnalysis.ConfigDataAnalysis(load_config_file=True, camera_position=None, num_layers=20, domain_bounds=None, led_array_indices=None, num_ref_images=10, camera_channels=0, num_cores=1, reference_property='sum_col_val', average_images=False, solver='linear', weighting_preference=-0.006, weighting_curvature=1e-06, num_iterations=200, lambda_reg=0.001)[source]

Bases: ConfigParser

Class responsible for handling the configuration data related to LEDSA’s data analysis.

get_list_of_values(section: str, option: str, dtype=<class 'int'>) None[source]

Returns a list of values of a specified dtype from a given section and option.

Parameters:
  • section (str) – Section in the configuration file.

  • option (str) – Option under the specified section.

  • dtype (type) – Data type of the values to be returned. Defaults to int.

Returns:

List of values or None if the option’s value is ‘None’.

Return type:

list or None

in_camera_channels() None[source]

Prompts the user to input the camera channels to analyse and updates the configuration.

in_camera_position() None[source]

Prompts the user to input the camera’s global X, Y, Z coordinates and updates the configuration.

in_domain_bounds() None[source]

Prompts the user to input the lower and upper height of the spatial domain and updates the configuration.

in_led_array_indices() None[source]

Prompts the user to input the indices of (merged) LED Arrays for computation and updates the configuration.

in_num_layers() None[source]

Prompts the user to input the number of layers for spatial domain discretization and updates the configuration.

load() None[source]

Loads the configuration data from ‘config_analysis.ini’ file.

Raises:

FileNotFoundError – If ‘config_analysis.ini’ is not found in the working directory.

save() None[source]

Saves the current configuration to ‘config_analysis.ini’ file.