Skip to content

Commit 1d79c36

Browse files
committed
working on zanes tracking
1 parent e290598 commit 1d79c36

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

proj/environment/plotter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def _plot_current_variables(self):
176176
color=colors["v"],
177177
label="trajectory speed",
178178
lw=1,
179-
edgecolors="white",
179+
edgecolors=[0.8, 0.8, 0.8],
180180
s=100,
181181
)
182182

@@ -268,7 +268,7 @@ def visualize_world_live(self, curr_goals, elapsed=None):
268268
s=50,
269269
color=colors["trajectory"],
270270
lw=1,
271-
edgecolors="white",
271+
edgecolors=[0.8, 0.8, 0.8],
272272
)
273273

274274
# highlight current trajectory point
@@ -278,7 +278,7 @@ def visualize_world_live(self, curr_goals, elapsed=None):
278278
s=30,
279279
color="r",
280280
lw=1,
281-
edgecolors="white",
281+
edgecolors=[0.8, 0.8, 0.8],
282282
zorder=99,
283283
)
284284

proj/environment/trajectories.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,19 @@ def from_tracking(n_steps, params, planning_params, cache_fld, *args):
201201
trial = trials.sample().iloc[0]
202202

203203
# Get variables
204+
try:
205+
fps = trial.fps
206+
except:
207+
fps = 60
208+
204209
x = trial.body_xy[:, 0]
205210
y = trial.body_xy[:, 1]
206211

207212
angle = interpolate_nans(trial.body_orientation)
208213
angle = np.radians(90 - angle)
209214
angle = np.unwrap(angle)
210215

211-
speed = line_smoother(trial.body_speed) * trial.fps
216+
speed = line_smoother(trial.body_speed) * fps
212217
ang_speed = np.ones_like(speed) # it will be ignored
213218

214219
# get start frame
@@ -234,5 +239,5 @@ def from_tracking(n_steps, params, planning_params, cache_fld, *args):
234239
trajectory = np.vstack(vars.values()).T
235240

236241
return compute_trajectory_stats(
237-
trajectory, len(x[start:]) / trial.fps, planning_params
242+
trajectory, len(x[start:]) / fps, planning_params
238243
)

proj/model/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ class Config:
6363

6464
trajectory = dict( # parameters of the goals trajectory
6565
name="tracking",
66-
nsteps=1000,
66+
nsteps=10000,
6767
distance=150,
6868
max_speed=100,
6969
min_speed=80,
7070
min_dist=5, # if agent is within this distance from trajectory end the goal is considered achieved
71-
dist_th=60, # keep frames only after moved away from start location
71+
# dist_th=60, # keep frames only after moved away from start location
72+
dist_th=-1,
7273
resample=True, # if True when using tracking trajectory resamples it
7374
max_deg_interpol=8, # if using track fit a N degree polynomial to daa to smoothen
7475
randomize=True, # if true when using tracking it pulls a random trial

proj/paths.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from pathlib import Path
33

44
if sys.platform == "darwin":
5-
trials_cache = "/Users/federicoclaudi/Dropbox (UCL - SWC)/Rotation_vte/Locomotion/control/behav_data/m46_cache.h5"
5+
# trials_cache = "/Users/federicoclaudi/Dropbox (UCL - SWC)/Rotation_vte/Locomotion/control/behav_data/m46_cache.h5"
6+
trials_cache = "/Users/federicoclaudi/Dropbox (UCL - SWC)/Rotation_vte/Locomotion/control/behav_data/zanes.h5"
67

78
main_fld = Path(
89
"/Users/federicoclaudi/Dropbox (UCL - SWC)/Rotation_vte/Locomotion/control"
@@ -13,7 +14,8 @@
1314

1415
db_app = "/Users/federicoclaudi/Dropbox (UCL - SWC)/Apps/loco_upload"
1516
else:
16-
trials_cache = "D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\control\\behav_data\\m46_cache.h5"
17+
# trials_cache = "D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\control\\behav_data\\m46_cache.h5"
18+
trials_cache = "D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\control\\behav_data\\zanes.h5"
1719

1820
main_fld = Path(
1921
"D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\control"
@@ -26,7 +28,12 @@
2628

2729
# winstor paths
2830
winstor_main = Path("/nfs/winstor/branco/Federico/Locomotion/control/data")
31+
# winstor_trial_cache = (
32+
# "/nfs/winstor/branco/Federico/Locomotion/control/m46_cache.h5"
33+
# )
34+
2935
winstor_trial_cache = (
30-
"/nfs/winstor/branco/Federico/Locomotion/control/m46_cache.h5"
36+
"/nfs/winstor/branco/Federico/Locomotion/control/zanes.h5"
3137
)
38+
3239
winstor_db_app = ""

proj/plotting/results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _plot_xy(history, trajectory, plot_every, ax=None):
5858
history["x"],
5959
y=history["y"],
6060
color=colors["tracking"],
61-
lw=1,
61+
lw=2,
6262
zorder=100,
6363
outline_color=[0.2, 0.2, 0.2],
6464
)
@@ -105,7 +105,7 @@ def _plot_v(history, trajectory, plot_every, ax=None):
105105

106106
# plot history speed
107107
ax.plot(
108-
history["trajectory_idx"], v, color=colors["v"], lw=2, zorder=100,
108+
history["trajectory_idx"], v, color=colors["v"], lw=3, zorder=100,
109109
)
110110

111111

0 commit comments

Comments
 (0)