Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen Zegers committed Nov 28, 2017
1 parent 8a0b9a6 commit c446f16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions nabu/postprocessing/postprocessors/postprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __call__(self):
postproc_data = self.postproc(rec_src_filenames)

#write the data to the store dir
self.write_data(postproc_data, utt_name)
self.write_data(postproc_data, utt_name, rec_src_filenames)

@abstractmethod
def postproc(self, singals):
Expand All @@ -85,12 +85,13 @@ def postproc(self, singals):
the post processing data'''


def write_data(self, postproc_data, utt_name):
def write_data(self, postproc_data, utt_name,rec_src_filenames):
'''write the postprocessed data of the reconstructions
Args:
postproc_data: a list of post proccesed data (1 signal per speaker)
utt_name: the name of the utterance
rec_src_filenames: the filename of the reconstructed audio signals
'''

filename = os.path.join(self.store_dir,utt_name)
Expand All @@ -105,6 +106,6 @@ def write_data(self, postproc_data, utt_name):
fid.write(data_str)


write_str= '%s %s \n' %(utt_name,filename)
write_str= '%s %s %s \n' %(utt_name,rec_src_filenames[0],filename)
self.store_scp_file.write(write_str)

12 changes: 6 additions & 6 deletions nabu/processing/processors/matrix2vector_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def __call__(self, dataline):

split_dataline = dataline.split(' ')
audiofile = split_dataline[0]
matrixfile = split_dataline[1]
matrixfile = split_dataline[-1]

matrix = open(matrixfile).read()[:-1].split(',')
matrix = open(matrixfile).read().strip().split(',')
utt_info['nrS']=self.nrS
vector=np.zeros(self.dim)
for ind,matrix_row in enumerate(matrix):
Expand Down Expand Up @@ -107,10 +107,10 @@ def pre_loop(self, dataconf):
#loop over the lines in the datafile
for line in open_fn(datafile):
#split the name and the data line
split_dataline = line.split(' ')
matrixfile = split_dataline[2][:-1]
matrix = open(matrixfile).read()[:-1].split(',')
split_dataline = line.strip().split(' ')
matrixfile = split_dataline[-1]

matrix = open(matrixfile).read().strip().split(',')
vector=np.zeros(self.dim)
for ind,matrix_row in enumerate(matrix):
vector[ind*self.nrCol:(ind+1)*self.nrCol]=map(float, matrix_row.split(' '))
Expand Down

0 comments on commit c446f16

Please sign in to comment.