Skip to content

Commit

Permalink
Merge pull request #677 from nu-radio/hotfix/rno-g-detector-singleton
Browse files Browse the repository at this point in the history
Fix for rnog_detector singleton
  • Loading branch information
sjoerd-bouma committed Jun 6, 2024
2 parents c3820bc + 27a3db2 commit 7db92d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions NuRadioReco/detector/RNO_G/rnog_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _impl(self, *method_args, **method_kwargs):
class Detector():
def __init__(self, database_connection='RNOG_test_public', log_level=logging.INFO, over_write_handset_values={},
database_time=None, always_query_entire_description=True, detector_file=None,
select_stations=None):
select_stations=None, create_new=False):
"""
Parameters
Expand All @@ -78,7 +78,7 @@ def __init__(self, database_connection='RNOG_test_public', log_level=logging.INF
Overwrite the default values for the manually set parameter which are not (yet) implemented in the database.
(Default: {}, the acutally default values for the parameters in question are defined below)
database_time : `datetime.datetime` or ``astropy.time.Time``
database_time : `datetime.datetime` or `astropy.time.Time`
Set database time which is used to select the primary measurement. By default (= None) the database time
is set to now (time the code is running) to select the measurement which is now primary.
Expand All @@ -92,6 +92,10 @@ def __init__(self, database_connection='RNOG_test_public', log_level=logging.INF
Select a station or list of stations using their station ids for which the describtion is provided.
This is useful for example in simulations when one wants to simulate only one station. The default None
means to descibe all commissioned stations.
create_new : bool (Default: False)
If False, and a database already exists, the existing database will be used rather than initializing a
new connection. Set to True to create a new database connection.
"""

self.logger = logging.getLogger("NuRadioReco.RNOGdetector")
Expand All @@ -113,7 +117,7 @@ def __init__(self, database_connection='RNOG_test_public', log_level=logging.INF
if detector_file is None:
self._det_imported_from_file = False

self.__db = Database(database_connection=database_connection)
self.__db = Database(database_connection=database_connection, create_new=create_new)
if database_time is not None:
self.__db.set_database_time(database_time)

Expand Down
3 changes: 2 additions & 1 deletion documentation/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'scipy': ('https://docs.scipy.org/doc/scipy', None),
'numpy': ("https://numpy.org/doc/stable", None)
'numpy': ("https://numpy.org/doc/stable", None),
'astropy': ("https://docs.astropy.org/en/stable", None)
}
default_role = 'autolink' #TODO: probably switch to py:obj?

Expand Down

0 comments on commit 7db92d0

Please sign in to comment.