예제 #1
0
파일: exporter.py 프로젝트: xghui/winXray-1
    def _export_detectors(self, options, wxrops):
        # Deactivate all detectors
        wxrops.setXrayCompute(False)
        wxrops.setXrayComputeBackground(False)
        wxrops.setXrayComputeCharacteristic(False)

        wxrops.setComputeBSEDistribution(False)
        wxrops.setComputeBSEDepth(False)
        wxrops.setComputeBSERadial(False)
        wxrops.setComputeBSESpatial(False)
        wxrops.setComputeBSELateral(False)
        wxrops.setComputeBSEEnergy(False)
        wxrops.setComputeBSEAngular(False)

        wxrops.setComputeSEDistribution(False)

        wxrops.setComputeEnergyLossDistribution(False)
        wxrops.setComputeEnergyLossDepth(False)
        wxrops.setComputeEnergyLossLateral(False)
        wxrops.setComputeEnergyLossSpatial(False)
        wxrops.setComputeEnergyLossRadial(False)

        wxrops.setComputeElectronDistribution(False)
        wxrops.setComputeElectronDepth(False)
        wxrops.setComputeElectronRadial(False)
        wxrops.setComputeElectronSpatial(False)
        wxrops.setComputeElectronLateral(False)

        # Perform detector export
        _Exporter._export_detectors(self, options, wxrops)

        # Detector position
        dets = options.detectors.iterclass(_DelimitedDetector)
        dets = list(map(itemgetter(1), dets))

        if len(dets) >= 2:
            c = map(equivalent_opening, dets[:-1], dets[1:])
            if not all(c):
                raise ExporterException(
                    "Some delimited detectors do not have the same opening")

        if dets:
            toa_deg = math.degrees(dets[0].takeoffangle_rad)  # deg
            phi_deg = math.degrees(sum(dets[0].azimuth_rad) / 2.0)  # deg

            wxrops.setTOA_deg(toa_deg)
            wxrops.setAngleThetaDetector_deg(90.0 - toa_deg)
            wxrops.setAnglePhiDetector_deg(phi_deg)

            wxrops.setUserDefineSolidAngle(True)
            wxrops.setSolidAngle_sr(dets[0].solidangle_sr)
예제 #2
0
    def _export_detectors(self, options, wxrops):
        # Deactivate all detectors
        wxrops.setXrayCompute(False)
        wxrops.setXrayComputeBackground(False)
        wxrops.setXrayComputeCharacteristic(False)

        wxrops.setComputeBSEDistribution(False)
        wxrops.setComputeBSEDepth(False)
        wxrops.setComputeBSERadial(False)
        wxrops.setComputeBSESpatial(False)
        wxrops.setComputeBSELateral(False)
        wxrops.setComputeBSEEnergy(False)
        wxrops.setComputeBSEAngular(False)

        wxrops.setComputeSEDistribution(False)

        wxrops.setComputeEnergyLossDistribution(False)
        wxrops.setComputeEnergyLossDepth(False)
        wxrops.setComputeEnergyLossLateral(False)
        wxrops.setComputeEnergyLossSpatial(False)
        wxrops.setComputeEnergyLossRadial(False)

        wxrops.setComputeElectronDistribution(False)
        wxrops.setComputeElectronDepth(False)
        wxrops.setComputeElectronRadial(False)
        wxrops.setComputeElectronSpatial(False)
        wxrops.setComputeElectronLateral(False)

        # Perform detector export
        _Exporter._export_detectors(self, options, wxrops)

        # Detector position
        dets = options.detectors.iterclass(_DelimitedDetector)
        dets = list(map(itemgetter(1), dets))

        if len(dets) >= 2:
            c = map(equivalent_opening, dets[:-1], dets[1:])
            if not all(c):
                raise ExporterException("Some delimited detectors do not have the same opening")

        if dets:
            toa_deg = math.degrees(dets[0].takeoffangle_rad) # deg
            phi_deg = math.degrees(sum(dets[0].azimuth_rad) / 2.0) # deg

            wxrops.setTOA_deg(toa_deg)
            wxrops.setAngleThetaDetector_deg(90.0 - toa_deg)
            wxrops.setAnglePhiDetector_deg(phi_deg)

            wxrops.setUserDefineSolidAngle(True)
            wxrops.setSolidAngle_sr(dets[0].solidangle_sr)
