Reusable TOMToolkit app to support gravitational wave superevent and other nonlocalized event EM follow-up observations.
Project description
GW Superevent (or GRB, Neutrino) EM follow-up
This reusable TOM Toolkit app provides support for gravitational wave (GW) superevent and other non-localized event electromagnetic (EM) follow up observations.
Requirements
This TOM plugin requires the use of a postgresql 14+ database backend, since it leverages some postgres specific stuff for MOC volume map lookups.
Installation
-
Install the package into your TOM environment:
pip install tom-nonlocalizedevents
-
In your project
settings.py
, addtom_nonlocalizedevents
andwebpack_loader
to yourINSTALLED_APPS
setting:INSTALLED_APPS = [ 'webpack_loader', ... 'tom_nonlocalizedevents', ]
Also include the following Django-Webpack-Loader settings in your settings.py:
VUE_FRONTEND_DIR_TOM_NONLOCAL = os.path.join(STATIC_ROOT, 'tom_nonlocalizedevents/vue') WEBPACK_LOADER = { 'TOM_NONLOCALIZEDEVENTS': { 'CACHE': not DEBUG, 'BUNDLE_DIR_NAME': 'tom_nonlocalizedevents/vue/', # must end with slash 'STATS_FILE': os.path.join(VUE_FRONTEND_DIR_TOM_NONLOCAL, 'webpack-stats.json'), 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, 'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] } }
If
WEBPACK_LOADER
is already defined in your settings, then integrate these values in to it.Also add the following to your settings if they are not already there, setting whatever default values you need for your setup. These point to your deployed TOM toolkit instance, and to a hermes instance:
TOM_API_URL = os.getenv('TOM_API_URL', 'http://127.0.0.1:8000') HERMES_API_URL = os.getenv('HERMES_API_URL', 'https://hermes-dev.lco.global')
-
Include the tom_nonlocalizedevent URLconf in your project
urls.py
:urlpatterns = [ ... path('nonlocalizedevents/', include('tom_nonlocalizedevents.urls', namespace='nonlocalizedevents')), ]
-
Run
python manage.py migrate
to create the tom_nonlocalizedevents models. -
Set environment variables below to configure different connections:
Env variable | Description | Default |
---|---|---|
SA_DB_CONNECTION_URL |
Location of your django postgres database used for sqlalchemy | by default, this uses Django default DB for the project |
POOL_SIZE |
The number of connections to keep open inside the connection pool. (docs) | 5 |
MAX_OVERFLOW |
The number of connections to allow in connection pool “overflow”. (docs) | 10 |
CREDIBLE_REGION_PROBABILITIES |
JSON List of Credible Region probabilities to automatically check each candidate target for | '[0.25, 0.5, 0.75, 0.9, 0.95]' |
SAVE_TEST_ALERTS |
Boolean on if you want to save test nonlocalizedevents into your database (those with event_id beginning with 'M') | true |
See Engine Configuration for details of SQLAlchemy Engine Configuration.
-
In your TOM project, make sure to run
python manage.py collectstatic
after installing this app, to collect its Vue pages into yourstaticfiles
directory. -
If you want to automatically ingest GW events into your TOM, you should also install the
tom_alertstreams
app into your TOM and configure it to use the tom_nonlocalizedevents handler to ingest GW events. The preferred way is to use the hopigwn.gwalerts
topic and set it to the handlertom_nonlocalizedevents.alertstream_handlers.igwn_event_handler.handle_igwn_message
. This format has the newest Ligo O4 fields. There is legacy support for the gcn classic over kafka plaintext formatted LVC alerts using the handlertom_nonlocalizedevents.alertstream_handlers.gcn_event_handler.handle_message
. There is also a handler to handle retractions via thehandle_retraction
method in that package. For an example of what needs to be in your settings to configuretom_alertstreams
for these streams, look here
Development
When any changes are made to this library, the vue files will need to be build and bundled and committed into the repo so that they can be bundled and deployed with the django package. This means that after making any vue changes, you must run npm run build
within the tom_nonlocalizedevents_vue
directory once, which will install the built files into tom_nonlocalizedevents/static/
, and then those built files will need to be committed into the repo. This allows django projects using this library to get those files when running python manage.py collectstatic
.
Running the tests
In order to run the tests, run the following in your virtualenv:
python manage.py test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tom_nonlocalizedevents-0.8.1.tar.gz
.
File metadata
- Download URL: tom_nonlocalizedevents-0.8.1.tar.gz
- Upload date:
- Size: 544.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84112516523bd8740ab8ddafdd3e4dbdb03b5256372553a53d8309dd11c30a3f |
|
MD5 | b03816785c913a0c9bda54290bce9548 |
|
BLAKE2b-256 | 3292b88c7d21541e8589a137945e5f1a07dd717b3ac8ba0752f6484e19d217d1 |
File details
Details for the file tom_nonlocalizedevents-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: tom_nonlocalizedevents-0.8.1-py3-none-any.whl
- Upload date:
- Size: 561.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48dfd16026449bf802e1a6b5d4485331a7ffaadd7b0f71331343a77e89342d51 |
|
MD5 | 5f6dacbcd1f3a9bf485fda1cf082b7ea |
|
BLAKE2b-256 | 38a2d5577bb8eb631144bc23385affbc0aa6b828e315421aafd17c5986c25fbc |