interpolate_point_path

behavenet.plotting.cond_ae_utils.interpolate_point_path(interp_type, model, ims_0, labels_0, points, n_frames=10, ch=0, crop_kwargs=None, apply_inverse_transform=True)[source]

Return reconstructed images created by interpolating through multiple points.

This function is a simplified version of interpolate_1d(); this function computes a traversal for a single dimension instead of all dimensions; also, this function does not support conditional encoders, nor does it attempt to compute the interpolated, scaled values of the labels as interpolate_1d() does. This function should supercede interpolate_1d() in a future refactor. Also note that this function is utilized by the code to make traversal movies, whereas interpolate_1d() is utilized by the code to make traversal plots.

Parameters:
  • interp_type (str) – ‘latents’ | ‘labels’

  • model (behavenet.models object) – autoencoder model

  • ims_0 (np.ndarray) – base images for interpolating labels, of shape (1, n_channels, y_pix, x_pix)

  • labels_0 (np.ndarray) – base labels of shape (1, n_labels); these values will be used if interp_type=’latents’, and they will be ignored if inter_type=’labels’ (since points will be used)

  • points (list) – one entry for each point in path; each entry is an np.ndarray of shape (n_latents,)

  • n_frames (int or array-like) – number of interpolation points between each point; can be an integer that is used for all paths, or an array/list of length one less than number of points

  • ch (int, optional) – specify which channel of input images to return; if not an int, all channels are concatenated in the horizontal dimension

  • crop_kwargs (dict, optional) – if crop_type is not None, provides information about the crop (for a fixed crop window) keys : ‘y_0’, ‘x_0’, ‘y_ext’, ‘x_ext’; window is (y_0 - y_ext, y_0 + y_ext) in vertical direction and (x_0 - x_ext, x_0 + x_ext) in horizontal direction

  • apply_inverse_transform (bool) – if inputs are latents (and model class is ‘cond-ae-msp’ or ‘ps-vae’), apply inverse transform to put in original latent space

Returns:

  • ims_list (list of np.ndarray) interpolated images

  • inputs_list (list of np.ndarray) interpolated values

Return type:

tuple