Esempio n. 1
0
import os
import re
from datetime import datetime, timedelta
import xml.etree.ElementTree as ET
from lxml import etree
import luigi
import numpy as np
import yaml

from morgoth.utils.env import get_env_value
from morgoth.utils.file_utils import if_directory_not_existing_then_make

base_dir = get_env_value("GBM_TRIGGER_DATA_DIR")

_gbm_detectors = (
    "n0",
    "n1",
    "n2",
    "n3",
    "n4",
    "n5",
    "n6",
    "n7",
    "n8",
    "n9",
    "na",
    "nb",
    "b0",
    "b1",
)
Esempio n. 2
0
import json
import time

import requests

from morgoth.exceptions.custom_exceptions import (EmptyFileError, GRBNotFound,
                                                  UnauthorizedRequest,
                                                  UnexpectedStatusCode,
                                                  UploadFailed)
from morgoth.utils.env import get_env_value

base_dir = get_env_value("GBM_TRIGGER_DATA_DIR")
base_url = get_env_value("MORGOTH_BASE_URL")
auth_token = get_env_value("MORGOTH_AUTH_TOKEN")

model_lookup = {
    "pl": "powerlaw",
    "cpl": "cutoff_powerlaw",
    "band": "band_function"
}


def check_grb_on_website(grb_name):
    headers = {"Authorization": f"Token {auth_token}"}

    check_existing_url = f"{base_url}/api/check_grb_name/{grb_name}/"

    response = requests.get(url=check_existing_url,
                            headers=headers,
                            verify=False)