Name | tom-tns JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | TOMtoolkit module for reporting transients to the TNS |
upload_time | 2025-02-14 23:10:50 |
maintainer | None |
docs_url | None |
author | Joseph Chatelain |
requires_python | <3.13,>=3.9 |
license | GPL-3.0-or-later |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Transient Name Server (TNS) Report and Classification plugin for TOM Toolkit
TOMtoolkit module for reporting transients to the TNS
## Installation
1. Install the package into your TOM environment:
```bash
pip install tom-tns
```
2. In your project `settings.py`, add `tom_tns` to your `INSTALLED_APPS` setting:
```python
INSTALLED_APPS = [
...
'tom_tns',
]
```
3. Add TNS or Hermes account credentials to your `settings.py` to enable different methods of sharing.
If you don't have access to a TNS Bot for your TOM, you can make one from the [TNS website](https://www.wis-tns.org/bots).
NOTE: If you are testing on the sandbox, the sandbox is only synced every Sunday, so new bots created using the above link won't show up until after the next update.
### Submit to TNS directly (no hermes)
Add your TNS credentials to your `settings.py` if they don't already exist for the TNS Broker.
```python
BROKERS = {
...
'TNS': {
'bot_id': os.getenv('TNS_BOT_ID', ''), # This is the BOT ID you plan to use to submit to TNS
'bot_name': os.getenv('TNS_BOT_NAME', ''), # This is the BOT name associated with the above ID
'api_key': os.getenv('TNS_API_KEY', ''), # This is the API key for the associated BOT
'tns_base_url': 'https://sandbox.wis-tns.org/', # This is the sandbox URL. Use https://www.wis-tns.org/ for live submission.
'group_names': ['bot_group', 'PI_group'], # Optional List. Include if you wish to use any affiliated Group Names when reporting.
'filter_mapping': {
'o': 'Other',
'c': 'Clear',
...
}, # Optional mapping from your reduced datum filter values to TNS filter options.
'instrument_mapping': {
'fa20': 'LCO1m - Sinistro',
...
}, # Optional mapping from your reduced datum instrument name to TNS instrument names
'default_authors': 'Foo Bar <foo@bar.com>, Rando Calrissian, et al.' # Optional default authors string to populate the author fields for tns submission. If not specified, defaults to saying "<logged in user> using <tom name>".
},
}
```
### Submit to TNS through Hermes
If you want to submit to the TNS through [HERMES](https://hermes.lco.global), then you must first configure your [hermes account profile](https://hermes.lco.global/profile) to have your TNS credentials associated with your account. Then you must add your hermes credentials you `settings.py` in the `DATA_SHARING` section. This method of TNS submission will take precedence if `ENABLE_TNS` is set to True in your hermes `DATA_SHARING` details.
NOTE: If you don't set TNS credentials in your hermes account profile, TNS submission will still work but use the default Hermes_Bot account for TNS submission.
```python
DATA_SHARING = {
...
'hermes': {
'DISPLAY_NAME': 'hermes',
'BASE_URL': 'https://hermes-dev.lco.global/',
'HERMES_API_KEY': 'YourHermesAPITokenHere',
'DEFAULT_AUTHORS': 'Foo Bar <foo@bar.com>, Rando Calrissian, et al.', # Optional default authors string to populate the author fields for tns submission. If not specified, defaults to saying "<logged in user> using <tom name>".
'USER_TOPICS': ['hermes.discovery', 'hermes.classification', ...] # This is a list of hermes topics you will be allowed to share on. hermes.discovery and hermes.classification are automatically used for TNS submissions of those types.
'TNS_GROUP_NAMES': ['bot_group', 'PI_group'], # Optional List. Include if you wish to use any affiliated Group Names when reporting to TNS.
'DATA_CONVERTER_CLASS': 'tom_dataproducts.alertstreams.hermes.HermesDataConverter', # Optional classpath to custom implementation of HermesDataConverter class, which is used to prefill TNS submission form fields with values stored in your TOM for your ReducedDatums.
'FILTER_MAPPING': {
'o': 'Other',
'c': 'Clear',
...
}, # Optional mapping from your reduced datum filter values to TNS filter options.
'INSTRUMENT_MAPPING': {
'fa20': 'LCO1m - Sinistro',
...
}, # Optional mapping from your reduced datum instrument name to TNS instrument names
'ENABLE_TNS': False # Set to True to enable TNS submissions through Hermes
},
}
```
4. Include the tom_tns URLconf in your project `urls.py` if you are using a tomtoolkit version <= 2.18:
```python
urlpatterns = [
...
path('tns/', include('tom_tns.urls', namespace='tns')),
]
```
Once configured, a `TNS` button should appear below the Target Name on the default Target Detail page.
If you have customized the Target Details page of your TOM, or if you would like to add entrypoints to the tom_tns form from other TOM pages, including those referencing a specific data product or reduced datum's values, then you can do that by including the code below somewhere in your templates:
```html
<a href="{% url 'tns:report-tns' pk=target.id datum_pk=datum.pk %}" title=TNS class="btn btn-info">Submit to TNS</a>
```
The datum_pk is optional. If it is not specified, the latest photometry reduced datum will be used to pre-fill the discovery report form, and the latest spectroscopy reduced datum will be used to pre-fill the classification report form. If you specifiy a datum pk, then that datum and associated data product will be used to pre-fill the proper forms.
For example, if you want to add a link next to each data product to submit it to TNS, then you could just use the dataproducts first datum id for the `datum_pk`.
NOTE: Users who are using `tomtoolkit<2.15.12` will have to add the TNS button manually.
Raw data
{
"_id": null,
"home_page": null,
"name": "tom-tns",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Joseph Chatelain",
"author_email": "jchatelain@lco.global",
"download_url": "https://files.pythonhosted.org/packages/96/42/b80906312b436ea76b595901409f787e81fb23fdcc9751ea149f2342a07a/tom_tns-0.3.1.tar.gz",
"platform": null,
"description": "# Transient Name Server (TNS) Report and Classification plugin for TOM Toolkit\nTOMtoolkit module for reporting transients to the TNS \n\n## Installation\n\n1. Install the package into your TOM environment:\n ```bash\n pip install tom-tns\n ```\n\n2. In your project `settings.py`, add `tom_tns` to your `INSTALLED_APPS` setting:\n\n ```python\n INSTALLED_APPS = [\n ...\n 'tom_tns',\n ]\n ```\n\n3. Add TNS or Hermes account credentials to your `settings.py` to enable different methods of sharing.\n \n If you don't have access to a TNS Bot for your TOM, you can make one from the [TNS website](https://www.wis-tns.org/bots).\n\n NOTE: If you are testing on the sandbox, the sandbox is only synced every Sunday, so new bots created using the above link won't show up until after the next update.\n\n ### Submit to TNS directly (no hermes)\n Add your TNS credentials to your `settings.py` if they don't already exist for the TNS Broker.\n \n\n ```python\n BROKERS = {\n ...\n 'TNS': {\n 'bot_id': os.getenv('TNS_BOT_ID', ''), # This is the BOT ID you plan to use to submit to TNS\n 'bot_name': os.getenv('TNS_BOT_NAME', ''), # This is the BOT name associated with the above ID\n 'api_key': os.getenv('TNS_API_KEY', ''), # This is the API key for the associated BOT \n 'tns_base_url': 'https://sandbox.wis-tns.org/', # This is the sandbox URL. Use https://www.wis-tns.org/ for live submission.\n 'group_names': ['bot_group', 'PI_group'], # Optional List. Include if you wish to use any affiliated Group Names when reporting.\n 'filter_mapping': {\n 'o': 'Other',\n 'c': 'Clear',\n ...\n }, # Optional mapping from your reduced datum filter values to TNS filter options.\n 'instrument_mapping': {\n 'fa20': 'LCO1m - Sinistro',\n ...\n }, # Optional mapping from your reduced datum instrument name to TNS instrument names\n 'default_authors': 'Foo Bar <foo@bar.com>, Rando Calrissian, et al.' # Optional default authors string to populate the author fields for tns submission. If not specified, defaults to saying \"<logged in user> using <tom name>\".\n },\n }\n ```\n\n ### Submit to TNS through Hermes\n If you want to submit to the TNS through [HERMES](https://hermes.lco.global), then you must first configure your [hermes account profile](https://hermes.lco.global/profile) to have your TNS credentials associated with your account. Then you must add your hermes credentials you `settings.py` in the `DATA_SHARING` section. This method of TNS submission will take precedence if `ENABLE_TNS` is set to True in your hermes `DATA_SHARING` details.\n\n NOTE: If you don't set TNS credentials in your hermes account profile, TNS submission will still work but use the default Hermes_Bot account for TNS submission.\n\n\n ```python\n DATA_SHARING = {\n ...\n 'hermes': {\n 'DISPLAY_NAME': 'hermes',\n 'BASE_URL': 'https://hermes-dev.lco.global/',\n 'HERMES_API_KEY': 'YourHermesAPITokenHere',\n 'DEFAULT_AUTHORS': 'Foo Bar <foo@bar.com>, Rando Calrissian, et al.', # Optional default authors string to populate the author fields for tns submission. If not specified, defaults to saying \"<logged in user> using <tom name>\".\n 'USER_TOPICS': ['hermes.discovery', 'hermes.classification', ...] # This is a list of hermes topics you will be allowed to share on. hermes.discovery and hermes.classification are automatically used for TNS submissions of those types.\n 'TNS_GROUP_NAMES': ['bot_group', 'PI_group'], # Optional List. Include if you wish to use any affiliated Group Names when reporting to TNS.\n 'DATA_CONVERTER_CLASS': 'tom_dataproducts.alertstreams.hermes.HermesDataConverter', # Optional classpath to custom implementation of HermesDataConverter class, which is used to prefill TNS submission form fields with values stored in your TOM for your ReducedDatums.\n 'FILTER_MAPPING': {\n 'o': 'Other',\n 'c': 'Clear',\n ...\n }, # Optional mapping from your reduced datum filter values to TNS filter options.\n 'INSTRUMENT_MAPPING': {\n 'fa20': 'LCO1m - Sinistro',\n ...\n }, # Optional mapping from your reduced datum instrument name to TNS instrument names\n 'ENABLE_TNS': False # Set to True to enable TNS submissions through Hermes\n },\n }\n ```\n\n\n4. Include the tom_tns URLconf in your project `urls.py` if you are using a tomtoolkit version <= 2.18:\n ```python\n urlpatterns = [\n ...\n path('tns/', include('tom_tns.urls', namespace='tns')),\n ]\n ```\n\nOnce configured, a `TNS` button should appear below the Target Name on the default Target Detail page.\n\nIf you have customized the Target Details page of your TOM, or if you would like to add entrypoints to the tom_tns form from other TOM pages, including those referencing a specific data product or reduced datum's values, then you can do that by including the code below somewhere in your templates:\n\n```html\n <a href=\"{% url 'tns:report-tns' pk=target.id datum_pk=datum.pk %}\" title=TNS class=\"btn btn-info\">Submit to TNS</a>\n```\n\nThe datum_pk is optional. If it is not specified, the latest photometry reduced datum will be used to pre-fill the discovery report form, and the latest spectroscopy reduced datum will be used to pre-fill the classification report form. If you specifiy a datum pk, then that datum and associated data product will be used to pre-fill the proper forms.\n\nFor example, if you want to add a link next to each data product to submit it to TNS, then you could just use the dataproducts first datum id for the `datum_pk`.\n\n\nNOTE: Users who are using `tomtoolkit<2.15.12` will have to add the TNS button manually.\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "TOMtoolkit module for reporting transients to the TNS",
"version": "0.3.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "82429fa4552af49cb4de5d0f9e4b90be455f36c30175cd67da0f88834b852afa",
"md5": "32ccf6de7d0e2458e81a001dfa787341",
"sha256": "bd3954ac8dbdbcb44baf1a78401ace624f85a4025490e9f922a80bde4051f66e"
},
"downloads": -1,
"filename": "tom_tns-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "32ccf6de7d0e2458e81a001dfa787341",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 35230,
"upload_time": "2025-02-14T23:10:49",
"upload_time_iso_8601": "2025-02-14T23:10:49.722669Z",
"url": "https://files.pythonhosted.org/packages/82/42/9fa4552af49cb4de5d0f9e4b90be455f36c30175cd67da0f88834b852afa/tom_tns-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9642b80906312b436ea76b595901409f787e81fb23fdcc9751ea149f2342a07a",
"md5": "576952c338626d68c9d9df25f175b344",
"sha256": "c6f4c9ec14500bc6fa92f3e264c76cb1477a400be00870ade0f8032776d2503d"
},
"downloads": -1,
"filename": "tom_tns-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "576952c338626d68c9d9df25f175b344",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 31722,
"upload_time": "2025-02-14T23:10:50",
"upload_time_iso_8601": "2025-02-14T23:10:50.917247Z",
"url": "https://files.pythonhosted.org/packages/96/42/b80906312b436ea76b595901409f787e81fb23fdcc9751ea149f2342a07a/tom_tns-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-14 23:10:50",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tom-tns"
}