Пример #1
0
    def _convert_detectors(self, options):
        if not _Converter._convert_detectors(self, options):
            return False

        for _key, det in options.detectors.iterclass(PhiZDetector):
            if det.channels != 128:
                self._warn("Number of channels of phi-rho-z detector set to 128")

        return True
    def _convert_geometry(self, options):
        if not _Converter._convert_geometry(self, options):
            return False

        if options.geometry.tilt_rad != 0.0:
            self._warn("Geometry tilt is not supported.", "This options definition was removed.")
            return False

        return True
    def _convert_limits(self, options):
        if not _Converter._convert_limits(self, options):
            return False

        limits = list(options.limits.iterclass(ShowersLimit))
        if not limits:
            self._warn("A ShowersLimit must be defined.", "This options definition was removed.")
            return False

        return True
Пример #4
0
    def __init__(self, elastic_scattering=(0.0, 0.0),
                 cutoff_energy_inelastic=50.0,
                 cutoff_energy_bremsstrahlung=50.0,
                 interaction_forcings=None,
                 maximum_step_length_m=1e20):
        """
        Converter from base options to PENEPMA options.

        During the conversion, the materials are converted to :class:`PenelopeMaterial`.
        For this, the specified elastic scattering and cutoff energies are used
        as the default values in the conversion.
        """
        _Converter.__init__(self)

        self._elastic_scattering = elastic_scattering
        self._cutoff_energy_inelastic_eV = cutoff_energy_inelastic
        self._cutoff_energy_bremsstrahlung_eV = cutoff_energy_bremsstrahlung
        self._interaction_forcings = interaction_forcings or []
        self._maximum_step_length_m = maximum_step_length_m
Пример #5
0
    def _convert_limits(self, options):
        if not _Converter._convert_limits(self, options):
            return False

        limits = list(options.limits.iterclass(ShowersLimit))
        if not limits:
            self._warn("A ShowersLimit must be defined.",
                       "This options definition was removed.")
            return False

        return True
    def _convert_beam(self, options):
        if type(options.beam) is PencilBeam:
            old = options.beam
            options.beam = GaussianBeam(old.energy_eV, 0.0, old.particle,
                                        old.origin_m, old.direction,
                                        old.aperture_rad)

            self._warn("Pencil beam converted to Gaussian beam with 0 m diameter")

        if not _Converter._convert_beam(self, options):
            return False

        return True
Пример #7
0
    def _convert_beam(self, options):
        if type(options.beam) is PencilBeam:
            old = options.beam
            options.beam = GaussianBeam(old.energy_eV, 0.0, old.particle,
                                        old.origin_m, old.direction,
                                        old.aperture_rad)

            self._warn(
                "Pencil beam converted to Gaussian beam with 0 m diameter")

        if not _Converter._convert_beam(self, options):
            return False

        return True
Пример #8
0
    def _convert_beam(self, options):
        if not _Converter._convert_beam(self, options):
            return False

        if options.beam.energy_eV > 400e3:
            self._warn("Beam energy must be less than 400 keV.",
                       "This options definition was removed.")
            return False

        if options.beam.aperture_rad != 0.0:
            self._warn("Monaco does not support beam aperture.",
                       "This options definition was removed.")
            return False

        return True
Пример #9
0
    def _convert_geometry(self, options):
        if not _Converter._convert_geometry(self, options):
            return False

        if options.geometry.tilt_rad != 0.0:
            self._warn("Geometry cannot be tilted in Monaco, only the beam direction.",
                       "This options definition was removed.")
            return False

        for material in options.geometry.get_materials():
            if material.absorption_energy_eV[ELECTRON] < 200.0:
                material.absorption_energy_eV[ELECTRON] = 200.0
                self._warn('Electron absorption energy below limit.',
                           'Set to 200 eV')

        return True
Пример #10
0
    def _convert_geometry(self, options):
        # Replace material with PENLOPE material
        for old_material in options.geometry.get_materials():
            new_material = \
                PenelopeMaterial.from_material(old_material,
                                               self._elastic_scattering,
                                               self._cutoff_energy_inelastic_eV,
                                               self._cutoff_energy_bremsstrahlung_eV,
                                               self._interaction_forcings,
                                               self._maximum_step_length_m)
            replace_material(options, old_material, new_material)

        if not _Converter._convert_geometry(self, options):
            return False

        return True
Пример #11
0
    def _convert_beam(self, options):
        if type(options.beam) is PencilBeam:
            old = options.beam
            options.beam = GaussianBeam(old.energy_eV, 0.0, old.particle, old.origin_m, old.direction, old.aperture_rad)

            self._warn("Pencil beam converted to Gaussian beam with 0 m diameter")

        if not _Converter._convert_beam(self, options):
            return False

        if options.beam.energy_eV > 1e6:
            self._warn("Beam energy must be less than 1MeV", "This options definition was removed.")
            return False

        if options.beam.aperture_rad != 0.0:
            self._warn("Beam aperture is not supported." "This options definition was removed.")
            return False

        return True
Пример #12
0
    def _convert_beam(self, options):
        if not _Converter._convert_beam(self, options):
            return False

        if options.beam.energy_eV < 100:
            self._warn("Beam energy must be greater or equal to 100 eV",
                       "This options definition was removed.")
            return False

        if options.beam.origin_m == (0, 0, 1):
            options.beam.origin_m = (0, 0, 0.09)
            self._warn('Change origin position to fit inside NISTMonte microscope chamber')

        if any(map(lambda p: p >= 0.1, options.beam.origin_m)):
            self._warn("Origin must be within a sphere with radius of 0.1 m",
                       "This options definition was removed.")
            return False

        return True
Пример #13
0
    def _convert_beam(self, options):
        if not _Converter._convert_beam(self, options):
            return False

        if options.beam.energy_eV < 100:
            self._warn("Beam energy must be greater or equal to 100 eV",
                       "This options definition was removed.")
            return False

        if options.beam.origin_m == (0, 0, 1):
            options.beam.origin_m = (0, 0, 0.09)
            self._warn(
                'Change origin position to fit inside NISTMonte microscope chamber'
            )

        if any(map(lambda p: p >= 0.1, options.beam.origin_m)):
            self._warn("Origin must be within a sphere with radius of 0.1 m",
                       "This options definition was removed.")
            return False

        return True
Пример #14
0
    def _convert_beam(self, options):
        if type(options.beam) is PencilBeam:
            old = options.beam
            options.beam = GaussianBeam(old.energy_eV, 0.0, old.particle,
                                        old.origin_m, old.direction,
                                        old.aperture_rad)

            self._warn(
                "Pencil beam converted to Gaussian beam with 0 m diameter")

        if not _Converter._convert_beam(self, options):
            return False

        if options.beam.energy_eV > 1e6:
            self._warn("Beam energy must be less than 1MeV",
                       "This options definition was removed.")
            return False

        if options.beam.aperture_rad != 0.0:
            self._warn('Beam aperture is not supported.'
                       "This options definition was removed.")
            return False

        return True
Пример #15
0
    def __init__(self):
        _Converter.__init__(self)

        self._expander = OptionsExpanderSingleDetectorSameOpening(self.DETECTORS)
Пример #16
0
    def __init__(self):
        _Converter.__init__(self)

        self._expander = OptionsExpanderSingleDetectorSameOpening(
            self.DETECTORS)