예제 #3
0
    def _export_geometry(self, options, simdata, simops):
        _Exporter._export_geometry(self, options, simdata, simops)

        if options.geometry.tilt_rad != 0.0:
            message = 'Casino does not support sample tilt. Use beam tilt instead.'
            warnings.warn(message, ExporterWarning)

        if options.geometry.rotation_rad != 0.0:
            message = 'Casino does not support sample rotation.'
            warnings.warn(message, ExporterWarning)

        # Absorption energy electron
        abs_electron_eV = min(mat.absorption_energy_eV[ELECTRON] \
                              for mat in options.geometry.get_materials())
        simops.Eminimum = abs_electron_eV / 1000.0 # keV
예제 #4
0
    def __init__(self):
        _Exporter.__init__(self)

        self._beam_exporters[GaussianBeam] = self._beam_gaussian

        self._geometry_exporters[Substrate] = self._geometry_substrate
        self._geometry_exporters[HorizontalLayers] = self._geometry_horizontal_layers
        self._geometry_exporters[VerticalLayers] = self._geometry_vertical_layers

        self._detector_exporters[BackscatteredElectronEnergyDetector] = \
            self._detector_backscattered_electron_energy
        self._detector_exporters[BackscatteredElectronPolarAngularDetector] = \
            self._detector_backscattered_electron_polar_angular
        self._detector_exporters[BackscatteredElectronRadialDetector] = \
            self._detector_backscattered_electron_radial
        self._detector_exporters[TransmittedElectronEnergyDetector] = \
            self._detector_transmitted_electron_energy
        self._detector_exporters[PhiZDetector] = \
            self._detector_phi_z
        self._detector_exporters[PhotonRadialDetector] = \
            self._detector_photon_radial
        self._detector_exporters[PhotonIntensityDetector] = \
            self._detector_photon_intensity
        self._detector_exporters[ElectronFractionDetector] = \
            self._detector_electron_fraction
        self._detector_exporters[TrajectoryDetector] = \
            self._detector_trajectory

        self._limit_exporters[ShowersLimit] = self._limit_showers

        self._model_exporters[ELASTIC_CROSS_SECTION] = \
            self._model_elastic_cross_section
        self._model_exporters[IONIZATION_CROSS_SECTION] = \
            self._model_ionization_cross_section
        self._model_exporters[IONIZATION_POTENTIAL] = \
            self._model_ionization_potential
        self._model_exporters[RANDOM_NUMBER_GENERATOR] = \
            self._model_random_number_generator
        self._model_exporters[DIRECTION_COSINE] = \
            self._model_direction_cosine
        self._model_exporters[ENERGY_LOSS] = \
            self._model_energy_loss
        self._model_exporters[MASS_ABSORPTION_COEFFICIENT] = \
            self._model_mass_absorption_coefficient
예제 #5
0
    def _export_detectors(self, options, simdata, simops):
        simops.RangeFinder = 3 # Fixed range
        simops.FEmissionRX = 0 # Do not simulate x-rays
        simops.Memory_Keep = 0 # Do not save trajectories

        _Exporter._export_detectors(self, options, simdata, simops)

        # Detector position
        dets = options.detectors.iterclass(_DelimitedDetector)
        dets = list(map(itemgetter(1), dets))

        if len(dets) >= 2:
            c = map(equivalent_opening, dets[:-1], dets[1:])
            if not all(c):
                raise ExporterException("Some delimited detectors do not have the same opening")

        if dets:
            simops.TOA = np.degrees(dets[0].takeoffangle_rad) # deg
            simops.PhieRX = np.degrees(sum(dets[0].azimuth_rad) / 2.0) # deg
예제 #6
0
    def __init__(self):
        """
        Creates a exporter for Monaco program.
        """
        _Exporter.__init__(self)

        self._beam_exporters[PencilBeam] = self._export_dummy

        self._geometry_exporters[Substrate] = self._export_geometry_substrate

        self._detector_exporters[PhotonIntensityDetector] = self._export_dummy
        self._detector_exporters[PhiZDetector] = self._export_dummy

        self._limit_exporters[ShowersLimit] = self._export_dummy

        self._model_exporters[ELASTIC_CROSS_SECTION] = self._export_dummy
        self._model_exporters[IONIZATION_CROSS_SECTION] = self._export_dummy
        self._model_exporters[IONIZATION_POTENTIAL] = self._export_dummy
        self._model_exporters[ENERGY_LOSS] = self._export_dummy
        self._model_exporters[MASS_ABSORPTION_COEFFICIENT] = self._export_dummy
예제 #7
0
    def __init__(self):
        """
        Creates a exporter for Monaco program.
        """
        _Exporter.__init__(self)

        self._beam_exporters[PencilBeam] = self._export_dummy

        self._geometry_exporters[Substrate] = self._export_geometry_substrate

        self._detector_exporters[PhotonIntensityDetector] = self._export_dummy
        self._detector_exporters[PhiZDetector] = self._export_dummy

        self._limit_exporters[ShowersLimit] = self._export_dummy

        self._model_exporters[ELASTIC_CROSS_SECTION] = self._export_dummy
        self._model_exporters[IONIZATION_CROSS_SECTION] = self._export_dummy
        self._model_exporters[IONIZATION_POTENTIAL] = self._export_dummy
        self._model_exporters[ENERGY_LOSS] = self._export_dummy
        self._model_exporters[MASS_ABSORPTION_COEFFICIENT] = self._export_dummy
예제 #8
0
파일: exporter.py 프로젝트: xghui/winXray-1
    def __init__(self):
        _Exporter.__init__(self)

        self._beam_exporters[GaussianBeam] = self._beam_gaussian

        self._geometry_exporters[Substrate] = self._geometry_substrate

        self._detector_exporters[BackscatteredElectronEnergyDetector] = \
            self._detector_backscattered_electron_energy
        self._detector_exporters[BackscatteredElectronPolarAngularDetector] = \
            self._detector_backscattered_electron_polar_angular
        self._detector_exporters[PhiZDetector] = \
            self._detector_phi_z
        self._detector_exporters[PhotonIntensityDetector] = \
            self._detector_photon_intensity
        self._detector_exporters[PhotonSpectrumDetector] = \
            self._detector_photon_spectrum
        self._detector_exporters[ElectronFractionDetector] = \
            self._detector_electron_fraction
        self._detector_exporters[TimeDetector] = \
            self._detector_time
        self._detector_exporters[
            ShowersStatisticsDetector] = self._export_dummy

        self._limit_exporters[ShowersLimit] = self._limit_showers

        self._model_exporters[ELASTIC_CROSS_SECTION] = \
            self._model_elastic_cross_section
        self._model_exporters[IONIZATION_CROSS_SECTION] = \
            self._model_ionization_cross_section
        self._model_exporters[IONIZATION_POTENTIAL] = \
            self._model_ionization_potential
        self._model_exporters[RANDOM_NUMBER_GENERATOR] = \
            self._model_random_number_generator
        self._model_exporters[DIRECTION_COSINE] = \
            self._model_direction_cosine
        self._model_exporters[ENERGY_LOSS] = \
            self._model_energy_loss
        self._model_exporters[MASS_ABSORPTION_COEFFICIENT] = \
            self._model_mass_absorption_coefficient
예제 #9
0
    def __init__(self, pendbase_dir):
        """
        Creates a exporter to PENELOPE main programs.
        """
        _Exporter.__init__(self)

        self._geometry_exporters[Substrate] = self._export_geometry_substrate
        self._geometry_exporters[Inclusion] = self._export_geometry_inclusion
        self._geometry_exporters[
            HorizontalLayers] = self._export_geometry_horizontal_layers
        self._geometry_exporters[
            VerticalLayers] = self._export_geometry_vertical_layers
        self._geometry_exporters[Sphere] = self._export_geometry_sphere
        #        self._geometry_exporters[Cuboids2D] = self._export_geometry_cuboids2d

        self._model_exporters[ELASTIC_CROSS_SECTION] = self._export_dummy
        self._model_exporters[INELASTIC_CROSS_SECTION] = self._export_dummy
        self._model_exporters[IONIZATION_CROSS_SECTION] = self._export_dummy
        self._model_exporters[BREMSSTRAHLUNG_EMISSION] = self._export_dummy
        self._model_exporters[
            PHOTON_SCATTERING_CROSS_SECTION] = self._export_dummy
        self._model_exporters[MASS_ABSORPTION_COEFFICIENT] = self._export_dummy

        self._pendbase_dir = pendbase_dir