Skip to content

Commit

Permalink
ud
Browse files Browse the repository at this point in the history
  • Loading branch information
YNCris committed Apr 3, 2023
1 parent 953ccf7 commit 38168ba
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 9 deletions.
17 changes: 8 additions & 9 deletions README_SBeA_mapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,34 @@ Case data: [fig2_data\pose tracking](https://figshare.com/projects/Social_behavi
## Run
### 1. Seperate multi-animal to single-animal trajectories
The first step is a preparation of later steps.

Demo results:
![image]()

Script: [SBeA_step_1.m](https://github.com/YNCris/SBeA_release/blob/main/SBeA_mapper/SBeA_step_1.m)

Input:
*id3d.mat: multi-animal trajectories with identities
*-camera-0.avi: one camera view video
Demo results:
![image]()

Output:
*.mat: single-animal trajectories
*.avi: corresponding videos of single-animal trajectories
Demo results:
![image]()

### 2. Single animal behavior segmentation by Behavior Atlas (BeA)
The second step is to decompose the behvior of single animal.
Demo results:
![image]()

Script: [SBeA_step_2_mice.m](https://github.com/YNCris/SBeA_release/blob/main/SBeA_mapper/SBeA_step_2_mice.m)

Input:
*id3d.mat: multi-animal trajectories with identities
*-camera-0.avi: one camera view video
Demo results:
![image]()

Output:
*.mat: single-animal trajectories
*.avi: corresponding videos of single-animal trajectories
Demo results:
![image]()

### 3.
Script: [SBeA_step_1.m](https://github.com/YNCris/SBeA_release/blob/main/SBeA_mapper/SBeA_step_1.m)

Expand Down
12 changes: 12 additions & 0 deletions SBeA_mapper/HBTlog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@
10:02:55: Decomposing completed, time elapse: 208.114seconds
10:04:03: Decomposing poses, time elapse: 42.705seconds
10:04:04: Calculating kernel matrix, time elapse: 0.57seconds
10:10:24: Decomposing movements and ethograms, time elapse: 380.411seconds
10:10:38: Decomposing completed, time elapse: 437.303seconds
10:12:02: Decomposing poses, time elapse: 47.762seconds
10:12:03: Calculating kernel matrix, time elapse: 0.507seconds
10:15:54: Decomposing movements and ethograms, time elapse: 231.031seconds
10:16:03: Decomposing completed, time elapse: 288.637seconds
10:17:27: Decomposing poses, time elapse: 55.063seconds
10:17:28: Calculating kernel matrix, time elapse: 0.736seconds
10:18:34: Decomposing movements and ethograms, time elapse: 65.909seconds
10:18:43: Decomposing completed, time elapse: 131.131seconds
10:20:44: Decomposing poses, time elapse: 72.282seconds
10:20:45: Calculating kernel matrix, time elapse: 0.835seconds
16 changes: 16 additions & 0 deletions SBeA_mapper/tools/demo_results_step_1.asv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%{
show demo results of step 1
%}
clear all
close all
%% set path
rootpath = ['Z:\hanyaning\multi_mice_test\paper\' ...
'Nature Methods\test_run\pose tracking'];
dataname = 'rec11-A1A2-20220803-id3d.mat';
%% load data
load([rootpath,'\',dataname])
%% plot
traj1 = coords3d(:,1:48);
traj2 = coords3d(:,49:end);

for k = 1:
43 changes: 43 additions & 0 deletions SBeA_mapper/tools/demo_results_step_1.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%{
show demo results of step 1
%}
clear all
close all
addpath(genpath(pwd))
%% set path
rootpath = ['Z:\hanyaning\multi_mice_test\paper\' ...
'Nature Methods\test_run\pose tracking'];
dataname = 'rec11-A1A2-20220803-id3d.mat';
%% load data
load([rootpath,'\',dataname])
%% plot
setcolor = cbrewer2('Spectral',11);
mouse1_c = setcolor(3,:);
mouse2_c = setcolor(9,:);

traj1 = coords3d(:,1:48);
traj2 = coords3d(:,49:end);

smo_win = 30;
line_bias = 150;

for k = 1:48
plot(smooth(...
traj1(:,k)+k*line_bias-mean(traj1(:,k)),smo_win),...
'Color',mouse1_c)
hold on
end
mice_bias = 300;
for k = 1:48
plot(smooth( ...
traj2(:,k)+mice_bias+(k+48)*...
line_bias-mean(traj2(:,k)),smo_win),...
'Color',mouse2_c)
hold on
end
hold off

box off
set(gca,'TickDir','out')
xlabel('Frames')
set(gca,'YTick',[])
Binary file modified demo/Thumbs.db
Binary file not shown.
Binary file added demo/demo_step1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 38168ba

Please sign in to comment.