Skip to content

Commit

Permalink
Improve error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
fschlueter committed Jan 10, 2024
1 parent 3d3f8e8 commit 3a473f9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions NuRadioReco/detector/RNO_G/db_mongo_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def get_component_data(self, component_type, component_id, supplementary_info, p
search_filter[-1]['$match'].update({f'measurements.{supp_info}': supplementary_info[supp_info]})

# add the S parameter to the search filter, only collect single S parameter
search_filter[-1]['$match'].update({f'measurements.S_parameter': sparameter})
search_filter[-1]['$match'].update({'measurements.S_parameter': sparameter})

search_filter.append({'$unwind': '$measurements.primary_measurement'})
search_filter.append({'$match': {'measurements.primary_measurement.start': {'$lte': primary_time},
Expand All @@ -702,8 +702,7 @@ def get_component_data(self, component_type, component_id, supplementary_info, p
search_result = list(self.db[component_type].aggregate(search_filter))

if len(search_result) != 1:
print(search_result)
raise ValueError('No or more than one measurement found!')
raise ValueError(f'No or more than one measurement found: {search_result}. Search filter: {search_filter}')

measurement = search_result[0]['measurements']

Expand Down

0 comments on commit 3a473f9

Please sign in to comment.