From 91ee5ba4c1b61a5b7b39caad68636309c64f0d9d Mon Sep 17 00:00:00 2001 From: nstarman Date: Thu, 21 Nov 2024 14:45:42 -0500 Subject: [PATCH] refactor: use sep for pd.read_csv delim_whitespace is deprecated. Signed-off-by: nstarman --- isochrones/bc.py | 2 +- isochrones/mist/models.py | 4 ++-- isochrones/starmodel.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/isochrones/bc.py b/isochrones/bc.py index 573504d..8bc94ea 100644 --- a/isochrones/bc.py +++ b/isochrones/bc.py @@ -80,7 +80,7 @@ def parse_table(self, filename): names = line[1:].split() break return pd.read_csv( - filename, names=names, delim_whitespace=True, comment="#", index_col=self.index_cols + filename, names=names, sep=r"\s+", comment="#", index_col=self.index_cols ) def get_table(self, phot, feh): diff --git a/isochrones/mist/models.py b/isochrones/mist/models.py index dbac5ab..8d29cef 100644 --- a/isochrones/mist/models.py +++ b/isochrones/mist/models.py @@ -142,7 +142,7 @@ def to_df(cls, filename): break feh = cls.get_feh(filename) df = pd.read_csv( - filename, comment="#", delim_whitespace=True, skip_blank_lines=True, names=column_names + filename, comment="#", sep=r"\s+", skip_blank_lines=True, names=column_names ) df["feh"] = feh return df @@ -275,7 +275,7 @@ def to_df(cls, filename): break initial_mass = cls.get_mass(filename) df = pd.read_csv( - filename, comment="#", delim_whitespace=True, skip_blank_lines=True, names=column_names + filename, comment="#", sep=r"\s+", skip_blank_lines=True, names=column_names ) df["initial_mass"] = initial_mass try: diff --git a/isochrones/starmodel.py b/isochrones/starmodel.py index e8f6b68..684220d 100644 --- a/isochrones/starmodel.py +++ b/isochrones/starmodel.py @@ -1653,7 +1653,7 @@ def derived_samples(self): def _make_samples(self): filename = "{}post_equal_weights.dat".format(self.mnest_basename) try: - df = pd.read_csv(filename, names=self.param_names + ("lnprob",), delim_whitespace=True) + df = pd.read_csv(filename, names=self.param_names + ("lnprob",), sep=r"\s+") except OSError: logger.error("Error loading chains from {}".format(filename)) raise