Ejemplo n.º 1
0
def loaded_response():

    rsp = OGIPResponse(os.path.join(get_test_datasets_directory(),
                                    'bn090217206',
                                    'bn090217206_n6_weightedrsp.rsp'))

    return rsp
Ejemplo n.º 2
0
def loaded_response():

    rsp = OGIPResponse(
        os.path.join(get_test_datasets_directory(), 'bn090217206',
                     'bn090217206_n6_weightedrsp.rsp'))

    return rsp
Ejemplo n.º 3
0
import os

import numpy as np
import pytest
from conftest import get_test_datasets_directory
from threeML.io.file_utils import within_directory
from threeML.utils.time_interval import TimeIntervalSet
from threeML.utils.time_series.event_list import EventListWithDeadTime, EventList

__this_dir__ = os.path.join(os.path.abspath(os.path.dirname(__file__)))
datasets_dir = get_test_datasets_directory()


def is_within_tolerance(truth, value, relative_tolerance=0.01):
    assert truth != 0

    if abs((truth - value) / truth) <= relative_tolerance:

        return True

    else:

        return False


def test_event_list_constructor():
    dummy_times = np.linspace(0, 10, 10)
    dummy_energy = np.zeros_like(dummy_times)
    start = 0
    stop = 10
Ejemplo n.º 4
0
import os

import numpy as np
import pytest
from conftest import get_test_datasets_directory
from threeML.io.file_utils import within_directory
from threeML.utils.time_interval import TimeIntervalSet
from threeML.utils.time_series.event_list import EventListWithDeadTime, EventList

__this_dir__ = os.path.join(os.path.abspath(os.path.dirname(__file__)))
datasets_dir = get_test_datasets_directory()

def is_within_tolerance(truth, value, relative_tolerance=0.01):
    assert truth != 0

    if abs((truth - value) / truth) <= relative_tolerance:

        return True

    else:

        return False


def test_event_list_constructor():
    dummy_times = np.linspace(0, 10, 10)
    dummy_energy = np.zeros_like(dummy_times)
    start = 0
    stop = 10

    evt_list = EventList(arrival_times=dummy_times,
Ejemplo n.º 5
0
import pytest
from conftest import get_test_datasets_directory
from threeML import *
from threeML.io.file_utils import within_directory
from threeML.plugins.OGIPLike import OGIPLike
from threeML.plugins.SwiftXRTLike import SwiftXRTLike
from threeML.utils.OGIP.response import OGIPResponse
from threeML.utils.spectrum.pha_spectrum import PHASpectrum
from threeML.utils.statistics.likelihood_functions import *

__this_dir__ = os.path.join(os.path.abspath(os.path.dirname(__file__)))
__example_dir = get_test_datasets_directory()


class AnalysisBuilder(object):
    def __init__(self, plugin):
        self._plugin = plugin

        self._shapes = {}
        self._shapes['normal'] = Powerlaw
        self._shapes['cpl'] = Cutoff_powerlaw

    @property
    def keys(self):
        return self._shapes.keys()

    def get_jl(self, key):
        assert key in self._shapes

        data_list = DataList(self._plugin)