Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LoannPeurey committed Feb 14, 2025
1 parent d79381b commit 39d3ca7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ChildProject/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def sets_metadata(args):
continue

if len(args.source) > 1:
logger.info(f"\033[1m\033[35m### {project.recordings['experiment'].iloc[0]} ({source}) ###\033[0m")
logger.info(f"\033[1m\033[35m### {project.recordings['experiment'].iloc[0] if project.recordings.shape[0] else source} ({source}) ###\033[0m")

sets = am.get_sets_metadata()
if 'method' not in sets:
Expand Down Expand Up @@ -577,7 +577,7 @@ def overview(args):
continue

if len(args.source) > 1:
logger.info(f"\033[1m\033[35m### {project.recordings['experiment'].iloc[0]} ({source}) ###\033[0m")
logger.info(f"\033[1m\033[35m### {project.recordings['experiment'].iloc[0] if project.recordings.shape[0] else source} ({source}) ###\033[0m")

available = project.recordings['recording_filename'].apply(lambda recording_filename: 1
if project.get_recording_path(recording_filename).exists() else 0).sum()
Expand Down
7 changes: 4 additions & 3 deletions ChildProject/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,9 @@ def read(self, verbose=False, accumulate=True):

self.children = self.ct.df
self.recordings = self.rt.df

exp = self.children.iloc[0]['experiment']

# not sure what to use if no row in children, let's just put the folder name as a replacement?
exp = self.children.iloc[0]['experiment'] if self.children.shape[0] else self.path.name
exp_values = set(self.children['experiment'].unique()).union(set(self.recordings['experiment'].unique()))
if len(exp_values) > 1:
raise ValueError(f"Column <experiment> must be unique across the dataset, in both children.csv and recordings.csv , {len(exp_values)} different values were found: {exp_values}")
Expand All @@ -444,7 +445,7 @@ def dict_summary(self):
'devices': {
device: {
'count': self.recordings[self.recordings['recording_device_type'] == device].shape[0],
'duration': self.recordings[self.recordings['recording_device_type'] == device]['duration'].sum(),
'duration': self.recordings[self.recordings['recording_device_type'] == device]['duration'].sum() if 'duration' in self.recordings.columns else None,
} for device in self.recordings['recording_device_type'].unique()}
},
'children': {
Expand Down

0 comments on commit 39d3ca7

Please sign in to comment.