# 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 pandas
import h5py
import os
import utility
import math
import numpy as np
from utility.constants import Constants
    h5file.close()
    os.rename(os.path.join(os.path.dirname(__file__),'..', data_path_name),
              os.path.join(os.path.dirname(__file__),'..', data_path_name +'.old'))
    pandas_profiles.to_hdf(data_path_name)


def convert_from_cm2_to_m2(cross_section):
        return cross_section / 1.e4


def convert_from_cm_to_m(length):
        return length / 1.e2


def convert_from_10_19_to_1(density):
    return density * 1.e19


def convert_beamlet_profiles_to_si(data_path_name='beamlet/test_profiles.h5'):
    pandas_profiles = utility.getdata.GetData(data_path_name=data_path_name).data
    assert isinstance(pandas_profiles, pandas.DataFrame)
    full_data_path_name = os.path.join('data/', data_path_name)
    pandas_profiles['beamlet_density'] = convert_from_10_19_to_1(pandas_profiles['beamlet_density'])
    os.rename(os.path.join(os.path.dirname(__file__),'..', full_data_path_name),
              os.path.join(os.path.dirname(__file__), '..', full_data_path_name + '.non-si'))
    pandas_profiles.to_hdf(os.path.join(os.path.dirname(__file__),'..', full_data_path_name), 'profiles')
    print('Beamlet.param converted to SI in file: ' + full_data_path_name)


def calculate_velocity_from_energy(energy, mass):

# 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/convert.py
import pandas
import h5py
import os
import utility
import math
import numpy as np
from utility.constants import Constants

    h5file.close()
    os.rename(os.path.join(os.path.dirname(__file__),'..', data_path_name),
              os.path.join(os.path.dirname(__file__),'..', data_path_name +'.old'))
    pandas_profiles.to_hdf(data_path_name)


def convert_from_cm2_to_m2(cross_section):
        return cross_section / 1.e4


def convert_from_cm_to_m(length):
        return length / 1.e2


def convert_from_10_19_to_1(density):
    return density * 1.e19


def convert_beamlet_profiles_to_si(data_path_name='beamlet/test_profiles.h5'):
    pandas_profiles = utility.getdata.GetData(data_path_name=data_path_name).data
    assert isinstance(pandas_profiles, pandas.DataFrame)
    full_data_path_name = os.path.join('data/', data_path_name)
    pandas_profiles['beamlet_density'] = convert_from_10_19_to_1(pandas_profiles['beamlet_density'])
    os.rename(os.path.join(os.path.dirname(__file__),'..', full_data_path_name),
              os.path.join(os.path.dirname(__file__), '..', full_data_path_name + '.non-si'))
    pandas_profiles.to_hdf(os.path.join(os.path.dirname(__file__),'..', full_data_path_name), 'profiles')
    print('Beamlet.param converted to SI in file: ' + full_data_path_name)


def calculate_velocity_from_energy(energy, mass):

    constants = Constants()