SNEWS2 / snewpdag

SNEWS2 alert calculations
BSD 3-Clause "New" or "Revised" License
1 stars 13 forks source link

Oct 22 firedrill changes #85

Closed tsengj10 closed 1 year ago

tsengj10 commented 1 year ago

Some changes prompted by the Oct 2022 firedrill:

To be done: null in the json input.

tsengj10 commented 1 year ago

Done: input data will be interpreted using json.loads, which can parse fairly standard JSON, including the null keyword.

Configuration (such as in .py files and the argument strings of .csv) still uses python literal evaluation, as it's less fiddly and more python-esque.

mcolomermolla commented 1 year ago

The previous implementations worked.

Still one issue to solve from previous firedrill: if detector is not in detector database (e.g. "TEST"), one still gets the following error:

INFO:root:Read detector database file snewpdag/data/detector_location_zerobias.csv Control: received 1 alerts Control: received 1 alerts Traceback (most recent call last): File "/home/marta/snewpdag-firedrill/snewpdag/dag/app.py", line 279, in inject_one dag[data['name']].update(data) File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 182, in update self.notify(action, cdata) # notify() will update history File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 83, in notify obs.update(self.last_data) File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 171, in update v = self.alert(cdata) File "/home/marta/snewpdag-firedrill/snewpdag/plugins/DiffTimes.py", line 47, in alert bias.append(det.bias) AttributeError: 'NoneType' object has no attribute 'bias'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/marta/miniconda3/envs/snewpy_env/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/marta/miniconda3/envs/snewpy_env/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/marta/snewpdag-firedrill/snewpdag/__main__.py", line 5, in <module> app.run() File "/home/marta/snewpdag-firedrill/snewpdag/dag/app.py", line 128, in run inject(dags, data, nodespecs) File "/home/marta/snewpdag-firedrill/snewpdag/dag/app.py", line 262, in inject inject_one(dags, data, nodespecs) File "/home/marta/snewpdag-firedrill/snewpdag/dag/app.py", line 290, in inject_one dag[data['name']].update(data) File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 182, in update self.notify(action, cdata) # notify() will update history File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 83, in notify obs.update(self.last_data) File "/home/marta/snewpdag-firedrill/snewpdag/dag/Node.py", line 171, in update v = self.alert(cdata) File "/home/marta/snewpdag-firedrill/snewpdag/plugins/DiffTimes.py", line 47, in alert bias.append(det.bias) AttributeError: 'NoneType' object has no attribute 'bias'

We should handle the case of not known detector (detector not in detector_location_zerobias)

mcolomermolla commented 1 year ago

Issue solved with last commit. I think all points raised from last firedrill are implemented in this PR and we are ready to use this changes in next one. We can plan some self tests before that for cross-check of the pointing result.