Exemplo n.º 1
0
def test_shift_spect():
    df = pd.read_csv(get_path('test_data.csv'), header=[0, 1])
    result = shift_spect.shift_spect(df, -1.0)
    expected = [
        898.64928571, 973.62444444, 1034.46444444, 1004.54, 939.16222222
    ]
    np.testing.assert_array_almost_equal(expected,
                                         np.array(result['wvl'].iloc[0, 0:5]))
    assert result[('meta', 'Shift')].shape == (103, )
Exemplo n.º 2
0
 def run(self):
     datakey_to_shift = self.choosedata.currentText()
     shifts = [float(i) for i in self.shifts.text().split(',')]
     pass
     self.data[datakey_to_shift].df[('meta', 'Shift')] = 0
     to_shift = self.data[datakey_to_shift].df
     for s in shifts:
         shifted = shift_spect(to_shift, s)
         self.data[datakey_to_shift].df = pd.concat(
             [self.data[datakey_to_shift].df, shifted])
Exemplo n.º 3
0
    def run(self):
        datakey_to_shift = self.choosedata.currentText()
        shifts = [float(i) for i in self.shifts.text().split(',')]
        pass
        self.data[datakey_to_shift].df[('meta', 'Shift')] = 0
        to_shift = self.data[datakey_to_shift].df
        for s in shifts:
            shifted = shift_spect(to_shift, s)
            self.data[datakey_to_shift].df = pd.concat(
                [self.data[datakey_to_shift].df, shifted])

        nan_cols = self.data[datakey_to_shift].df['wvl'].columns[
            self.data[datakey_to_shift].df['wvl'].isna().any()]
        print('Dropping the following wavelengths:')
        for i in nan_cols:
            print(str(i))
        nan_cols = [('wvl', i) for i in nan_cols]

        self.data[datakey_to_shift].df = self.data[datakey_to_shift].df.drop(
            nan_cols, axis=1)
 def shift(self, shift):
     self.df = shift_spect.shift_spect(self.df, shift)