def merge_all_trajectories(ts): return load_data.session(trajectories=[a.trajectories for a in ts], timestamps=[a.timestamps for a in ts], slices=[a.slices for a in ts], video=[a.video for a in ts], speeds=[a.speeds for a in ts], labels=[a.labels for a in ts], steps=[a.steps for a in ts], slips=[a.slips for a in ts])
def revert_experiment_structure(experiment): return load_data.session( trajectories=[[s.trajectories for s in a] for a in experiment], timestamps=[[s.timestamps for s in a] for a in experiment], slices=[[s.slices for s in a] for a in experiment], videos=[[s.videos for s in a] for a in experiment], speeds=[[s.speeds for s in a] for a in experiment], labels=[[s.labels for s in a] for a in experiment], steps=[[s.steps for s in a] for a in experiment])
def update_trajectory_structure(t): return [[ load_data.session(trajectories=t.trajectories[i][j], time=t.timestamps[i][j], slices=t.slices[i][j], video=t.videos[i][j], speeds=t.speeds[i][j], labels=t.labels[i][j], steps=t.steps[i][j], slips=t.slips[i][j]) for j, s in enumerate(a) ] for i, a in enumerate(t.trajectories)]
def remap_experiment_structure(experiment): return [[ load_data.session(trajectories=s.trajectories, time=s.time, slices=s.slices, video=s.video, speeds=s.speeds, labels=s.labels, steps=s.steps, slips=s.slips) for s in a ] for a in experiment]
def build_raw_trajectories(datafolder): trajectories = load_trajectories(datafolder) timestamps = load_trajectory_timestamps(datafolder) slices = [clump_trajectories(t) for t in trajectories] videos = get_trajectory_videos(datafolder) speeds = get_speeds(trajectories, slices) trajectory_structure = zip(trajectories, slices, video) save_trajectory_labels(trajectory_structure) save_trajectory_slices(trajectory_structure) datafolders = [ os.path.join(datafolder, folder) for folder in os.listdir(datafolder) ] shuttling_analysis.analysis_pipeline(datafolders, False) labels = load_all_trajectory_labels(datafolder) steps = procsteps.load_stepactivities(datafolder) slips = load_slips(datafolder) return load_data.session(trajectories=trajectories, timestamps=timestamps, slices=slices, videos=videos, speeds=speeds, labels=labels, steps=steps, slips=slips)