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

Update get_spectrogram.py

parent abbab85f
No related branches found
No related tags found
No related merge requests found
......@@ -13,11 +13,15 @@ warnings.filterwarnings('ignore')
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO')
parser.add_argument('-f','--file', type=str,required=True,help = 'Name of the file that contain the recording to print')
parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True)
parser.add_argument('-d','--direction', type=str, help = 'Direction of the saved spectrogram',required=True)
parser.add_argument('-m','--mode', type=str,choose={'unique','multiple'} help = 'Direction of the saved spectrogram',required=True)
args = parser.parse_args()
path_to_data = args.path_to_data
direction = args.direction
folder = 'Spectrogram/'
DURATION = 5
OVERLAP = 2
NB_IMG_PER_REC = 1
count = 0
......@@ -36,13 +40,14 @@ def process(x):
filename = str(i[0])
if False :
if args.mode == 'multiple' :
if count ==0:
duration = DURATION
offset = 0
else :
duration = DURATION
offset = offset + 6
offset = offset + (DURATION - OVERLAP)
if args.mode == 'unique':
offset = 0
try:
......@@ -68,12 +73,12 @@ def process(x):
name = str(i[0].replace('/','_').split('.')[0]+'_'+str(count))
try :
plt.savefig(str(folder+name+'.jpg'))
plt.savefig(str(direction+folder+name+'.jpg'))
except FileNotFoundError:
os.mkdir(folder)
plt.savefig(str(folder+name+'.jpg'))
os.mkdir(str(direction+folder))
plt.savefig(str(direction+folder+name+'.jpg'))
#count+=1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment