Skip to content

Commit

Permalink
0.93.11
Browse files Browse the repository at this point in the history
  • Loading branch information
FBurkhardt committed Jan 8, 2025
1 parent 229df48 commit af5c028
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

Version 0.93.11
--------------
* bugfix: silero segmenter assigned file duration values

Version 0.93.10
--------------
* added nan check for imported features
Expand Down
2 changes: 1 addition & 1 deletion nkululeko/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION="0.93.10"
VERSION="0.93.11"
SAMPLING_RATE = 16000
3 changes: 1 addition & 2 deletions nkululeko/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ def plot_tree(self, model, features):
# one up because of the runs
fig_dir = self.util.get_path("fig_dir") + "../"
exp_name = self.util.get_exp_name(only_data=True)
format = self.util.config_val("PLOT", "format", "png")
filename = f"{fig_dir}{exp_name}EXPL_tree-plot.{format}"
filename = f"{fig_dir}{exp_name}EXPL_tree-plot.{self.format}"
fig = ax.figure
fig.savefig(filename)
fig.clear()
Expand Down
12 changes: 6 additions & 6 deletions nkululeko/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def main():
expr.fill_train_and_tests()
util.debug(f"train shape : {expr.df_train.shape}, test shape:{expr.df_test.shape}")

def calc_dur(x):
starts = x[1]
ends = x[2]
return (ends - starts).total_seconds()

# segment
segmented_file = util.config_val("SEGMENT", "result", "segmented.csv")

Expand Down Expand Up @@ -104,16 +109,11 @@ def main():
df_seg = df_seg.drop(columns=[target])
df_seg = df_seg.rename(columns={"class_label": target})
# save file
df_seg["duration"] = df_seg.index.to_series().map(lambda x: calc_dur(x))
df_seg.to_csv(f"{expr.data_dir}/{segmented_file}")

def calc_dur(x):
starts = x[1]
ends = x[2]
return (ends - starts).total_seconds()

if "duration" not in df.columns:
df["duration"] = df.index.to_series().map(lambda x: calc_dur(x))
df_seg["duration"] = df_seg.index.to_series().map(lambda x: calc_dur(x))
num_before = df.shape[0]
num_after = df_seg.shape[0]
util.debug(
Expand Down

0 comments on commit af5c028

Please sign in to comment.