# Path: condor/utils/log.py
# def log(logger, message, lvl, exception=None, rollback=1):
# def log_execution_time(logger):
#     def st_time(func):
#         def st_func(*args, **keyArgs):


import sys, os, numpy
import logging
import condor
import condor._load_data
from scipy import constants
from condor.utils.log import log_and_raise_error,log_warning,log_info,log_debug
        electron_density = Q*self.massdensity/M
        
        return electron_density


def get_f_element(element, photon_energy_eV):
    r"""
    Get the scattering factor for an element through linear interpolation of the tabulated values (Henke tables)

    Args:
      :element (str): Atomic species (e.g. ``'H'`` for hydrogen)

      :photon_energy_eV: Photon energy in unit eV
    """
    
    SF_X = get_atomic_scattering_factors(element)
    f1 = numpy.interp(photon_energy_eV,SF_X[:,0],SF_X[:,1])
    f2 = numpy.interp(photon_energy_eV,SF_X[:,0],SF_X[:,2])

    return complex(f1,f2)


class MaterialMap:
    def __init__(self, shape):
        if len(shape) != 3:
            log_and_raise_error(logger, "%s is an invald shape for initialisation of MaterialMap.", str(shape))
        self._shape = tuple(shape)

    def add_material(self, material, density_map):
        if not isinstance(material, Material):

# Path: condor/utils/log.py
# def log(logger, message, lvl, exception=None, rollback=1):
# def log_execution_time(logger):
#     def st_time(func):
#         def st_func(*args, **keyArgs):


# Path: condor/utils/material.py
import sys, os, numpy
import logging
import condor
import condor._load_data
from scipy import constants
from condor.utils.log import log_and_raise_error,log_warning,log_info,log_debug

        electron_density = Q*self.massdensity/M
        
        return electron_density


def get_f_element(element, photon_energy_eV):
    r"""
    Get the scattering factor for an element through linear interpolation of the tabulated values (Henke tables)

    Args:
      :element (str): Atomic species (e.g. ``'H'`` for hydrogen)

      :photon_energy_eV: Photon energy in unit eV
    """
    
    SF_X = get_atomic_scattering_factors(element)
    f1 = numpy.interp(photon_energy_eV,SF_X[:,0],SF_X[:,1])
    f2 = numpy.interp(photon_energy_eV,SF_X[:,0],SF_X[:,2])

    return complex(f1,f2)


class MaterialMap:
    def __init__(self, shape):
        if len(shape) != 3:
            log_and_raise_error(logger, "%s is an invald shape for initialisation of MaterialMap.", str(shape))
        self._shape = tuple(shape)

    def add_material(self, material, density_map):
        if not isinstance(material, Material):

            log_and_raise_error(logger, "Cannot add material %s. It is not an instance of Material." % str(material))