# 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
import numpy
import logging
import condor
import condor.utils.log
import condor.utils.spheroid_diffraction
import condor.utils.diffraction
import condor.utils.bodies
import condor.utils.emdio
        import h5py
from condor.utils.log import log_and_raise_error,log_warning,log_info,log_debug
from condor.utils.variation import Variation
from .particle_abstract import AbstractContinuousParticle
                n_mat = len(self.materials)
                
                if O["geometry"] == "icosahedron":
                    m_tmp = self._get_map_icosahedron(O["diameter"]/2., dx)

                elif O["geometry"] == "spheroid":
                    a = condor.utils.spheroid_diffraction.to_spheroid_semi_diameter_a(O["diameter"],O["flattening"])
                    c = condor.utils.spheroid_diffraction.to_spheroid_semi_diameter_c(O["diameter"],O["flattening"])
                    m_tmp = self._get_map_spheroid(a, c, dx)

                elif O["geometry"] == "sphere":
                    m_tmp = self._get_map_sphere(O["diameter"]/2., dx)

                elif O["geometry"] == "cube":
                    m_tmp = self._get_map_cube(O["diameter"], dx)

                else:
                    log_and_raise_error(logger, "Particle map geometry \"%s\" is not implemented. Change your configuration and try again." % O["geometry"])
                    sys.exit(1)

                m = numpy.array(n_mat * [m_tmp])
                    
                self._set_cache(map3d=m,
                                dx=dx,
                                geometry=O["geometry"],
                                diameter=O["diameter"],
                                flattening=(None if O["geometry"] != "spheroid" else O["flattening"]))

            else:


# 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/particle/particle_map.py
import sys
import numpy
import logging
import condor
import condor.utils.log
import condor.utils.spheroid_diffraction
import condor.utils.diffraction
import condor.utils.bodies
import condor.utils.emdio
        import h5py
from condor.utils.log import log_and_raise_error,log_warning,log_info,log_debug
from condor.utils.variation import Variation
from .particle_abstract import AbstractContinuousParticle

                n_mat = len(self.materials)
                
                if O["geometry"] == "icosahedron":
                    m_tmp = self._get_map_icosahedron(O["diameter"]/2., dx)

                elif O["geometry"] == "spheroid":
                    a = condor.utils.spheroid_diffraction.to_spheroid_semi_diameter_a(O["diameter"],O["flattening"])
                    c = condor.utils.spheroid_diffraction.to_spheroid_semi_diameter_c(O["diameter"],O["flattening"])
                    m_tmp = self._get_map_spheroid(a, c, dx)

                elif O["geometry"] == "sphere":
                    m_tmp = self._get_map_sphere(O["diameter"]/2., dx)

                elif O["geometry"] == "cube":
                    m_tmp = self._get_map_cube(O["diameter"], dx)

                else:
                    log_and_raise_error(logger, "Particle map geometry \"%s\" is not implemented. Change your configuration and try again." % O["geometry"])
                    sys.exit(1)

                m = numpy.array(n_mat * [m_tmp])
                    
                self._set_cache(map3d=m,
                                dx=dx,
                                geometry=O["geometry"],
                                diameter=O["diameter"],
                                flattening=(None if O["geometry"] != "spheroid" else O["flattening"]))

            else:


                log_debug(logger, "No need for calculating a new map. Reading map from cache.")