Commit 45d71c9b authored by lucas_miranda's avatar lucas_miranda
Browse files

Centering 8x faster

parent f18bba5d
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -285,13 +285,13 @@ class coordinates:
if center:
if self._arena == "circular":
for i, (key, value) in enumerate(tabs.items()):
value.loc[:, (slice("coords"), ["x"])] = value.loc[
:, (slice("coords"), ["x"])
].applymap(lambda x: x - self._scales[i][0] / 2)
value.loc[:, (slice("coords"), ["x"])] = (
value.loc[:, (slice("coords"), ["x"])] - self._scales[i][0] / 2
)
value.loc[:, (slice("coords"), ["y"])] = value.loc[
:, (slice("coords"), ["y"])
].applymap(lambda y: y - self._scales[i][1] / 2)
value.loc[:, (slice("coords"), ["y"])] = (
value.loc[:, (slice("coords"), ["y"])] - self._scales[i][1] / 2
)
if polar:
for key, tab in tabs.items():
......
......@@ -320,7 +320,7 @@ def Single_behaviour_analysis(
/ len(behavioural_dict[ind][behaviour_name])
)
if plot == True:
if plot:
sns.boxplot(list(beh_dict.keys()), list(beh_dict.values()), orient="vertical")
plt.title("{} across groups".format(behaviour_name))
......@@ -337,7 +337,7 @@ def Single_behaviour_analysis(
plt.show()
if stats == True:
if stats:
for i in combinations(treatment_dict.keys(), 2):
print(i)
print(scipy.stats.mannwhitneyu(beh_dict[i[0]], beh_dict[i[1]]))
......@@ -394,7 +394,7 @@ def Tag_video(
# Keep track of the frame number, to align with the tracking data
fnum = 0
if save == True:
if save:
writer = None
# Loop over the first frames in the video to get resolution and center of the arena
......@@ -618,12 +618,12 @@ def Tag_video(
2,
)
if show == True:
if show:
cv2.imshow("frame", frame)
if save == True:
if save:
if writer == None:
if writer is None:
# Define the codec and create VideoWriter object.The output is stored in 'outpy.avi' file.
# Define the FPS. Also frame size is passed.
writer = cv2.VideoWriter()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment