-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/hermes support #25
Changes from 4 commits
da7a47c
882e591
4a333d2
7af3841
60fbe22
7b472c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,15 @@ TOMtoolkit module for reporting transients to the TNS | |
] | ||
``` | ||
|
||
3. Add your TNS credentials to your `settings.py` if they don't already exist for the TNS Broker. | ||
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. | ||
|
||
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. | ||
|
||
```python | ||
BROKERS = { | ||
|
@@ -33,18 +36,62 @@ won't show up until after the next update. | |
'api_key': os.getenv('TNS_API_KEY', ''), # This is the API key for the associated BOT | ||
'tns_base_url': 'https://sandbox.wis-tns.org/api', # This is the sandbox URL. Use https://www.wis-tns.org/api 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. | ||
'default_authors': 'Foo Bar <[email protected]>' # Optional default authors string to populate the author fields for tns submission. If not specified, defaults to saying "<logged in user> using <tom name>". | ||
}, | ||
} | ||
``` | ||
|
||
5. Include the tom_tns URLconf in your project `urls.py`: | ||
### 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': 'String of default author list for your submissions heres', # 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. | ||
'FILTER_MAPPING': { | ||
'o': 'Other', | ||
'c': 'Clear', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't really important, but the o and c bands are from the atlas survey and stand for orange and cyan respectively. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of this readme is just to show an example setting... users should tailor it to their own data sources and mapping. But if there is a better example mapping you want me to put here please let me know (Cyan/Orange aren't tns filter names I think). |
||
... | ||
}, # Optional mapping from your reduced datum filter values to TNS filter options. | ||
'ENABLE_TNS': False # Set to True to enable TNS submissions through Hermes | ||
}, | ||
} | ||
``` | ||
|
||
|
||
4. Include the tom_tns URLconf in your project `urls.py`: | ||
```python | ||
urlpatterns = [ | ||
... | ||
path('tns/', include('tom_tns.urls', namespace='tns')), | ||
] | ||
``` | ||
|
||
Once configured, a `TNS` button should appear below the Target Name. | ||
Once configured, a `TNS` button should appear below the Target Name on the default Target Detail page. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a good solution for now. Ultimately, we want to get away from forcing users to modify their templates to benefit from our apps. (See TOMToolkit/tom_base#745) Adding a connection point to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I saw that was used for the TNS button here. Seems nice, but will be a lot of work to add them everywhere that might make sense (anywhere with the target, datums, or dataproducts) |
||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a second author to the example?
Something like 'Foo Bar [email protected], Rando Calrissian, et al.'