neuralib.tracking.facemap.core.FaceMapResult
- final class neuralib.tracking.facemap.core.FaceMapResult[source]
Bases:
objectfacemap result container
Dimension parameters:
F = number of video frames
K = number of keypoints
- __init__(svd, meta, data, track_type, with_keypoints)[source]
- Parameters:
svd (SVDVariables | None) – SVD processing outputs
meta (KeyPointsMeta | None) – Optional for Keypoints processing (result)
data (Group | None) – Optional for Keypoints processing (config)
track_type (Literal['keypoints', 'pupil']) – {‘keypoints’, ‘pupil’}
with_keypoints (bool) – if has keypoint tracking result
- svd: Final[SVDVariables | None]
- meta: Final[KeyPointsMeta | None]
- data: Final[Group | None]
- track_type: Final[Literal['keypoints', 'pupil']]
- with_keypoints: Final[bool]
- classmethod load(directory, track_type, *, file_pattern='')[source]
Load the facecam result from its output directory
- Parameters:
directory (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – directory contains the possible facemap output files (*.npy, *.pkl, and *.h5)
track_type (Literal['keypoints', 'pupil']) – {‘keypoints’, ‘pupil’}
file_pattern (str) – string prefix pattern to glob the facemap output file
- Returns:
- Return type:
Self
- classmethod launch_facemap_gui(directory, with_keypoints, *, file_pattern='', env_name='neuralib')[source]
DEPRECATED. GUI view via cli.
Note that calling this method will overwrite `filenames` field in *proc.npy
- Parameters:
directory (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – directory contains the possible facemap output files (*.npy, *.pkl, and *.h5), and also the raw video file
with_keypoints (bool) – if has keypoint tracking result
file_pattern (str) – string prefix pattern to glob the facemap output file and raw avi file
env_name (str) – conda env name that installed the facemap package
- Return type:
None
- get_pupil_center_of_mass()[source]
center of mass of pupil tracking. Array[float, [F, 2]]
- Return type:
ndarray
- get_pupil_location_movement()[source]
Calculate the Euclidean distance from the origin for each point in a 2D array. Array[float, F]
- Return type:
ndarray
- property keypoints: list[str]
list of keypoint name
- get(keypoint: str) KeyPointTrack[source]
- get(keypoint: list[str]) list[KeyPointTrack]
get a single or multiple keypoint(s)
- frame_time
- as_array(keypoint=None, with_outlier_filter=True, to_zscore=True, **kwargs)[source]
get keypoint(s) result as an 2D array with shape (K, F, 2). 3rd dim indicates the xy
- Parameters:
keypoint (list[str] | str | None) – keypoint
with_outlier_filter (bool)
to_zscore (bool)
kwargs – pass through
with_outlier_filter()
- Returns:
keypoint in XY. Array[float, [K, F, 2]]
- Return type:
ndarray