Skip to content

Commit

Permalink
validate model name
Browse files Browse the repository at this point in the history
  • Loading branch information
orelgueta committed Jan 25, 2024
1 parent cfa5a65 commit efc6210
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions simtools/db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ def get_all_versions(
def get_all_available_telescopes(
self,
db_name=DB_CTA_SIMULATION_MODEL,
version="Released",
model_version="Released",
):
"""
Get all available telescope names in the collection "telescopes" in the DB.
Expand All @@ -1455,7 +1455,7 @@ def get_all_available_telescopes(
----------
db_name: str
the name of the DB
version: str
model_version: str
Which version to get the telescopes of (default: "Released").
Returns
Expand All @@ -1467,10 +1467,13 @@ def get_all_available_telescopes(

collection = DatabaseHandler.db_client[db_name]["telescopes"]

_model_version = self._convert_version_to_tagged(
names.validate_model_version_name(model_version),
DatabaseHandler.DB_CTA_SIMULATION_MODEL,
)

query = {
"Version": self._convert_version_to_tagged(
version, DatabaseHandler.DB_CTA_SIMULATION_MODEL
),
"Version": _model_version,
}

_all_available_telescopes = collection.find(query).distinct("Telescope")
Expand Down

0 comments on commit efc6210

Please sign in to comment.