Skip to content
Snippets Groups Projects
Commit 154ca507 authored by Stephane Chavin's avatar Stephane Chavin
Browse files

correct

parent da905b31
No related branches found
No related tags found
No related merge requests found
...@@ -37,8 +37,8 @@ def create_spectrogram(y, directory, filename, offset, duration, window_arg, hop ...@@ -37,8 +37,8 @@ def create_spectrogram(y, directory, filename, offset, duration, window_arg, hop
os.makedirs(os.path.join(directory, 'Spectrogram'), exist_ok=True) os.makedirs(os.path.join(directory, 'Spectrogram'), exist_ok=True)
plt.savefig(name + '.jpg') plt.savefig(name + '.jpg')
def process_recordings(args): def process_recordings(data, img_per_rec, args):
_, (i) = args _, (i) = data
duration = args.duration duration = args.duration
overlap = args.overlap overlap = args.overlap
...@@ -84,5 +84,8 @@ if __name__ == "__main__": ...@@ -84,5 +84,8 @@ if __name__ == "__main__":
elif args.input == 'folder': elif args.input == 'folder':
df = pd.DataFrame(glob.glob(os.path.join(path_to_data, '*'), recursive=True), columns=['Path']) df = pd.DataFrame(glob.glob(os.path.join(path_to_data, '*'), recursive=True), columns=['Path'])
p_map(process_recordings, enumerate(df.groupby('Path'), img_per_rec=img_per_rec), num_cpus=args.cpu, total=len(df.groupby('Path'))) img_per_rec = [img_per_rec]*len(df.groupby('Path'))
print(f'Saved to {args.directory}/Spectrogram') args = [args]*len(df.groupby('Path'))
p_map(process_recordings, enumerate(df.groupby('Path')), img_per_rec, args, num_cpus=args[0].cpu, total=len(df.groupby('Path')))
print(f'Saved to {args[0].directory}/Spectrogram')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment