When trying to get my trajectory plots in Jupyter Notebook, the following error occurs and I can not get my trajectories plotted. is there anything I can do to alleviate this issue?
Could you let us know what kpms version you are using? Also, if possible, could you send the results.h5 file, config, and ideally the input data? (calebsw@gmail.com)
When trying to get my trajectory plots in Jupyter Notebook, the following error occurs and I can not get my trajectories plotted. is there anything I can do to alleviate this issue?
results = kpms.load_results(project_dir, model_name) kpms.generate_trajectory_plots(coordinates, results, project_dir, model_name, **config())
ypeError Traceback (most recent call last) Cell In[14], line 2 1 results = kpms.load_results(project_dir, model_name) ----> 2 kpms.generate_trajectory_plots(coordinates, results, project_dir, model_name, **config())
File ~/miniconda3/envs/keypoint_moseq/lib/python3.9/site-packages/keypoint_moseq/viz.py:1767, in generate_trajectory_plots(coordinates, results, project_dir, model_name, output_dir, pre, post, min_frequency, min_duration, skeleton, bodyparts, use_bodyparts, keypoint_colormap, plot_options, get_limits_pctl, padding, lims, save_individually, save_gifs, save_mp4s, fps, projection_planes, interactive, density_sample, sampling_options, kwargs) 1763 desc = "Generating trajectory plots" 1764 for title, X in tqdm.tqdm( 1765 zip(titles, Xs_2D), desc=desc, total=len(titles), ncols=72 1766 ): -> 1767 fig, ax, rasters = plot_trajectories( 1768 [title], 1769 X[None], 1770 lims, 1771 edges=edges, 1772 return_rasters=(save_gifs or save_mp4s), 1773 plot_options, 1774 ) 1776 plt.savefig(os.path.join(output_dir, f"{title}{suffix}.pdf")) 1777 plt.close(fig=fig)
File ~/miniconda3/envs/keypoint_moseq/lib/python3.9/site-packages/keypoint_moseq/viz.py:1473, in plot_trajectories(titles, Xs, lims, edges, n_cols, invert, keypoint_colormap, keypoint_colors, node_size, line_width, alpha, num_timesteps, plot_width, overlap, return_rasters) 1469 n_cols = min(n_cols, len(Xs)) 1470 n_rows = np.ceil(len(Xs) / n_cols) 1471 offsets = np.stack( 1472 np.meshgrid( -> 1473 np.arange(n_cols) np.diff(lims[:, 0]) (1 - overlap[0]), 1474 np.arange(n_rows) np.diff(lims[:, 1]) (overlap[1] - 1), 1475 ), 1476 axis=-1, 1477 ).reshape(-1, 2)[: len(Xs)] 1479 Xs = interpolate_along_axis( 1480 np.linspace(0, Xs[0].shape[0], num_timesteps), 1481 np.arange(Xs[0].shape[0]), 1482 np.array(Xs), 1483 axis=1, 1484 ) 1486 Xs = Xs + offsets[:, None, None]
TypeError: 'NoneType' object is not subscriptable