From b259f754edc167f14493c9f6935e6d3805c1b401 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 31 Jul 2024 11:49:47 -0500 Subject: [PATCH 1/9] feat: update facemap svd results ingestion to handle all ROIs and fullSVD --- element_facemap/facial_behavior_estimation.py | 215 ++++++++---------- setup.py | 3 +- 2 files changed, 103 insertions(+), 115 deletions(-) diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 1d3ad1a..3eff46f 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -301,30 +301,33 @@ def make(self, key): # update processing_output_dir FacemapTask.update1({**key, "facemap_output_dir": output_dir.as_posix()}) + output_dir = find_full_path(get_facemap_root_data_dir(), output_dir) + if task_mode == "trigger": from facemap.process import run as facemap_run params = (FacemapTask & key).fetch1("facemap_params") + valid_args = inspect.getfullargspec(facemap_run).args + params = {k: v for k, v in params.items() if k in valid_args} + video_files = (FacemapTask * VideoRecording.File & key).fetch("file_path") + # video files are sequentially acquired, not simultaneously video_files = [ [ find_full_path(get_facemap_root_data_dir(), video_file).as_posix() - for video_file in video_files ] + for video_file in video_files ] - output_dir = find_full_path(get_facemap_root_data_dir(), output_dir) facemap_run( - video_files, - sbin=params["sbin"], - proc=params, + filenames=video_files, savepath=output_dir.as_posix(), - motSVD=params["motSVD"], - movSVD=params["movSVD"], + **params, ) - _, creation_time = get_loader_result(key, FacemapTask) + results_proc_fp = next(output_dir.glob("*_proc.npy")) + creation_time = datetime.fromtimestamp(results_proc_fp.stat().st_ctime) key = {**key, "processing_time": creation_time} self.insert1(key) @@ -358,14 +361,14 @@ class Region(dj.Part): definition = """ -> master - roi_no : int # Region number + roi_no : int # Region number (roi_no=0 is FullSVD if exists) --- - roi_name='' : varchar(16) # user-friendly name of the roi - xrange : longblob # 1d np.array - x pixel indices - yrange : longblob # 1d np.array - y pixel indices - xrange_bin : longblob # 1d np.array - binned x pixel indices - yrange_bin : longblob # 1d np.array - binned y pixel indices - motion : longblob # 1d np.array - absolute motion energies (nframes) + roi_name='' : varchar(16) # user-friendly name of the roi + xrange=null : longblob # 1d np.array - x pixel indices + yrange=null : longblob # 1d np.array - y pixel indices + xrange_bin=null : longblob # 1d np.array - binned x pixel indices + yrange_bin=null : longblob # 1d np.array - binned y pixel indices + motion=null : longblob # 1d np.array - absolute motion energies (nframes) """ class MotionSVD(dj.Part): @@ -373,19 +376,19 @@ class MotionSVD(dj.Part): Attributes: master.Region (foreign key): Primary key from FacialSignal.Region. - pc_no (int): Principle component (PC) number. + pc_no (int): principal component (PC) number. singular_value (float, optional): singular value corresponding to the PC. motmask (longblob): PC (y, x). - projection (longblob): projections onto the principle component (nframes). + projection (longblob): projections onto the principal component (nframes). """ definition = """ -> master.Region - pc_no : int # principle component (PC) number + pc_no : int # principal component (PC) number --- singular_value=null : float # singular value corresponding to the PC motmask : longblob # PC (y, x) - projection : longblob # projections onto the principle component (nframes) + projection : longblob # projections onto the principal component (nframes) """ class MovieSVD(dj.Part): @@ -393,19 +396,19 @@ class MovieSVD(dj.Part): Attributes: master.Region (foreign key): Primary key of the FacialSignal.Region table. - pc_no (int): principle component (PC) number. + pc_no (int): principal component (PC) number. singular_value (float, optional): Singular value corresponding to the PC. movmask (longblob): PC (y, x) - projection (longblob): Projections onto the principle component (nframes). + projection (longblob): Projections onto the principal component (nframes). """ definition = """ -> master.Region - pc_no : int # principle component (PC) number + pc_no : int # principal component (PC) number --- singular_value=null : float # singular value corresponding to the PC movmask : longblob # PC (y, x) - projection : longblob # projections onto the principle component (nframes) + projection : longblob # projections onto the principal component (nframes) """ class Summary(dj.Part): @@ -414,121 +417,105 @@ class Summary(dj.Part): Attributes: master (foreign key): Primary key from FacialSignal. sbin (int): Spatial bin size. - avgframe (longblob): 2d np.array - average binned frame. - avgmotion (longblob): 2d nd.array - average binned motion frame. + avgframe (longblob): 2d np.array (y, x) - average binned frame + avgmotion (longblob): 2d nd.array (y, x) - average binned motion frame """ definition = """ -> master --- sbin : int # spatial bin size - avgframe : longblob # 2d np.array - average binned frame - avgmotion : longblob # 2d nd.array - average binned motion frame + avgframe : longblob # 2d np.array (y, x) - average binned frame + avgmotion : longblob # 2d nd.array (y, x) - average binned motion frame """ def make(self, key): """Populates the FacialSignal table by transferring the results from default Facemap outputs to the database.""" - dataset, _ = get_loader_result(key, FacemapTask) - # Only motion SVD region type is supported. - dataset["rois"] = [x for x in dataset["rois"] if x["rtype"] == "motion SVD"] + output_dir = (FacemapTask & key).fetch1("facemap_output_dir") + output_dir = find_full_path(get_facemap_root_data_dir(), output_dir) + results_proc_fp = next(output_dir.glob("*_proc.npy")) + dataset = np.load(results_proc_fp, allow_pickle=True).item() - self.insert1(key) - - self.Region.insert( - [ - dict( - key, - roi_no=i, - xrange=dataset["rois"][i]["xrange"], - yrange=dataset["rois"][i]["yrange"], - xrange_bin=( - dataset["rois"][i]["xrange_bin"] - if "xrange_bin" in dataset["rois"][i] - else None - ), - yrange_bin=( - dataset["rois"][i]["yrange_bin"] - if "yrange_bin" in dataset["rois"][i] - else None - ), - motion=dataset["motion"][i + 1], - ) - for i in range(len(dataset["rois"])) - if dataset["rois"][i]["rtype"] == "motion SVD" - ] - ) + region_entries, motion_svd_entries, movie_svd_entries = [], [], [] + motions = dataset["motion"].copy() + motion_svd_rois = [] + if dataset["fullSVD"]: + region_entries.append(dict( + key, + roi_no=0, + roi_name="FullSVD", + xrange=np.arange(dataset["Lx"][0]), + yrange=np.arange(dataset["Ly"][0]), + motion=motions.pop(), + )) + motion_svd_rois.append(0) + # Region + if dataset["rois"] is not None: + for i, roi in enumerate(dataset["rois"]): + roi_no = i + int(dataset["fullSVD"]) + roi_name = f"{roi['rtype']}_{roi['iROI']}" + if roi["rtype"] == "motion SVD": + motion_svd_rois.append(roi_no) + motion = motions.pop() + else: + motion = None + region_entries.append(dict( + key, + roi_no=roi_no, + roi_name=roi_name, + xrange=roi["xrange"], + yrange=roi["yrange"], + xrange_bin=roi.get("xrange_bin"), + yrange_bin=roi.get("yrange_bin"), + motion=motion, + )) # MotionSVD if any(np.any(x) for x in dataset.get("motSVD", [False])): - entry = [ - dict( - key, - roi_no=roi_no, - pc_no=i, - singular_value=( - dataset["motSv"][roi_no][i] if "motSv" in dataset else None - ), - motmask=dataset["motMask_reshape"][roi_no + 1][:, :, i], - projection=dataset["motSVD"][roi_no + 1][i], + for roi_idx, roi_no in enumerate(motion_svd_rois): + roi_idx += int(not dataset["fullSVD"]) # skip the first entry if fullSVD is False + motSVD = dataset["motSVD"][roi_idx] + motMask = dataset["motMask_reshape"][roi_idx] + motSv = dataset["motSv"][roi_idx] if "motSv" in dataset else np.full(motSVD.shape[-1], np.nan) + motion_svd_entries.extend( + [dict( + key, + roi_no=roi_no, + pc_no=idx, + singular_value=s, + motmask=m, + projection=p, + ) for idx, (s, m, p) in enumerate(zip(motSv, motMask, motSVD))] ) - for roi_no in range(len(dataset["rois"])) - for i in range(dataset["motSVD"][roi_no + 1].shape[1]) - ] - self.MotionSVD.insert(entry) - # MovieSVD if any(np.any(x) for x in dataset.get("movSVD", [False])): - entry = [ - dict( - key, - roi_no=roi_no, - pc_no=i, - singular_value=( - dataset["movSv"][roi_no][i] if "movSv" in dataset else None - ), - movmask=dataset["movMask_reshape"][roi_no + 1][:, :, i], - projection=dataset["movSVD"][roi_no + 1][i], + for roi_idx, roi_no in enumerate(motion_svd_rois): + roi_idx += int(not dataset["fullSVD"]) # skip the first entry if fullSVD is False + movSVD = dataset["movSVD"][roi_idx] + movMask = dataset["movMask_reshape"][roi_idx] + movSv = dataset["movSv"][roi_idx] if "movSv" in dataset else np.full(movSVD.shape[-1], np.nan) + motion_svd_entries.extend( + [dict( + key, + roi_no=roi_no, + pc_no=idx, + singular_value=s, + motmask=m, + projection=p, + ) for idx, (s, m, p) in enumerate(zip(movSv, movMask, movSVD))] ) - for roi_no in range(len(dataset["rois"])) - for i in range(dataset["movSVD"][roi_no + 1].shape[1]) - ] - self.MovieSVD.insert(entry) - # Summary + self.insert1(key) + self.Region.insert(region_entries) + self.MotionSVD.insert(motion_svd_entries) + self.MovieSVD.insert(movie_svd_entries) self.Summary.insert1( dict( key, sbin=dataset["sbin"], - avgframe=dataset["avgframe"][0], - avgmotion=dataset["avgmotion"][0], + avgframe=dataset["avgframe_reshape"], + avgmotion=dataset["avgmotion_reshape"], ) ) - - -# ---------------- HELPER FUNCTIONS ---------------- - - -def get_loader_result( - key: dict, table: dj.user_tables.TableMeta -) -> Tuple[np.array, datetime]: - """Retrieve the facemap analysis results. - - Args: - key (dict): A primary key for an entry in the provided table. - table (dj.Table): DataJoint user table from which loaded results are retrieved (i.e. FacemapTask). - - Returns: - loaded_dataset (np.array): The results of the facemap analysis. - creation_time (datetime): Date and time that the results files were created. - """ - output_dir = (table & key).fetch1("facemap_output_dir") - - output_path = find_full_path(get_facemap_root_data_dir(), output_dir) - output_file = glob(output_path.as_posix() + "/*_proc.npy")[0] - - loaded_dataset = np.load(output_file, allow_pickle=True).item() - creation_time = datetime.fromtimestamp(Path(output_file).stat().st_ctime) - - return loaded_dataset, creation_time diff --git a/setup.py b/setup.py index fbe150e..9d1213f 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,10 @@ install_requires=[ "datajoint>=0.13.0", "ipykernel>=6.0.1", + "scikit-learn==1.4.*", "opencv-python", "element-interface @ git+https://github.com/datajoint/element-interface.git", - "facemap @ git+https://github.com/kushalbakshi/facemap.git", + "facemap[gui] @ git+https://github.com/datajoint/facemap.git", ], extras_require={ "elements": [ From 544a8a9dd1fc251626a28fa82d4ed47a98a6e6fe Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 6 Aug 2024 10:19:02 -0500 Subject: [PATCH 2/9] feat(facemapSVD): use `memoized_result` --- element_facemap/facial_behavior_estimation.py | 19 +++++++++++-------- setup.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 3eff46f..7463131 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -8,7 +8,7 @@ import cv2 import datajoint as dj import numpy as np -from element_interface.utils import find_full_path, find_root_directory +from element_interface.utils import find_full_path, find_root_directory, memoized_result schema = dj.schema() @@ -320,17 +320,20 @@ def make(self, key): for video_file in video_files ] - facemap_run( - filenames=video_files, - savepath=output_dir.as_posix(), - **params, - ) + @memoized_result(uniqueness_dict=params, output_directory=output_dir) + def run_facemap_process(): + facemap_run( + filenames=video_files, + savepath=output_dir.as_posix(), + **params, + ) + + run_facemap_process() results_proc_fp = next(output_dir.glob("*_proc.npy")) creation_time = datetime.fromtimestamp(results_proc_fp.stat().st_ctime) - key = {**key, "processing_time": creation_time} - self.insert1(key) + self.insert1({**key, "processing_time": creation_time}) @schema diff --git a/setup.py b/setup.py index 9d1213f..4e2e77b 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "ipykernel>=6.0.1", "scikit-learn==1.4.*", "opencv-python", - "element-interface @ git+https://github.com/datajoint/element-interface.git", + "element-interface @ git+https://github.com/datajoint/element-interface.git@staging", "facemap[gui] @ git+https://github.com/datajoint/facemap.git", ], extras_require={ From 7d3609c18b89e10d7ee8330fb41b14f2faea37dc Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 6 Aug 2024 10:19:24 -0500 Subject: [PATCH 3/9] format: black --- element_facemap/facial_behavior_estimation.py | 86 ++++++++++++------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 7463131..5243eb3 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -314,9 +314,7 @@ def make(self, key): video_files = (FacemapTask * VideoRecording.File & key).fetch("file_path") # video files are sequentially acquired, not simultaneously video_files = [ - [ - find_full_path(get_facemap_root_data_dir(), video_file).as_posix() - ] + [find_full_path(get_facemap_root_data_dir(), video_file).as_posix()] for video_file in video_files ] @@ -446,14 +444,16 @@ def make(self, key): motion_svd_rois = [] if dataset["fullSVD"]: - region_entries.append(dict( - key, - roi_no=0, - roi_name="FullSVD", - xrange=np.arange(dataset["Lx"][0]), - yrange=np.arange(dataset["Ly"][0]), - motion=motions.pop(), - )) + region_entries.append( + dict( + key, + roi_no=0, + roi_name="FullSVD", + xrange=np.arange(dataset["Lx"][0]), + yrange=np.arange(dataset["Ly"][0]), + motion=motions.pop(), + ) + ) motion_svd_rois.append(0) # Region if dataset["rois"] is not None: @@ -465,7 +465,8 @@ def make(self, key): motion = motions.pop() else: motion = None - region_entries.append(dict( + region_entries.append( + dict( key, roi_no=roi_no, roi_name=roi_name, @@ -474,40 +475,59 @@ def make(self, key): xrange_bin=roi.get("xrange_bin"), yrange_bin=roi.get("yrange_bin"), motion=motion, - )) + ) + ) # MotionSVD if any(np.any(x) for x in dataset.get("motSVD", [False])): for roi_idx, roi_no in enumerate(motion_svd_rois): - roi_idx += int(not dataset["fullSVD"]) # skip the first entry if fullSVD is False + roi_idx += int( + not dataset["fullSVD"] + ) # skip the first entry if fullSVD is False motSVD = dataset["motSVD"][roi_idx] motMask = dataset["motMask_reshape"][roi_idx] - motSv = dataset["motSv"][roi_idx] if "motSv" in dataset else np.full(motSVD.shape[-1], np.nan) + motSv = ( + dataset["motSv"][roi_idx] + if "motSv" in dataset + else np.full(motSVD.shape[-1], np.nan) + ) motion_svd_entries.extend( - [dict( - key, - roi_no=roi_no, - pc_no=idx, - singular_value=s, - motmask=m, - projection=p, - ) for idx, (s, m, p) in enumerate(zip(motSv, motMask, motSVD))] + [ + dict( + key, + roi_no=roi_no, + pc_no=idx, + singular_value=s, + motmask=m, + projection=p, + ) + for idx, (s, m, p) in enumerate(zip(motSv, motMask, motSVD)) + ] ) # MovieSVD if any(np.any(x) for x in dataset.get("movSVD", [False])): for roi_idx, roi_no in enumerate(motion_svd_rois): - roi_idx += int(not dataset["fullSVD"]) # skip the first entry if fullSVD is False + roi_idx += int( + not dataset["fullSVD"] + ) # skip the first entry if fullSVD is False movSVD = dataset["movSVD"][roi_idx] movMask = dataset["movMask_reshape"][roi_idx] - movSv = dataset["movSv"][roi_idx] if "movSv" in dataset else np.full(movSVD.shape[-1], np.nan) + movSv = ( + dataset["movSv"][roi_idx] + if "movSv" in dataset + else np.full(movSVD.shape[-1], np.nan) + ) motion_svd_entries.extend( - [dict( - key, - roi_no=roi_no, - pc_no=idx, - singular_value=s, - motmask=m, - projection=p, - ) for idx, (s, m, p) in enumerate(zip(movSv, movMask, movSVD))] + [ + dict( + key, + roi_no=roi_no, + pc_no=idx, + singular_value=s, + motmask=m, + projection=p, + ) + for idx, (s, m, p) in enumerate(zip(movSv, movMask, movSVD)) + ] ) self.insert1(key) From b0008c1aa9e30ee182af9ef15f9c2fb8535c8121 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 13 Aug 2024 08:43:50 -0500 Subject: [PATCH 4/9] fix: import cv2 inside `make` --- element_facemap/facial_behavior_estimation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 5243eb3..4a86a56 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -1,11 +1,9 @@ import importlib import inspect from datetime import datetime -from glob import glob from pathlib import Path from typing import List, Tuple -import cv2 import datajoint as dj import numpy as np from element_interface.utils import find_full_path, find_root_directory, memoized_result @@ -185,6 +183,7 @@ def key_source(self): def make(self, key): """Populates the RecordingInfo table.""" + import cv2 file_paths = (VideoRecording.File & key).fetch("file_path") From 3bc387daae9a6846bbb0bbbd53a7fa3cbb98b2e2 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 20 Aug 2024 16:40:04 -0500 Subject: [PATCH 5/9] feat(facemapsvd): rename attributes --- CHANGELOG.md | 4 +++ element_facemap/facial_behavior_estimation.py | 36 +++++++++---------- element_facemap/version.py | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f16810..4ec7f4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [0.3.0] - 2024-08-20 + ++ Update - Attribute names in `FacialSignal` table + ## [0.2.2] - 2024-05-12 + Fix - Fix docs by updating `mkdocs` diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 4a86a56..9c7f4e9 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -376,19 +376,19 @@ class MotionSVD(dj.Part): Attributes: master.Region (foreign key): Primary key from FacialSignal.Region. - pc_no (int): principal component (PC) number. - singular_value (float, optional): singular value corresponding to the PC. - motmask (longblob): PC (y, x). - projection (longblob): projections onto the principal component (nframes). + component_id (int): component number. + singular_value (float, optional): singular value corresponding to the component. + motmask (longblob): (y, x). + projection (longblob): projections onto the component (nframes). """ definition = """ -> master.Region - pc_no : int # principal component (PC) number + component_id : int # component number --- - singular_value=null : float # singular value corresponding to the PC - motmask : longblob # PC (y, x) - projection : longblob # projections onto the principal component (nframes) + singular_value=null : float # singular value corresponding to the component + motmask : longblob # (y, x) + projection : longblob # projections onto the component (nframes) """ class MovieSVD(dj.Part): @@ -396,19 +396,19 @@ class MovieSVD(dj.Part): Attributes: master.Region (foreign key): Primary key of the FacialSignal.Region table. - pc_no (int): principal component (PC) number. - singular_value (float, optional): Singular value corresponding to the PC. - movmask (longblob): PC (y, x) - projection (longblob): Projections onto the principal component (nframes). + component_id (int): component number. + singular_value (float, optional): Singular value corresponding to the component. + movmask (longblob): (y, x) + projection (longblob): Projections onto the component (nframes). """ definition = """ -> master.Region - pc_no : int # principal component (PC) number + component_id : int # component number --- - singular_value=null : float # singular value corresponding to the PC - movmask : longblob # PC (y, x) - projection : longblob # projections onto the principal component (nframes) + singular_value=null : float # singular value corresponding to the component + movmask : longblob # (y, x) + projection : longblob # projections onto the component (nframes) """ class Summary(dj.Part): @@ -494,7 +494,7 @@ def make(self, key): dict( key, roi_no=roi_no, - pc_no=idx, + component_id=idx, singular_value=s, motmask=m, projection=p, @@ -520,7 +520,7 @@ def make(self, key): dict( key, roi_no=roi_no, - pc_no=idx, + component_id=idx, singular_value=s, motmask=m, projection=p, diff --git a/element_facemap/version.py b/element_facemap/version.py index 4c9ff19..cb2754e 100644 --- a/element_facemap/version.py +++ b/element_facemap/version.py @@ -1,3 +1,3 @@ """Package metadata.""" -__version__ = "0.2.2" +__version__ = "0.3.0" From bc1112966252c73b208eeaad2704d527ea986d68 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 20 Aug 2024 16:42:11 -0500 Subject: [PATCH 6/9] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ec7f4c..3e93bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and ## [0.3.0] - 2024-08-20 + Update - Attribute names in `FacialSignal` table ++ Update - FacemapSVD handles all ROIs and FullSVD analysis ## [0.2.2] - 2024-05-12 From 706cd72c61f8ef60954c1b9983a94299c54096e1 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 20 Aug 2024 16:44:58 -0500 Subject: [PATCH 7/9] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4e2e77b..9d1213f 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "ipykernel>=6.0.1", "scikit-learn==1.4.*", "opencv-python", - "element-interface @ git+https://github.com/datajoint/element-interface.git@staging", + "element-interface @ git+https://github.com/datajoint/element-interface.git", "facemap[gui] @ git+https://github.com/datajoint/facemap.git", ], extras_require={ From ec330e7bb9e7b347760e7c2a40064ed0545faf10 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 20 Aug 2024 17:00:55 -0500 Subject: [PATCH 8/9] Update setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9d1213f..3f06a54 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ "scikit-learn==1.4.*", "opencv-python", "element-interface @ git+https://github.com/datajoint/element-interface.git", - "facemap[gui] @ git+https://github.com/datajoint/facemap.git", + "facemap @ git+https://github.com/datajoint/facemap.git", ], extras_require={ "elements": [ @@ -41,5 +41,6 @@ "element-session @ git+https://github.com/datajoint/element-session.git", ], "tests": ["pytest", "pytest-cov", "shutils"], + "facemap_gui": ["facemap[gui] @ git+https://github.com/datajoint/facemap.git"], }, ) From 1a9d060798967d350d4838e73f99a6944c7b2570 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Wed, 21 Aug 2024 10:00:05 -0500 Subject: [PATCH 9/9] chore: minor function rename --- element_facemap/facial_behavior_estimation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/element_facemap/facial_behavior_estimation.py b/element_facemap/facial_behavior_estimation.py index 9c7f4e9..51e32b8 100644 --- a/element_facemap/facial_behavior_estimation.py +++ b/element_facemap/facial_behavior_estimation.py @@ -318,14 +318,14 @@ def make(self, key): ] @memoized_result(uniqueness_dict=params, output_directory=output_dir) - def run_facemap_process(): + def _run_facemap_process(): facemap_run( filenames=video_files, savepath=output_dir.as_posix(), **params, ) - run_facemap_process() + _run_facemap_process() results_proc_fp = next(output_dir.glob("*_proc.npy")) creation_time = datetime.fromtimestamp(results_proc_fp.stat().st_ctime)