Commit 55b817fc authored by Somnath, Suhas's avatar Somnath, Suhas
Browse files

Can now specify the number of random spectra in BE ODF

Translator now names the dataset correctly
parent b79d0a72
......@@ -34,6 +34,7 @@ class BEodfTranslator(Translator):
self.hdf = None
self.h5_raw = None
self.num_rand_spectra = kwargs.pop('num_rand_spectra', 1000)
def translate(self, file_path, show_plots=True, save_plots=True, do_histogram=False):
"""
......@@ -430,7 +431,8 @@ class BEodfTranslator(Translator):
return
step_size = int(step_size)
rand_spectra = self.__get_random_spectra(parsers, self.h5_raw.shape[0], udvs_steps, step_size, num_spectra=100)
rand_spectra = self.__get_random_spectra(parsers, self.h5_raw.shape[0], udvs_steps, step_size,
num_spectra=self.num_rand_spectra)
take_conjugate = requires_conjugate(rand_spectra)
self.mean_resp = np.zeros(shape=(self.h5_raw.shape[1]), dtype=np.complex64)
......@@ -502,10 +504,12 @@ class BEodfTranslator(Translator):
parser = BEodfParser(real_path, imag_path, self.h5_raw.shape[0], self.h5_raw.shape[1]*4)
step_size = self.h5_raw.shape[1] / udvs_steps
rand_spectra = self.__get_random_spectra([parser], self.h5_raw.shape[0], udvs_steps, step_size, num_spectra=100)
rand_spectra = self.__get_random_spectra([parser], self.h5_raw.shape[0], udvs_steps, step_size,
num_spectra=self.num_rand_spectra)
take_conjugate = requires_conjugate(rand_spectra)
raw_vec = parser.read_all_data()
if take_conjugate:
print('Taking conjugate to ensure positive Quality factors')
raw_vec = np.conjugate(raw_vec)
raw_mat = raw_vec.reshape(self.h5_raw.shape[0], self.h5_raw.shape[1])
......
......@@ -136,16 +136,16 @@ class Translator(object):
# Create the slices that will define the labels
if is_spectral:
mode = 'Spectroscopic'
mode = 'Spectroscopic_'
indices = indices.transpose()
values = values.transpose()
region_slices = getSpectralSlicing(labels)
else:
mode = 'Position'
mode = 'Position_'
region_slices = getPositionSlicing(labels)
# Create the MicroDatasets for both Indices and Values
ds_indices = MicroDataset(mode + '_Indices', indices, dtype=np.uint32)
ds_indices = MicroDataset(mode + 'Indices', indices, dtype=np.uint32)
ds_indices.attrs['labels'] = region_slices
ds_values = MicroDataset(mode + 'Values', values, dtype=np.float32)
......
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