Commit f4a90d0a authored by Rama Vasudevan's avatar Rama Vasudevan
Browse files

trKPFM Translator Update

Some error catching when final pixel is absent. Will still translate successfully.
parent 780e6eb6
......@@ -203,7 +203,9 @@ class TRKPFMTranslator(Translator):
spectrogram_matrix = np.array(results_p[:])
b_axis = spectrogram_matrix.shape[2]
c_axis = spectrogram_matrix.shape[1]
dall = np.transpose(spectrogram_matrix, (0, 2, 1)).reshape(num_pixels * c_axis, b_axis)
#dall = np.transpose(spectrogram_matrix, (0, 2, 1)).reshape(num_pixels * c_axis, b_axis)
dall = np.transpose(spectrogram_matrix, (0, 2, 1)).reshape(-1, b_axis)
_, ia, ic = np.unique(dall, axis=0, return_index=True, return_inverse=True)
reprowind = np.setdiff1d(ic, ia)
......@@ -214,10 +216,18 @@ class TRKPFMTranslator(Translator):
h5_main = self.raw_datasets[ifile]
if real_cond[ifile]:
h5_main[:, :] = dall.reshape(h5_main.shape) + 1j * 0
print('Dall Size is: ', dall.shape)
#Do some error catching. In case the last pixel is absent, then just ignore it.
try:
h5_main[:, :] = dall.reshape(h5_main.shape) + 1j * 0
except ValueError:
h5_main[:-1, :] = dall.reshape(h5_main.shape[0]-1, h5_main.shape[1]) + 1j * 0
else:
h5_main[:, :] += 0 + 1j * dall.reshape(h5_main.shape)
#Error catching. In case the last pixel is absent, then just ignore it.
try:
h5_main[:, :] += 0 + 1j * dall.reshape(h5_main.shape)
except ValueError:
h5_main[:-1, :] += 0 + 1j * dall.reshape(h5_main.shape[0]-1, h5_main.shape[1])
h5_main.file.flush()
@staticmethod
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment