diff --git a/setup.py b/setup.py index e1ca237..902cb61 100644 --- a/setup.py +++ b/setup.py @@ -17,10 +17,10 @@ NAME = 'ysmr' DESCRIPTION = 'Bacterial video tracking and analysis.' URL = 'https://github.com/schwanbeck/YSMR' -EMAIL = 'julian.schwanbeck@med.uni-goettingen.de' +EMAIL = 'schwan@umn.edu' AUTHOR = 'Julian Schwanbeck' REQUIRES_PYTHON = '>=3.6.0' -VERSION = '0.1.4' +VERSION = '0.1.5' # What packages are required for this module to be executed? REQUIRED = [ diff --git a/ysmr.py b/ysmr.py index 885d93d..98db388 100644 --- a/ysmr.py +++ b/ysmr.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019 Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR ##Explanation This file starts YSMR. diff --git a/ysmr/__version__.py b/ysmr/__version__.py index fef90a5..90d775b 100644 --- a/ysmr/__version__.py +++ b/ysmr/__version__.py @@ -8,6 +8,6 @@ # #### #### #### # ### # # # # ###### # # #### #### # # ##### or YoghurtYetis Software for Motility Recognition """ -VERSION = (0, 1, 4) +VERSION = (0, 1, 5) __version__ = '.'.join(map(str, VERSION)) diff --git a/ysmr/gsff.py b/ysmr/gsff.py index 4efabda..746b0b4 100644 --- a/ysmr/gsff.py +++ b/ysmr/gsff.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Jerôme Dretzke and Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Jerôme Dretzke and Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR Original Idea and Equations from Pak, JM: Gaussian Sum FIR Filtering for 2D Target Tracking (DOI: 10.1007/s12555-018-0938-4) diff --git a/ysmr/helper_file.py b/ysmr/helper_file.py index 308aacc..4b65695 100644 --- a/ysmr/helper_file.py +++ b/ysmr/helper_file.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR ##Explanation This file contains various functions used by YSMR. @@ -39,7 +39,7 @@ def argrelextrema_groupby(group, comparator=np.greater_equal, order=10, shift_range=4, fill_value=0): """Find local minima/maxima in range of order (depending on comparator). When shift is not 0, will only return one result in range of shift. - Returns array with non-extrema replaced by fil_value + Returns array with non-extrema replaced by fill_value :param group: array like :param comparator: numpy comparator or equivalent @@ -63,7 +63,8 @@ def argrelextrema_groupby(group, comparator=np.greater_equal, order=10, shift_ra (query == 1), 0, result)) result = np.where(result == 1, group_intermediate, fill_value) - result = pd.Series(result, index=group.index) + # @todo: check if we can skip the series conversion while using this with df .transform instead of .apply + result = pd.Series(result, index=group.index) # .reindex_like(group) return result @@ -1200,7 +1201,8 @@ def logging_listener(settings): print('Problem:', file=sys.stderr) traceback.print_exc(file=sys.stderr) try: - traceback.print_exc(file=settings['log file path']) + with open(file=settings['log file path'], mode='w+') as file: + traceback.print_exc(file=file) except (FileNotFoundError, PermissionError): pass break diff --git a/ysmr/main.py b/ysmr/main.py index 23497ae..d554823 100644 --- a/ysmr/main.py +++ b/ysmr/main.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR ##Explanation This file starts YSMR. diff --git a/ysmr/plot_functions.py b/ysmr/plot_functions.py index 34344a2..57a0ab6 100644 --- a/ysmr/plot_functions.py +++ b/ysmr/plot_functions.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR ##Explanation This file contains functions which create plots for YSMR. diff --git a/ysmr/track_eval.py b/ysmr/track_eval.py index 283e654..0f5f9f3 100644 --- a/ysmr/track_eval.py +++ b/ysmr/track_eval.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Julian Schwanbeck (schwan@umn.edu) https://github.com/schwanbeck/YSMR ##Explanation This file contains the main functions used by YSMR. @@ -288,7 +288,7 @@ def track_bacteria(video_path, settings=None, result_folder=None): # cv2.minAreaRect returns ((x, y), (w, h), degrees) if settings['include luminosity in tracking calculation']: - box = np.int0(cv2.boxPoints(reichtangle)) + box = np.intp(cv2.boxPoints(reichtangle)) # must be generated for each object as cv2.fillpoly() changes it's input mask = np.zeros((frame_height, frame_width), dtype=np.uint8) cv2.fillPoly(mask, [box], 255) @@ -304,7 +304,7 @@ def track_bacteria(video_path, settings=None, result_folder=None): # reshape_result(tuple_of_tuples) returns ((x, y[, *args]), (w, h, degrees_orientation)) if settings['display video analysis']: # or settings['save video']: # Display bounding boxes - box = np.int0(cv2.boxPoints(reichtangle)) + box = np.intp(cv2.boxPoints(reichtangle)) # Box: 4 x/y coordinates cv2.drawContours(frame, [box], -1, (255, 0, 0), 0) @@ -973,7 +973,9 @@ def evaluate_tracks(path_to_file, results_directory, df=None, settings=None, fps df['y_norm'] = (df['POSITION_Y'].sub(df.groupby('TRACK_ID')['POSITION_Y'].transform('first'))) / px_to_micrometre # get local maxima - df['turn_points'] = df.groupby('TRACK_ID')['turn_points'].apply(argrelextrema_groupby) + df['turn_points'] = df.groupby('TRACK_ID')['turn_points'].transform( + argrelextrema_groupby + ) # Convert to binary df['turn_points'] = np.where(df['turn_points'] == 0, 0, 1).astype(np.int8) # start counts as TP so we can later group by TPs @@ -1198,9 +1200,10 @@ def evaluate_tracks(path_to_file, results_directory, df=None, settings=None, fps df_stats_seaborne.dropna(subset=[cut_off_category], inplace=True) # Exchange int values in 'Categories' for correct labels - df_stats_seaborne[cut_off_category].replace( # name_all_categories is not present and can be skipped + df_stats_seaborne[cut_off_category] = df_stats_seaborne[cut_off_category].replace( + # name_all_categories is not present and can be skipped {value: key for key, value in zip([i for (_, _, i) in cut_off_list[1:]], range(1, len(cut_off_list)))}, - inplace=True) + ) # Put name_all_categories and assigned categories in one df df_stats_seaborne = pd.concat([df_stats, df_stats_seaborne], ignore_index=True) diff --git a/ysmr/tracker.py b/ysmr/tracker.py index e2d70a1..7a83c91 100644 --- a/ysmr/tracker.py +++ b/ysmr/tracker.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Copyright 2019, 2020 Julian Schwanbeck (julian.schwanbeck@med.uni-goettingen.de) +Copyright 2019, 2020 Julian Schwanbeck (schwan@umn.edu) Original Idea by Adrian Rosebrock (adrian@pyimagesearch.com) https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/ ##Explanation