# 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: utility/getdata.py
# DEFAULT_SETUP = 'getdata_setup.xml'
# class GetData(AccessData):
#     def __init__(self,
#                  data_path_name=None,
#                  data_key=[],
#                  data_format="pandas"):
#     def read_data(self):
#     def read_h5_to_pandas(self):
#     def read_h5_to_array(self):
#     def read_txt_to_str(self):
#     def read_txt_to_array(self):
#     def read_xml(self):
#     def get_data(self):
#     def download_private_data(self):
#     def download_public_data(self):
#     def ensure_dir(file_path):


from lxml import etree
from utility.constants import Constants
from utility import getdata
import pandas
import numpy
import warnings




class Obs1d:
    def __init__(self, beamlet, data_path, from_level=None, to_level=None):
        self.beamlet = beamlet
        self.constants = Constants()
        self.obs_param = self.read_observation_param(data_path)
        self.obs_profile = self.read_observation_profile(data_path=self.obs_param.getroot().find('body').find(
            'observation_profile_path').text)
        self.detector_size = float(self.obs_param.getroot().find('body').find('detector_size').text)
        if (max([self.obs_profile[0][i+1]-self.obs_profile[0][i] for i in range(self.obs_profile[0].size-1)]) >
                min([self.beamlet.profiles['beamlet grid']['distance']['m'][j + 1] -
                 self.beamlet.profiles['beamlet grid']['distance']['m'][j] for j in range(
                self.beamlet.profiles['beamlet grid']['distance']['m'].size - 1)])):

# 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: utility/getdata.py
# DEFAULT_SETUP = 'getdata_setup.xml'
# class GetData(AccessData):
#     def __init__(self,
#                  data_path_name=None,
#                  data_key=[],
#                  data_format="pandas"):
#     def read_data(self):
#     def read_h5_to_pandas(self):
#     def read_h5_to_array(self):
#     def read_txt_to_str(self):
#     def read_txt_to_array(self):
#     def read_xml(self):
#     def get_data(self):
#     def download_private_data(self):
#     def download_public_data(self):
#     def ensure_dir(file_path):


# Path: observation/observation.py
from lxml import etree
from utility.constants import Constants
from utility import getdata
import pandas
import numpy
import warnings




class Obs1d:
    def __init__(self, beamlet, data_path, from_level=None, to_level=None):
        self.beamlet = beamlet
        self.constants = Constants()
        self.obs_param = self.read_observation_param(data_path)
        self.obs_profile = self.read_observation_profile(data_path=self.obs_param.getroot().find('body').find(
            'observation_profile_path').text)
        self.detector_size = float(self.obs_param.getroot().find('body').find('detector_size').text)
        if (max([self.obs_profile[0][i+1]-self.obs_profile[0][i] for i in range(self.obs_profile[0].size-1)]) >
                min([self.beamlet.profiles['beamlet grid']['distance']['m'][j + 1] -
                 self.beamlet.profiles['beamlet grid']['distance']['m'][j] for j in range(
                self.beamlet.profiles['beamlet grid']['distance']['m'].size - 1)])):

            warnings.warn('Use finer grid or call calculate_photon_emission_profile() with input \'interpolate=True\'.')
