Data Extraction
- class ledsa.data_extraction.DataExtractor.DataExtractor(channels=0, load_config_file=True, build_experiment_infos=True, fit_leds=True)[source]
Bases:
objectA class responsible for extracting data from experiment images.
- Variables:
config (ConfigData) – Configuration data object.
channels (Tuple) – Channels to be processed.
fit_leds (bool :ivar fit_leds: Whether to fit LEDs or not.) – Whether to fit LEDs or not.
threshold (float, optional) – The threshold value used for LED detection.
line_indices (list[list[int]], optional) – 2D list with dimension (# of LED arrays) x (# of LEDs per array) or None.
- find_search_areas() None[source]
Identify all LEDs in the reference image and define the areas where LEDs will be searched in the experiment images.
- load_led_array_indices() None[source]
Load LED array indices from the ‘led_array_indices_{…}.csv’ files.
- load_search_areas() None[source]
Load LED search areas from the ‘led_search_areas.csv’ file. #TODO be consistent with search areas and ROIS
- match_leds_to_led_arrays() None[source]
Analyze which LEDs belong to which LED array and save this mapping.
- plot_led_arrays(merge_led_arrays=False) None[source]
Plots the arrangement of LEDs as identified in the LED arrays and saves the plot as a PDF file.
- Parameters:
merge_led_arrays (bool) – A flag indicating whether LED arrays have been merged. Affects the naming of the output file.
- plot_search_areas(reorder_leds=False) None[source]
Plot the identified LED search areas with their ID labels.
- Parameters:
reorder_leds (bool) – A flag indicating whether the LED IDs have been reordered. Affects the name of the output file.
- process_image_data() None[source]
Process all the image data to detect changes in light intensity in the search areas across the images. Removes ‘images_to_process.csv’ file afterward.
- process_img_file(img_filename: str) None[source]
Process a single image file to extract relevant data. This is a workaround for pool.map.
- Parameters:
img_filename (str) – The name of the image file to be processed.
- setup_restart() None[source]
Setup a restart in case the data extraction process was interrupted earlier.
- class ledsa.data_extraction.LEDAnalysisData.LEDAnalysisData(led_id, led_array, fit_leds)[source]
Bases:
objectRepresents LED analysis data, including its physical properties and fit results.
- Variables:
led_id (int) – The ID of the LED.
led_array (int) – The array index the LED belongs to.
fit_leds (bool) – Indicates whether to fit LEDs or not.
led_center_x (float) – X-coordinate of LED’s center.
led_center_y (float) – Y-coordinate of LED’s center.
mean_color_value (float) – Mean color value of the LED over the search area.
sum_color_value (float) – Integrated color value of the LED over the search area.
max_color_value (float) – Maximum color value observed for the LED.
fit_results (OptimizeResult) – Fit results after fitting.
fit_time (float) – Time taken for fitting.