예제 #1
0
    def test_to_sorted_numpy(self):
        full_set = self.preproc.full_set
        result = Preprocessor._to_sorted_numpy(full_set)

        # datetime is repr. as ns since the beginning of the epoch
        expected = np.asarray(
            [
                (0, 'CLOSED', 1415079006072910000L, 'V47_20141104053006072910',
                 'DARK', 'SHUT'),
                (1, 'CLOSED', 1415079947220344000L, 'V47_20141104054547220344',
                 'SCIENCE', 'OPEN'),
            ],
            dtype=[
                ('index', '<i8'), ('AO_LOOP_STATE', 'O'), ('DATETIME', '<M8[ns]'),
                ('IMAGE_NAME', 'O'), ('IMAGE_TYPE', 'O'), ('SHUTTER_STATE', 'O')
            ])
        np.testing.assert_array_equal(result, expected)