예제 #1
0
 def test_write_ligolw_attrs(self, flag):
     from gwpy.io.ligolw import read_table
     with tempfile.NamedTemporaryFile(suffix='.xml') as f:
         flag.write(f, format='ligolw',
                    attrs={'process_id': 'process:process_id:100'})
         segdeftab = read_table(f, 'segment_definer')
         assert str(segdeftab[0].process_id) == (
             'process:process_id:100')
예제 #2
0
 def test_write_ligolw_attrs(self, flag):
     from gwpy.io.ligolw import read_table
     with tempfile.NamedTemporaryFile(suffix='.xml') as f:
         flag.write(f,
                    format='ligolw',
                    attrs={'process_id': 'process:process_id:100'})
         segdeftab = read_table(f, 'segment_definer')
         assert str(segdeftab[0].process_id) == ('process:process_id:100')
예제 #3
0
 def test_write_ligolw_attrs(self, flag):
     from gwpy.io.ligolw import read_table
     with tempfile.NamedTemporaryFile(suffix='.xml') as f:
         flag.write(
             f,
             format='ligolw',
             attrs={'process_id': 100},
             ilwdchar_compat=False,
         )
         segdeftab = read_table(f, 'segment_definer')
         assert int(segdeftab[0].process_id) == 100
예제 #4
0
파일: test_flag.py 프로젝트: gwpy/gwpy
 def test_write_ligolw_attrs(self, flag):
     from gwpy.io.ligolw import read_table
     with tempfile.NamedTemporaryFile(suffix='.xml') as f:
         flag.write(
             f,
             format='ligolw',
             attrs={'process_id': 100},
             ilwdchar_compat=False,
         )
         segdeftab = read_table(f, 'segment_definer')
         assert int(segdeftab[0].process_id) == 100
예제 #5
0
파일: test_table.py 프로젝트: stefco/gwpy
    def test_read_write_ligolw_property_columns(self):
        table = self.create(100, ['peak', 'snr', 'central_freq'],
                            ['f8', 'f4', 'f4'])
        with tempfile.NamedTemporaryFile(suffix='.xml') as f:
            # write table
            table.write(f, format='ligolw', tablename='sngl_burst')

            # read raw ligolw and check gpsproperty was unpacked properly
            llw = io_ligolw.read_table(f, tablename='sngl_burst')
            for col in ('peak_time', 'peak_time_ns'):
                assert col in llw.columnnames
            with io_ligolw.patch_ligotimegps():
                utils.assert_array_equal(llw.get_peak(), table['peak'])

            # read table and assert gpsproperty was repacked properly
            t2 = self.TABLE.read(f, columns=table.colnames,
                                 use_numpy_dtypes=True)
            utils.assert_table_equal(t2, table, almost_equal=True)
예제 #6
0
    def test_read_write_ligolw_property_columns(self):
        table = self.create(100, ['peak', 'snr', 'central_freq'],
                            ['f8', 'f4', 'f4'])
        with tempfile.NamedTemporaryFile(suffix='.xml') as f:
            # write table
            table.write(f, format='ligolw', tablename='sngl_burst')

            # read raw ligolw and check gpsproperty was unpacked properly
            llw = io_ligolw.read_table(f, tablename='sngl_burst')
            for col in ('peak_time', 'peak_time_ns'):
                assert col in llw.columnnames
            with io_ligolw.patch_ligotimegps():
                utils.assert_array_equal(llw.get_peak(), table['peak'])

            # read table and assert gpsproperty was repacked properly
            t2 = self.TABLE.read(f,
                                 columns=table.colnames,
                                 use_numpy_dtypes=True)
            utils.assert_table_equal(t2, table, almost_equal=True)