Skip to main content

Reusable TOMToolkit app to support gravitational wave superevent and other nonlocalized event EM follow-up observations.

Project description

pypi run-tests Codacy Badge Coverage Status

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

  1. Install the package into your TOM environment:

    pip install tom-nonlocalizedevents
    
  2. In your project settings.py, add tom_nonlocalizedevents and webpack_loader to your INSTALLED_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', 'http://hermes-dev.lco.gtn')
    
  3. Include the tom_nonlocalizedevent URLconf in your project urls.py:

    urlpatterns = [
         ...
         path('nonlocalizedevents/', include('tom_nonlocalizedevents.urls', namespace='nonlocalizedevents')),
    ]
    
  4. Run python manage.py migrate to create the tom_nonlocalizedevents models.

  5. 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
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]'
  1. In your TOM project, make sure to run python manage.py collectstatic after installing this app, to collect its Vue pages into your staticfiles directory.

  2. 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: tom_nonlocalizedevents.alertstream_handlers.gw_event_handler.handle_message. There is also a handler to handle retractions via the handle_retraction method in that package. These are currently written to work with LVC GW messages.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tom_nonlocalizedevents-0.6.0.tar.gz (540.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tom_nonlocalizedevents-0.6.0-py3-none-any.whl (553.7 kB view details)

Uploaded Python 3

File details

Details for the file tom_nonlocalizedevents-0.6.0.tar.gz.

File metadata

  • Download URL: tom_nonlocalizedevents-0.6.0.tar.gz
  • Upload date:
  • Size: 540.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Linux/5.15.0-1033-azure

File hashes

Hashes for tom_nonlocalizedevents-0.6.0.tar.gz
Algorithm Hash digest
SHA256 61f3a520b685d010f4d69e6eec57c07a077f5abee5d52e8fb26a47e2f8b0f000
MD5 ca34f53a34f3cc2f84457a75854fa8c3
BLAKE2b-256 b3f70d4df54147208555bf8c65597900d08e937655e083f56f6b289a9f0b4039

See more details on using hashes here.

File details

Details for the file tom_nonlocalizedevents-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tom_nonlocalizedevents-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1ab1effaabede2defaed04a932bceaa2525352476ffd21aa12c9b6b231d6a16
MD5 563b92b2a96965ef71f773c0de0d97f0
BLAKE2b-256 07abba09019a2e32c7e3b33c6b726649dfc1d9eb41bf2c4016408103b6b387c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page