tom-nonlocalizedevents


Nametom-nonlocalizedevents JSON
Version 0.7.7 PyPI version JSON
download
home_pagehttps://github.com/TOMToolkit/tom_nonlocalizedevents
SummaryReusable TOMToolkit app to support gravitational wave superevent and other nonlocalized event EM follow-up observations.
upload_time2023-06-19 18:44:15
maintainer
docs_urlNone
authorTOM Toolkit Project
requires_python>=3.8,<3.12
licenseGPL-3.0-only
keywords tomtoolkit astronomy astrophysics cosmology science
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pypi](https://img.shields.io/pypi/v/tom-nonlocalizedevents.svg)](https://pypi.python.org/pypi/tom-nonlocalizedevents)
[![run-tests](https://github.com/TOMToolkit/tom_nonlocalizedevents/actions/workflows/run-tests.yml/badge.svg)](https://github.com/TOMToolkit/tom_nonlocalizedevents/actions/workflows/run-tests.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cbcf7ce565d8450f86fff863ef061ff9)](https://www.codacy.com/gh/TOMToolkit/tom_nonlocalizedevents/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=TOMToolkit/tom_nonlocalizedevents&amp;utm_campaign=Badge_Grade)
[![Coverage Status](https://coveralls.io/repos/github/TOMToolkit/tom_nonlocalizedevents/badge.svg?branch=main)](https://coveralls.io/github/TOMToolkit/tom_nonlocalizedevents?branch=main)

# 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:
    ```bash
    pip install tom-nonlocalizedevents
   ```

2. In your project `settings.py`, add `tom_nonlocalizedevents` and `webpack_loader` to your `INSTALLED_APPS` setting:

    ```python
    INSTALLED_APPS = [
        'webpack_loader',
        ...
        'tom_nonlocalizedevents',
    ]
    ```
    
    Also include the following Django-Webpack-Loader settings in your settings.py:

    ```python
    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:
    ```python
    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')

    ```

3. Include the tom_nonlocalizedevent URLconf in your project `urls.py`:
   ```python
   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 |
| `POOL_SIZE` | The number of connections to keep open inside the connection pool. ([docs](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.pool_size)) | 5 |
| `MAX_OVERFLOW` | The number of connections to allow in connection pool “overflow”. ([docs](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.max_overflow)) | 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](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine) for
details of SQLAlchemy Engine Configuration.

6. 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.

7. 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 hop `igwn.gwalerts` topic and set it to the handler `tom_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 handler `tom_nonlocalizedevents.alertstream_handlers.gcn_event_handler.handle_message`. There is also a handler to handle retractions via the `handle_retraction` method in that package. For an example of what needs to be in your settings to configure `tom_alertstreams` for these streams, look [here](https://github.com/LCOGT/hermes/blob/dev/hermes_base/settings.py#L232)

## 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`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TOMToolkit/tom_nonlocalizedevents",
    "name": "tom-nonlocalizedevents",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.12",
    "maintainer_email": "",
    "keywords": "tomtoolkit,astronomy,astrophysics,cosmology,science",
    "author": "TOM Toolkit Project",
    "author_email": "tomtoolkit@lco.global",
    "download_url": "https://files.pythonhosted.org/packages/79/f0/740fd6c16165777d5902d6758fe41ec68b17784c11bfbc4c25afea848b1c/tom_nonlocalizedevents-0.7.7.tar.gz",
    "platform": null,
    "description": "[![pypi](https://img.shields.io/pypi/v/tom-nonlocalizedevents.svg)](https://pypi.python.org/pypi/tom-nonlocalizedevents)\n[![run-tests](https://github.com/TOMToolkit/tom_nonlocalizedevents/actions/workflows/run-tests.yml/badge.svg)](https://github.com/TOMToolkit/tom_nonlocalizedevents/actions/workflows/run-tests.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cbcf7ce565d8450f86fff863ef061ff9)](https://www.codacy.com/gh/TOMToolkit/tom_nonlocalizedevents/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=TOMToolkit/tom_nonlocalizedevents&amp;utm_campaign=Badge_Grade)\n[![Coverage Status](https://coveralls.io/repos/github/TOMToolkit/tom_nonlocalizedevents/badge.svg?branch=main)](https://coveralls.io/github/TOMToolkit/tom_nonlocalizedevents?branch=main)\n\n# GW Superevent (or GRB, Neutrino) EM follow-up\n\nThis reusable TOM Toolkit app provides support for gravitational wave (GW) superevent\nand other non-localized event electromagnetic (EM) follow up observations.  \n\n## Requirements\n\nThis TOM plugin requires the use of a postgresql 14+ database backend, since it leverages some postgres specific stuff for MOC volume map lookups.\n\n## Installation\n\n1. Install the package into your TOM environment:\n    ```bash\n    pip install tom-nonlocalizedevents\n   ```\n\n2. In your project `settings.py`, add `tom_nonlocalizedevents` and `webpack_loader` to your `INSTALLED_APPS` setting:\n\n    ```python\n    INSTALLED_APPS = [\n        'webpack_loader',\n        ...\n        'tom_nonlocalizedevents',\n    ]\n    ```\n    \n    Also include the following Django-Webpack-Loader settings in your settings.py:\n\n    ```python\n    VUE_FRONTEND_DIR_TOM_NONLOCAL = os.path.join(STATIC_ROOT, 'tom_nonlocalizedevents/vue')\n    WEBPACK_LOADER = {\n        'TOM_NONLOCALIZEDEVENTS': {\n            'CACHE': not DEBUG,\n            'BUNDLE_DIR_NAME': 'tom_nonlocalizedevents/vue/',  # must end with slash\n            'STATS_FILE': os.path.join(VUE_FRONTEND_DIR_TOM_NONLOCAL, 'webpack-stats.json'),\n            'POLL_INTERVAL': 0.1,\n            'TIMEOUT': None,\n            'IGNORE': [r'.+\\.hot-update.js', r'.+\\.map']\n        }\n    }\n    ```\n\n    If `WEBPACK_LOADER` is already defined in your settings, then integrate these values in to it.\n\n    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:\n    ```python\n    TOM_API_URL = os.getenv('TOM_API_URL', 'http://127.0.0.1:8000')\n    HERMES_API_URL = os.getenv('HERMES_API_URL', 'https://hermes-dev.lco.global')\n\n    ```\n\n3. Include the tom_nonlocalizedevent URLconf in your project `urls.py`:\n   ```python\n   urlpatterns = [\n        ...\n        path('nonlocalizedevents/', include('tom_nonlocalizedevents.urls', namespace='nonlocalizedevents')),\n   ]\n   ```\n\n4. Run ``python manage.py migrate`` to create the tom_nonlocalizedevents models.\n\n5. Set environment variables below to configure different connections:\n\n| Env variable | Description | Default |\n| ------------ | ----------- | ------- |\n| `SA_DB_CONNECTION_URL` | Location of your django postgres database used for sqlalchemy | by default, this uses Django `default` DB for the project |\n| `POOL_SIZE` | The number of connections to keep open inside the connection pool. ([docs](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.pool_size)) | 5 |\n| `MAX_OVERFLOW` | The number of connections to allow in connection pool \u201coverflow\u201d. ([docs](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine.params.max_overflow)) | 10 |\n| `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]'` |\n| `SAVE_TEST_ALERTS` | Boolean on if you want to save test nonlocalizedevents into your database (those with event_id beginning with 'M') | `true` |\n\nSee [Engine Configuration](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine) for\ndetails of SQLAlchemy Engine Configuration.\n\n6. 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.\n\n7. 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 hop `igwn.gwalerts` topic and set it to the handler `tom_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 handler `tom_nonlocalizedevents.alertstream_handlers.gcn_event_handler.handle_message`. There is also a handler to handle retractions via the `handle_retraction` method in that package. For an example of what needs to be in your settings to configure `tom_alertstreams` for these streams, look [here](https://github.com/LCOGT/hermes/blob/dev/hermes_base/settings.py#L232)\n\n## Development\n\nWhen 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`.\n\n## Running the tests\n\nIn order to run the tests, run the following in your virtualenv:\n\n`python manage.py test`\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "Reusable TOMToolkit app to support gravitational wave superevent and other nonlocalized event EM follow-up observations.",
    "version": "0.7.7",
    "project_urls": {
        "Homepage": "https://github.com/TOMToolkit/tom_nonlocalizedevents",
        "Repository": "https://github.com/TOMToolkit/tom_nonlocalizedevents"
    },
    "split_keywords": [
        "tomtoolkit",
        "astronomy",
        "astrophysics",
        "cosmology",
        "science"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f0ab83d1b0daa31d4f0422238de13a71fc3315e08c0742bedeb3b73e7a4bf8c",
                "md5": "d9511c417584eef2109d70a9e1ee36e5",
                "sha256": "650ff323a8651ef93bde0c82afb0a09749cf29a0cbbb31cfa650f7bb00f4b5ad"
            },
            "downloads": -1,
            "filename": "tom_nonlocalizedevents-0.7.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9511c417584eef2109d70a9e1ee36e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.12",
            "size": 561275,
            "upload_time": "2023-06-19T18:44:13",
            "upload_time_iso_8601": "2023-06-19T18:44:13.484428Z",
            "url": "https://files.pythonhosted.org/packages/1f/0a/b83d1b0daa31d4f0422238de13a71fc3315e08c0742bedeb3b73e7a4bf8c/tom_nonlocalizedevents-0.7.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79f0740fd6c16165777d5902d6758fe41ec68b17784c11bfbc4c25afea848b1c",
                "md5": "4e3ad5769106bf48f810d5e78a4148f5",
                "sha256": "052362d34789f118f5c15740a9a12afb76693b002e20dfad0ef6287d0d9543f4"
            },
            "downloads": -1,
            "filename": "tom_nonlocalizedevents-0.7.7.tar.gz",
            "has_sig": false,
            "md5_digest": "4e3ad5769106bf48f810d5e78a4148f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.12",
            "size": 544630,
            "upload_time": "2023-06-19T18:44:15",
            "upload_time_iso_8601": "2023-06-19T18:44:15.313435Z",
            "url": "https://files.pythonhosted.org/packages/79/f0/740fd6c16165777d5902d6758fe41ec68b17784c11bfbc4c25afea848b1c/tom_nonlocalizedevents-0.7.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 18:44:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TOMToolkit",
    "github_project": "tom_nonlocalizedevents",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "tom-nonlocalizedevents"
}
        
Elapsed time: 0.07838s