# Path: utility/constants.py
# class Constants:
#     def __init__(self):
#         try:
#             import imas
#             self.__setup_imas_constants_db()
#         except ImportError:
#             self.__setup_standalone_constants_db()
# 
#     def __setup_standalone_constants_db(self):
#         self.charge_electron = c.elementary_charge
#         self.speed_of_light = c.speed_of_light
#         self.Boltzmann = c.Boltzmann
# 
#     def __setup_imas_constants_db(self):
#         pass


import numpy
import pandas
import utility.getdata as ut
import math
from utility.constants import Constants
from numpy.random import RandomState
from lxml import etree
        self.signals = ut.GetData(data_path_name=path, data_format="array").data


class Noise(RandomState):
    def __init__(self, seed=None):
        RandomState.__init__(self, seed)
        self.constants = Constants()

    @staticmethod
    def signal_length(signal):
        return signal.size

    @staticmethod
    def _photon_flux_to_photon_number(signal, sampling_frequency):
        return signal / sampling_frequency

    @staticmethod
    def background_addition(signal, signal_to_background):
        return signal + signal.mean() / signal_to_background

    def generate_photon_noise(self, signal):
        return self.poisson(signal)

    def generate_gaussian_noise(self, signal, snr):
        average = signal.avg()
        noised_signal = self.normal(signal, average/snr)
        return noised_signal

    def _shot_noise_setup(self, signal, load_resistance, bandwidth, amplification,
                          noise_amplification, quantum_efficiency, sampling_frequency):

# Path: utility/constants.py
# class Constants:
#     def __init__(self):
#         try:
#             import imas
#             self.__setup_imas_constants_db()
#         except ImportError:
#             self.__setup_standalone_constants_db()
# 
#     def __setup_standalone_constants_db(self):
#         self.charge_electron = c.elementary_charge
#         self.speed_of_light = c.speed_of_light
#         self.Boltzmann = c.Boltzmann
# 
#     def __setup_imas_constants_db(self):
#         pass


# Path: observation/noise.py
import numpy
import pandas
import utility.getdata as ut
import math
from utility.constants import Constants
from numpy.random import RandomState
from lxml import etree

        self.signals = ut.GetData(data_path_name=path, data_format="array").data


class Noise(RandomState):
    def __init__(self, seed=None):
        RandomState.__init__(self, seed)
        self.constants = Constants()

    @staticmethod
    def signal_length(signal):
        return signal.size

    @staticmethod
    def _photon_flux_to_photon_number(signal, sampling_frequency):
        return signal / sampling_frequency

    @staticmethod
    def background_addition(signal, signal_to_background):
        return signal + signal.mean() / signal_to_background

    def generate_photon_noise(self, signal):
        return self.poisson(signal)

    def generate_gaussian_noise(self, signal, snr):
        average = signal.avg()
        noised_signal = self.normal(signal, average/snr)
        return noised_signal

    def _shot_noise_setup(self, signal, load_resistance, bandwidth, amplification,
                          noise_amplification, quantum_efficiency, sampling_frequency):

        mean = signal * self.constants.charge_electron * amplification * quantum_efficiency * load_resistance * \