Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Broz <Chris.Broz@ucsf.edu>
  • Loading branch information
samuelbray32 and CBroz1 authored Dec 20, 2024
1 parent 36ad016 commit fe3c6d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/spyglass/behavior/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def create_group(
group_name: str,
merge_ids: list[str],
bodyparts: list[str] = None,
):
"""create a group of pose information
) -> None:
"""Create a group of pose information
Parameters
----------
group_name : str
name of the group
Name of the group
keys : list[dict]
list of keys from PoseOutput to include in the group
bodyparts : list[str], optional
Expand Down Expand Up @@ -114,11 +114,10 @@ def fetch_video_paths(self, key: dict = None):
"""
if key is None:
key = {}
video_paths = [
return [
Path((PositionOutput & merge_key).fetch_video_name())
for merge_key in (self.Pose & key).proj(merge_id="pose_merge_id")
]
return video_paths


def format_dataset_for_moseq(
Expand Down Expand Up @@ -184,7 +183,7 @@ def results_to_df(results):
if "latent_state" in results[key].keys():
latent_dim = results[key]["latent_state"].shape[1]
column_names.append(
[f"latent_state {i}" for i in range(latent_dim)]
[f"latent_state_{i}" for i in range(latent_dim)]
)
data.append(results[key]["latent_state"])

Expand Down
11 changes: 3 additions & 8 deletions src/spyglass/behavior/moseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MoseqModelParams(SpyglassMixin, dj.Manual):
"""

def make_training_extension_params(
self, model_key, num_epochs, new_name=None, skip_duplicates=False
self, model_key:dict, num_epochs:int, new_name:str=None, skip_duplicates:bool=False
):
"""Method to create a new set of model parameters for extending training
Expand All @@ -37,6 +37,7 @@ def make_training_extension_params(
name for the new model parameters, by default None
skip_duplicates : bool, optional
whether to skip duplicates, by default False
Returns
-------
dict
Expand Down Expand Up @@ -224,11 +225,6 @@ def analyze_pca(self, key: dict = None):
----------
key : dict
key to a single MoseqModel table entry
Raises
------
NotImplementedError
This method is not implemented yet.
"""
if key is None:
key = {}
Expand All @@ -254,11 +250,10 @@ def fetch_model(self, key: dict = None):
"""
if key is None:
key = {}
model = kpms.load_checkpoint(
return kpms.load_checkpoint(
(self & key).fetch1("project_dir"),
(self & key).fetch1("model_name"),
)[0]
return model


@schema
Expand Down

0 comments on commit fe3c6d4

Please sign in to comment.