diff --git a/wetb/prepost/hawcstab2.py b/wetb/prepost/hawcstab2.py index f8cc67201440431b2c248ac86521fdfd59a59912..39106a49b8421b53b9a6951513f7eab1471c4e14 100644 --- a/wetb/prepost/hawcstab2.py +++ b/wetb/prepost/hawcstab2.py @@ -31,7 +31,7 @@ class dummy(object): regex_units = re.compile('(\\[.*?\\])') -def ReadFileHAWCStab2Header(fname, dtype=None): +def ReadFileHAWCStab2Header(fname): """ Read a file with a weird HAWCStab2 header that starts with a #, and includes the column number and units between square brackets. @@ -79,7 +79,7 @@ def ReadFileHAWCStab2Header(fname, dtype=None): # and another with frozen wake assumption columns = get_col_names(line_header, colwidths) df = pd.read_fwf(fname, widths=colwidths, comment='#', header=None, - names=columns, dtype=dtype) + names=columns) units = regex_units.findall(''.join(columns)) return df, units @@ -155,8 +155,8 @@ class results(object): return res - def load_pwr_df(self, fname, dtype=None): - return ReadFileHAWCStab2Header(fname, dtype=dtype) + def load_pwr_df(self, fname): + return ReadFileHAWCStab2Header(fname) def load_cmb(self, fname): # aero-(servo)-elastic results for HS2>=2.14 have real_eig as 3th set diff --git a/wetb/prepost/tests/test_hawcstab2.py b/wetb/prepost/tests/test_hawcstab2.py index 38efb91ffb3f762ba49fb65fa962b0ccac3fd845..3f14f1c10eb41047f0e23d4ff4f463d8aa7be036 100644 --- a/wetb/prepost/tests/test_hawcstab2.py +++ b/wetb/prepost/tests/test_hawcstab2.py @@ -121,6 +121,10 @@ class Tests(unittest.TestCase): df_data, units = res.load_pwr_df(fname, dtype=np.float32) data = np.loadtxt(fname, dtype=np.float32) self.assertEqual(data.shape, df_data.shape) + print(data.dtype) + print(data.values.dtype) + print(data) + print(data.values) np.testing.assert_almost_equal(data, df_data.values, decimal=6)