Skip to content

Commit

Permalink
Merge pull request #81 from SNEWS2/spt-message-classes
Browse files Browse the repository at this point in the history
Add SNEWSMessage class hierarchy.
  • Loading branch information
sybenzvi authored Nov 10, 2023
2 parents 4d7067e + 3c153bb commit 8d9c256
Show file tree
Hide file tree
Showing 25 changed files with 1,501 additions and 1,295 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/mac10-py37.yml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/mac11-py37.yml

This file was deleted.

80 changes: 0 additions & 80 deletions .github/workflows/ubuntu20-py37-310.yml

This file was deleted.

85 changes: 0 additions & 85 deletions .github/workflows/ubuntu20-py37.yml

This file was deleted.

14 changes: 7 additions & 7 deletions docs/user/firedrills.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ We would like to test two main interactions; **subscribing** & **publishing** t

- API:
```python
from snews_pt.snews_pub import SNEWSTiersPublisher
SNEWSTiersPublisher(detector_name='KamLAND',
from snews_pt.messages import SNEWSMessageBuilder
SNEWSMessageBuilder(detector_name='KamLAND',
neutrino_time="2022-02-28T04:31:08.678999",
p_val=0.000007,
machine_time="2022-02-28T04:31:09.778859",
firedrill_mode=True,
is_test=True,
).send_to_snews()
).send_messages()
```
or
or
```python
from snews_pt.snews_pub import SNEWSTiersPublisher
observation = SNEWSTiersPublisher.from_json('somejsonfile.json',
from snews_pt.messages import SNEWSMessageBuilder
observation = SNEWSMessageBuilder.from_json('somejsonfile.json',
detector_name='XENONnT',
firedrill_mode=True,
is_test=True,
comment="This is submitted from a json file")
observation.send_to_snews()
observation.send_messages()
```
Notice that `SNEWSTiersPublisher` returns an object which actually contains the decided tiers, and formatted messages.
One can play with this object before finally `send_to_snews()`.
Expand Down
10 changes: 6 additions & 4 deletions docs/user/publishing_protocols.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ The user can share as much information as they desire with one simple function c
sets the "Tier" and any additional information is passed under `meta` field.

The user can use `SNEWSTiersPublisher` to create observation message(s) and send them to snews.

```python
from snews_pt.snews_pub import SNEWSTiersPublisher
messages = SNEWSTiersPublisher(neutrino_time="2022-02-28T04:31:08.678999")
messages.send_to_snews()
from snews_pt.messages import SNEWSMessageBuilder

messages = SNEWSMessageBuilder(neutrino_time="2022-02-28T04:31:08.678999")
messages.send_messages()
```
User can also investigate their messages before sending it to SNEWS. The `SNEWSTiersPublisher` creates an object which contains
the generated and formatted messages. It can also tell you what "Tiers" are selected based on the input that is given.
Expand Down Expand Up @@ -92,7 +94,7 @@ Notice that your message can contain fields that correspond to several tiers e.g
In the example below `SNEWSTierPublisher` creates a message for "CoincidenceTier" because the `neutrino_time` is passed, and it creates
another message for the "Significance Tier" because the `p_values` together with the `t_bin_width` is passed.

Here the `p_val` is the p value of the detection and it is optional. The `detector_name` can be passed manually, however, if the name is initially set, this is also not needed.
Here the `p_val` is the p value of the detection, and it is optional. The `detector_name` can be passed manually, however, if the name is initially set, this is also not needed.

<img src="../example_publishing.png" alt="Publication example" width="2000"/>

Expand Down
Loading

0 comments on commit 8d9c256

Please sign in to comment.