def __call__(self, data): data = self.transform_domain(data) if "edge_jump" in data.domain: edges = data.transform(Orange.data.Domain([data.domain["edge_jump"]])) I_jumps = edges.X[:, 0] else: raise NoEdgejumpProvidedException( 'Invalid meta data: Intensity jump at edge is missing') # order X by wavenumbers: # xs non ordered energies # xsind - indecies corresponding to the ordered energies # mon = True # X spectra as corresponding to the ordered energies xs, xsind, mon, X = transform_to_sorted_features(data) # for the missing data X, nans = nan_extend_edges_and_interpolate(xs[xsind], X) # TODO notify the user if some unknown values were interpolated # Replace remaining NaNs (where whole rows were NaN) with # with some values so that the function does not crash. # Results are going to be discarded later. nan_rows = np.isnan(X).all(axis=1) X[nan_rows] = 1. # do the transformation X = self.transformed(X, xs[xsind], I_jumps) # discard nan rows X[nan_rows] = np.nan # k scores are always ordered, so do not restore order return X
def __call__(self, data): data = self.transform_domain(data) if "edge_jump" in data.domain: edges = data.transform(Orange.data.Domain([data.domain["edge_jump"]])) I_jumps = edges.X[:, 0] else: raise NoEdgejumpProvidedException( 'Invalid meta data: Intensity jump at edge is missing') # order X by wavenumbers: # xs non ordered energies # xsind - indecies corresponding to the ordered energies # mon = True # X spectra as corresponding to the ordered energies xs, xsind, mon, X = transform_to_sorted_features(data) # for the missing data X, nans = nan_extend_edges_and_interpolate(xs[xsind], X) # TODO notify the user if some unknown values were interpolated # do the transformation X = self.transformed(X, xs[xsind], I_jumps) # k scores are always ordered, so do not restore order return X