Skip to content

Commit

Permalink
Ensure approximant field is correct format (#4646)
Browse files Browse the repository at this point in the history
  • Loading branch information
spxiwh authored Feb 20, 2024
1 parent e7e9666 commit aa05af6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/pycbc_convertinjfiletohdf
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
shutil.copy(args.injection_file, args.output_file)

0 comments on commit aa05af6

Please sign in to comment.