diff --git a/bin/pycbc_convertinjfiletohdf b/bin/pycbc_convertinjfiletohdf index f0557fa03b2..c871d9a4189 100755 --- a/bin/pycbc_convertinjfiletohdf +++ b/bin/pycbc_convertinjfiletohdf @@ -151,7 +151,11 @@ class LVKNewStyleInjectionSet(object): elif lvk_name == 't_co_gps_add': continue else: - data[pycbc_name] = self.inj_file[f'{self.subdir}/{lvk_name}'][:] + lvk_file_dset = self.inj_file[f'{self.subdir}/{lvk_name}'] + if lvk_file_dset.dtype.char in ['U', 'O']: + data[pycbc_name] = lvk_file_dset[:].astype('S') + else: + data[pycbc_name] = lvk_file_dset[:] return data @@ -187,4 +191,4 @@ if injclass is not None: CBCHDFInjectionSet.write(args.output_file, samples) else: # Assume the injection is a HDF file (PyCBC format), only make a copy - shutil.copy(args.injection_file, args.output_file) \ No newline at end of file + shutil.copy(args.injection_file, args.output_file)