cibrrig.videos ============== .. py:module:: cibrrig.videos Attributes ---------- .. autoapisummary:: cibrrig.videos._log cibrrig.videos.PROJECTION_KWARGS cibrrig.videos.TRAIL_KWARGS cibrrig.videos.HISTORY_KWARGS cibrrig.videos.AUX_KWARGS cibrrig.videos.CACHE_DIR Functions --------- .. autoapisummary:: cibrrig.videos.make_aux_raster_projection_with_stims cibrrig.videos.make_projection cibrrig.videos.make_rotating_projection cibrrig.videos._trim_axes cibrrig.videos._plot_xy_plane cibrrig.videos._plot_all_planes Module Contents --------------- .. py:data:: _log .. py:data:: PROJECTION_KWARGS .. py:data:: TRAIL_KWARGS .. py:data:: HISTORY_KWARGS .. py:data:: AUX_KWARGS .. py:function:: make_aux_raster_projection_with_stims(pop, intervals, aux, aux_t, fn_out, stim_color, aux_label='', frame_step=0.01, duration=2, cmap='bone', vmax=0.5, baseline=10, fps=30, dpi=300, dims=[0, 1], lead_in=1, winsize=1, trail_length=0.05, figsize=(3, 8), azim_speed=0.1, elev_speed=0.1, rotation_delay=1, rotate=True, style='dark_background', projection_kwargs=PROJECTION_KWARGS, trail_kwargs=TRAIL_KWARGS, history_kwargs=HISTORY_KWARGS, aux_kwargs=AUX_KWARGS) Make a video of the projection with a raster and an auxiliary trace. This function creates a video of the projection with a raster plot and an auxiliary trace. It allows for various customizations, including the duration, colormap, frame rate, and rotation settings. The video is saved to the specified output file. :param pop: Population object containing the projection data. :type pop: Population :param intervals: Array of intervals (n x 2) for the stimulus periods. :type intervals: np.ndarray :param aux: Auxiliary data to be plotted. :type aux: np.ndarray :param aux_t: Time vector for the auxiliary data. :type aux_t: np.ndarray :param fn_out: Output file path for the video. :type fn_out: str or Path :param stim_color: Color for the stimulus periods. :type stim_color: str :param aux_label: Label for the auxiliary trace. Defaults to "". :type aux_label: str, optional :param frame_step: Time step between frames in seconds. Defaults to 0.01. :type frame_step: float, optional :param duration: Duration of the video in seconds. Defaults to 2. :type duration: float, optional :param cmap: Colormap for the projection. Defaults to "bone". :type cmap: str, optional :param vmax: Maximum value for the colormap normalization. Defaults to 0.5. :type vmax: float, optional :param baseline: Baseline value for the projection. Defaults to 10. :type baseline: int, optional :param fps: Frames per second for the video. Defaults to 30. :type fps: int, optional :param dpi: Dots per inch for the video. Defaults to 300. :type dpi: int, optional :param dims: Dimensions of the data to be plotted. Defaults to [0, 1]. :type dims: list, optional :param lead_in: Lead-in time before the start of the intervals. Defaults to 1. :type lead_in: float, optional :param winsize: Window size for the projection. Defaults to 1. :type winsize: float, optional :param trail_length: Length of the trail in the projection. Defaults to 0.05. :type trail_length: float, optional :param figsize: Figure size for the video. Defaults to (3, 8). :type figsize: tuple, optional :param azim_speed: Speed of azimuthal rotation. Defaults to 0.1. :type azim_speed: float, optional :param elev_speed: Speed of elevation rotation. Defaults to 0.1. :type elev_speed: float, optional :param rotation_delay: Delay before starting the rotation. Defaults to 1. :type rotation_delay: float, optional :param rotate: Whether to rotate the 3D plot. Defaults to True. :type rotate: bool, optional :param style: Matplotlib style to use. Defaults to "dark_background". :type style: str, optional :param projection_kwargs: Additional keyword arguments for the projection. Defaults to PROJECTION_KWARGS. :type projection_kwargs: dict, optional :param trail_kwargs: Additional keyword arguments for the trail.Passed to plt.plot. Defaults to TRAIL_KWARGS. :type trail_kwargs: dict, optional :param history_kwargs: Additional keyword arguments for the history. Passed to LineCollection. Defaults to HISTORY_KWARGS. :type history_kwargs: dict, optional :param aux_kwargs: Additional keyword arguments for the auxiliary trace. Passed to plt.plot. Defaults to AUX_KWARGS. :type aux_kwargs: dict, optional :returns: None .. py:function:: make_projection(pop, t0, duration, fn_out, stim_color='C1', intervals=None, cvar=None, cvar_label='', cmap='magma', dims=[0, 1], frame_step=0.01, fps=30, dpi=300, trail_length=0.05, figsize=(4, 4), style='dark_background', projection_kwargs=PROJECTION_KWARGS, history_kwargs=HISTORY_KWARGS, trail_kwargs=TRAIL_KWARGS, baseline=20, mode='line', rotate=True, rotation_delay=1, elev_speed=0.2, azim_speed=0.2, vmin=None, vmax=None) Make an animation of just the projection with temporal evolution. :param pop: Population object containing the projection data. :type pop: Population :param t0: Start time of the projection. :type t0: float :param duration: Duration of the projection in seconds. :type duration: float :param fn_out: Output file path for the animation. :type fn_out: str or Path :param stim_color: Color for the stimulus periods. Defaults to 'C1'. :type stim_color: str, optional :param intervals: Array of intervals (n x 2) for the stimulus periods. Defaults to None. :type intervals: np.ndarray, optional :param cvar: Covariate data for coloring the history. Defaults to None. :type cvar: np.ndarray, optional :param cvar_label: Label for the covariate data. Defaults to "". :type cvar_label: str, optional :param cmap: Colormap for the projection. Defaults to "magma". :type cmap: str, optional :param dims: Dimensions of the data to be plotted. Defaults to [0, 1]. :type dims: list, optional :param frame_step: Time step between frames in seconds. Defaults to 0.01. :type frame_step: float, optional :param fps: Frames per second for the animation. Defaults to 30. :type fps: int, optional :param dpi: Dots per inch for the animation. Defaults to 300. :type dpi: int, optional :param trail_length: Length of the trail in the projection. Defaults to 0.05. :type trail_length: float, optional :param figsize: Figure size for the animation. Defaults to (4, 4). :type figsize: tuple, optional :param style: Matplotlib style to use. Defaults to "dark_background". :type style: str, optional :param projection_kwargs: Additional keyword arguments for the projection. Defaults to PROJECTION_KWARGS. :type projection_kwargs: dict, optional :param history_kwargs: Additional keyword arguments for the history. Passed to LineCollection. Defaults to HISTORY_KWARGS. :type history_kwargs: dict, optional :param trail_kwargs: Additional keyword arguments for the trail. Passed to plt.plot. Defaults to TRAIL_KWARGS. :type trail_kwargs: dict, optional :param baseline: Baseline value for the projection. Defaults to 20. :type baseline: int, optional :param mode: Mode for the projection. Defaults to "line". :type mode: str, optional :param rotate: Whether to rotate the 3D plot. Defaults to True. :type rotate: bool, optional :param rotation_delay: Delay before starting the rotation. Defaults to 1. :type rotation_delay: float, optional :param elev_speed: Speed of elevation rotation. Defaults to 0.2. :type elev_speed: float, optional :param azim_speed: Speed of azimuthal rotation. Defaults to 0.2. :type azim_speed: float, optional :param vmin: Minimum value for the colormap normalization. Defaults to None. :type vmin: float, optional :param vmax: Maximum value for the colormap normalization. Defaults to None. :type vmax: float, optional :returns: None .. py:function:: make_rotating_projection(pop, t0, duration, fn_out, figsize=(4, 4), dims=[0, 1, 2], cvar=None, rotation_delay=1, elev_speed=0.1, azim_speed=0.1, mode='scatter', style='dark_background', cvar_label='', cmap='magma', vmin=None, vmax=None, frame_step=0.01, fps=30, dpi=300, n_frames=100, projection_kwargs=PROJECTION_KWARGS) Rotate a 3D projection without temporal evolution. :param pop: Population object containing the projection data. :type pop: Population :param t0: Start time of the projection. :type t0: float :param duration: Duration of the projection in seconds. :type duration: float :param fn_out: Output file path for the animation. :type fn_out: str or Path :param figsize: Figure size for the animation. Defaults to (4, 4). :type figsize: tuple, optional :param dims: Dimensions of the data to be plotted. Defaults to [0, 1, 2]. :type dims: list, optional :param cvar: Covariate data for coloring the projection. Defaults to None. :type cvar: np.ndarray, optional :param rotation_delay: Delay before starting the rotation. Defaults to 1. :type rotation_delay: float, optional :param elev_speed: Speed of elevation rotation. Defaults to 0.1. :type elev_speed: float, optional :param azim_speed: Speed of azimuthal rotation. Defaults to 0.1. :type azim_speed: float, optional :param mode: Mode for the projection ('line' or 'scatter'). Defaults to "scatter". :type mode: str, optional :param style: Matplotlib style to use. Defaults to "dark_background". :type style: str, optional :param cvar_label: Label for the covariate data. Defaults to "". :type cvar_label: str, optional :param cmap: Colormap for the projection. Defaults to "magma". :type cmap: str, optional :param vmin: Minimum value for the colormap normalization. Defaults to None. :type vmin: float, optional :param vmax: Maximum value for the colormap normalization. Defaults to None. :type vmax: float, optional :param frame_step: Time step between frames in seconds. Defaults to 0.01. :type frame_step: float, optional :param fps: Frames per second for the animation. Defaults to 30. :type fps: int, optional :param dpi: Dots per inch for the animation. Defaults to 300. :type dpi: int, optional :param n_frames: Number of frames for the animation. Defaults to 100. :type n_frames: int, optional :param projection_kwargs: Additional keyword arguments for the projection. Defaults to PROJECTION_KWARGS. :type projection_kwargs: dict, optional :returns: None .. py:function:: _trim_axes(ax, pop, t0, tf, dims) Trim the limits of the projection plots N.B. Might be uneeded now that the plot module does this already :param ax: Axis to modify :type ax: matplotlib.axes :param pop: Population object :type pop: Population :param t0: start time of data that is plotted :type t0: float :param tf: end time of data that is plotted :type tf: float :param dims: Dimensions of the data that are plotted :type dims: list :returns: Modifiied axes :rtype: ax (matplotlib.axes) .. py:function:: _plot_xy_plane(ax, **kwargs) Plot a transparent XY plane on a 3D axes. This function plots a transparent XY plane on a 3D axes based on the current x and y limits of the axes. The plane is plotted with the specified keyword arguments. :param ax: The 3D axes on which to plot the XY plane. :type ax: Axes3D :param \*\*kwargs: Additional keyword arguments to pass to the `plot_surface` method. :returns: None .. py:function:: _plot_all_planes(ax, **kwargs) Plot transparent XY, YZ, and XZ planes on a 3D axes. This function plots transparent XY, YZ, and XZ planes on a 3D axes based on the current x, y, and z limits of the axes. The planes are plotted with the specified keyword arguments. :param ax: The 3D axes on which to plot the planes. :type ax: Axes3D :param \*\*kwargs: Additional keyword arguments to pass to the `plot_surface` method. :returns: None .. py:data:: CACHE_DIR :value: '/data/hps/assoc/private/medullary/data/alf_data_repo'