def from_np_array_and_object(cls, np_array, obj): # TODO: consider refactoring. np_spectrum = NpSpectrumContainer.from_np_array(np_array, readonly=True) new_instance = cls(num_spectra=np_spectrum.num_spectra) # replace spectrum container with existing data new_instance.np_spectrum = np_spectrum # replace metadata with existing metadata object assert type(new_instance.continuum_fit_metadata) == type(obj) new_instance.continuum_fit_metadata = obj return new_instance
def accumulate(self, result_enum, ar_qso_indices_list, object_results): del object_results for ar_delta_t, ar_qso_indices in zip(result_enum, ar_qso_indices_list): delta_t = NpSpectrumContainer.from_np_array(ar_delta_t, readonly=True) for j, n in zip(NpSpectrumIterator(delta_t), ar_qso_indices): # if self.n >= self.num_spectra: # break self.delta_t_file.set_wavelength(n, j.get_wavelength()) self.delta_t_file.set_flux(n, j.get_flux()) self.delta_t_file.set_ivar(n, j.get_ivar()) self.n += 1 l_print_no_barrier("n =", self.n) l_print_no_barrier("n =", self.n) return self.return_result()