Skip to content

Commit

Permalink
Added verbose parameter to list_filters method of ReadObject, updated…
Browse files Browse the repository at this point in the history
… astropy version due to security issue
  • Loading branch information
tomasstolker committed Mar 22, 2024
1 parent 3a2dd02 commit d056be0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
astropy ~= 5.2.0
astropy ~= 5.3.3.
astroquery ~= 0.4.0
corner ~= 2.2.0
dynesty ~= 2.1.0
Expand Down
2 changes: 1 addition & 1 deletion species/fit/fit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
14 changes: 11 additions & 3 deletions species/read/read_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit d056be0

Please sign in to comment.