Skip to content

Commit

Permalink
use database_time explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
fschlueter committed Aug 30, 2023
1 parent ae185c3 commit 5c70935
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions NuRadioReco/detector/RNO_G/db_mongo_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,6 @@ def get_collection_information_by_station_id(self, collection_name, station_id,
# if the collection is empty, return an empty dict
if self.db[collection_name].count_documents({'id': {'$regex': f'_stn{station_id}_'}}) == 0:
return {}

primary_time = self.__database_time

# define the search filter
search_filter = [{'$match': {'id': {'$regex': f'_stn{station_id}_'}}}, {'$unwind': '$measurements'}]
Expand All @@ -524,8 +522,8 @@ def get_collection_information_by_station_id(self, collection_name, station_id,
if measurement_name is None or use_primary_time_with_measurement:
search_filter += [
{'$unwind': '$measurements.primary_measurement'},
{'$match': {'measurements.primary_measurement.start': {'$lte': primary_time},
'measurements.primary_measurement.end': {'$gte': primary_time}}}]
{'$match': {'measurements.primary_measurement.start': {'$lte': self.__database_time},
'measurements.primary_measurement.end': {'$gte': self.__database_time}}}]
else:
# measurement/object identified by soley by "measurement_name"
pass
Expand Down Expand Up @@ -589,9 +587,7 @@ def get_collection_information_by_id(self, collection_name, id, measurement_name
# if the collection is empty, return an empty dict
if self.db[collection_name].count_documents({'id': id}) == 0:
return {}

primary_time = self.__database_time


# define the search filter
search_filter = [{'$match': {'id': id}},
{'$unwind': '$measurements'}]
Expand All @@ -602,8 +598,8 @@ def get_collection_information_by_id(self, collection_name, id, measurement_name
if measurement_name is None or use_primary_time_with_measurement:
search_filter += [
{'$unwind': '$measurements.primary_measurement'},
{'$match': {'measurements.primary_measurement.start': {'$lte': primary_time},
'measurements.primary_measurement.end': {'$gte': primary_time}}}]
{'$match': {'measurements.primary_measurement.start': {'$lte': self.__database_time},
'measurements.primary_measurement.end': {'$gte': self.__database_time}}}]
else:
# measurement/object identified by soley by "measurement_name"
pass
Expand Down

0 comments on commit 5c70935

Please sign in to comment.