From d056be0edc248ef6f73075f098cc1ece84c595d1 Mon Sep 17 00:00:00 2001 From: Tomas Stolker Date: Fri, 22 Mar 2024 09:26:23 +0100 Subject: [PATCH] Added verbose parameter to list_filters method of ReadObject, updated astropy version due to security issue --- requirements.txt | 2 +- species/fit/fit_model.py | 2 +- species/read/read_object.py | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index b437fe9..9787b78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -astropy ~= 5.2.0 +astropy ~= 5.3.3. astroquery ~= 0.4.0 corner ~= 2.2.0 dynesty ~= 2.1.0 diff --git a/species/fit/fit_model.py b/species/fit/fit_model.py index 3481d81..eafd778 100644 --- a/species/fit/fit_model.py +++ b/species/fit/fit_model.py @@ -671,7 +671,7 @@ def __init__( if isinstance(inc_phot, bool): if inc_phot: # Select all filters if inc_phot=True - inc_phot = self.object.list_filters() + inc_phot = self.object.list_filters(verbose=False) else: inc_phot = [] diff --git a/species/read/read_object.py b/species/read/read_object.py index b5efecf..36c8b4f 100644 --- a/species/read/read_object.py +++ b/species/read/read_object.py @@ -52,11 +52,16 @@ def __init__(self, object_name: str) -> None: ) @typechecked - def list_filters(self) -> List[str]: + def list_filters(self, verbose=True) -> List[str]: """ Function for listing and returning the filter profile names for which there is photometric data stored in the database. + Parameters + ---------- + verbose : bool + Print the filter names if set to ``True``. + Returns ------- list(str) @@ -65,15 +70,18 @@ def list_filters(self) -> List[str]: filter_list = [] - print(f"Available photometric data for {self.object_name}:") + if verbose: + print(f"Available photometric data for {self.object_name}:") with h5py.File(self.database, "r") as h5_file: for tel_item in h5_file[f"objects/{self.object_name}"]: if tel_item not in ["parallax", "distance", "spectrum"]: for filt_item in h5_file[f"objects/{self.object_name}/{tel_item}"]: - print(f" - {tel_item}/{filt_item}") filter_list.append(f"{tel_item}/{filt_item}") + if verbose: + print(f" - {tel_item}/{filt_item}") + return filter_list @typechecked