import image_marker as im import matplotlib.pyplot as plt import numpy as np import tracking_result as tr from IPython import embed import argparse import glob import sys import dark_light_coordinates as dl x_limits = np.array([0, 124]) y_limits = np.array([0, 81]) light_area_y = [45.5, 81] def get_risk(position, light_area_y, light_risk_scale=3, x_limits=np.array([0, 124]), y_limits = np.array([0, 81])): """Calculates the risk associated with a certain position in the arena Args: position (iterable): two-element vector of position i.e. (x,y) light_area_y (iterable): two element vactor with the start and stop y-coordinates of light area light_risk_scale (int, optional): if position is on th birght side, risk is scaled by this number. Defaults to 2. x_limits : extent of the tank on x axis in cm y_limits : extent of the tank on y axis in cm Returns: float: the risk for this position """ min_wall_dist_x = min(np.abs(position[0] - x_limits)) min_wall_dist_y = min(np.abs(position[1] - y_limits)) risk_x = 1/(max(x_limits)/2) * min_wall_dist_x risk_y = 1/(max(y_limits)/2) * min_wall_dist_y #risk_y = 1/(np.abs(np.diff(light_area_y))/2) * min_wall_dist_y total_risk = min(risk_x,risk_y) #+ 0.25 * (risk_x + risk_y) is_position_on_the_bright_side = position[1] >= light_area_y[0] and position[1] < light_area_y[1] if is_position_on_the_bright_side: total_risk = total_risk + 1 return total_risk x_positions = np.arange(0,125, 5) y_positions = np.arange(0, 81, 5) risk_matrix = np.zeros((len(x_positions), len(y_positions))) print(risk_matrix.shape) for i, x in enumerate(x_positions): for j, y in enumerate(y_positions): risk_matrix[i, j] = get_risk([x, y], light_area_y) plt.imshow(risk_matrix) plt.show() """ if __name__ == '__main__': vid = '/mnt/movies/merle_verena/boldness/labeled_videos/day_5/2020.12.07_lepto48.m4v' feeder_task = im.MarkerTask("Feeder positions", list(map(str, range(1, 9))), "Mark feeder positions") tasks = [feeder_task] image_marker = im.ImageMarker(tasks) # vid1 = "2020.12.11_lepto48DLC_resnet50_boldnessDec11shuffle1_200000_labeled.mp4" print(sys.argv[0]) print (sys.argv[1]) vid1 = sys.argv[1] marker_positions = im.mark_movie(vid1, 10) print(marker_positions) """