Skip to content

Commit

Permalink
feat(Documentation): Added "Configuring Your Observatory" to the README
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
  • Loading branch information
tabbott36 committed Oct 29, 2024
1 parent dbc169e commit 44a617d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ docker compose build
```
Note: MongoDB is set to run at port 27017 by default. Ensure nothing is running at this port, or, choose another port by changing the SANIC_MONGODB_PORT variable in the docker-compose.yaml file (and the corresponding ports in the mongo configuration).

# Configuring Your Observatory
To ensure the interface between the `frb-voe` server and the host observatory are as seemless as possible, HTTP requests are used. To initiate an FRB VOEvent, the host observatory must send a request to the `frb-voe` server containing basic FRB metadata. An example of such a request as well as a template script to send the request can be found in the `examples` directory.

# Getting Started

Expand Down
64 changes: 53 additions & 11 deletions examples/send_voe.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import logging

import requests

# Define any parameters you want to send along with the request (if any)
payload = {
detection_example_payload = {
"kind": "detection",
"date": "2025-01-13 16:55:08.844845",
"email": "[email protected]",
Expand All @@ -12,7 +16,33 @@
"bits_per_sample": 2,
"gain": 1.76,
"tsys": 25.0,
"internal_id": "20210826A",
"internal_id": "38249195",
"dm": 298.53,
"dm_error": 0.01,
"width": 4.8,
"snr": 13.8,
"flux": 4.9,
"right_ascension": 55.2938,
"declination": 14.2049,
"pos_error_deg_95": 0.1,
"importance": 0.9979,
"website": "https://www.observatory.com",
}

subsequent_example_payload = {
"kind": "subsequent",
"date": "2025-01-13 16:55:08.844845",
"email": "[email protected]",
"semi_major": 0.026,
"semi_minor": 0.013,
"sampling_time": 0.001,
"bandwidth": 400,
"central_frequency": 600,
"npol": 2,
"bits_per_sample": 2,
"gain": 1.76,
"tsys": 25.0,
"internal_id": "38249195",
"dm": 298.53,
"dm_error": 0.01,
"width": 4.8,
Expand All @@ -22,32 +52,44 @@
"declination": 14.2049,
"pos_error_deg_95": 0.1,
"importance": 0.9979,
"website": "https://www.example.com",
"website": "https://www.observatory.com",
"tns_name": "FRB20210826A",
"update_message": "",
}

import requests
import logging
update_example_payload = {
"kind": "update",
"date": "2025-01-13 16:55:08.844845",
"email": "[email protected]",
"internal_id": "38249195",
"tns_name": "FRB20210826A",
"update_message": "Enter update message here.",
}

update_example_payload = {
"kind": "retraction",
"date": "2025-01-13 16:55:08.844845",
"email": "[email protected]",
"internal_id": "38249195",
}

# Enable logging
logging.basicConfig(level=logging.DEBUG)

# Define the IP address you want to send the request to
ip_address = '142.157.211.4:8000'
ip_address = "142.157.211.4:8000"
# Define the endpoint or URL path
endpoint = '/voe'
endpoint = "/voe"

# Construct the full URL
url = f'http://{ip_address}{endpoint}'
url = f"http://{ip_address}{endpoint}"

# Send a POST request
response = requests.post(url, data=payload)
response = requests.post(url, data=detection_example_payload)

# Check if the request was successful (status code 200)
if response.status_code == 200:
# Print the response content
print("It worked!", response.text)
else:
# Print an error message
print(f"Error: {response.status_code}")
print(f"Error: {response.status_code}")

0 comments on commit 44a617d

Please sign in to comment.