Esempio n. 1
0
 def create_detector(self):
     width, height = self.m_nx * self.m_pixel_size, self.m_ny * self.m_pixel_size
     u0 = self.m_center_x * self.m_pixel_size
     v0 = (self.m_ny - self.m_center_y) * self.m_pixel_size
     result = ba.RectangularDetector(self.m_nx, width, self.m_ny, height)
     result.setPerpendicularToDirectBeam(self.m_distance, u0, v0)
     return result
def get_rectangular_detector():
    """
    Returns a rectangular detector representing our PILATUS detector
    """
    width = pilatus_npx * pilatus_pixel_size
    height = pilatus_npy * pilatus_pixel_size
    detector = ba.RectangularDetector(pilatus_npx, width, pilatus_npy, height)
    detector.setPerpendicularToSampleX(detector_distance, width / 2., 0.0)
    return detector
Esempio n. 3
0
def get_kws3_detector(u0=45.3, v0=29.9):
    """
    Creates and returns KWS-3 detector
    detector dimensions: 90x90 mm
    SDD: 9200 mm (GISANS)
    """
    detector = ba.RectangularDetector(256, 90.0, 256, 90.0)
    detector.setPerpendicularToDirectBeam(9200.0, u0, v0)
    return detector
Esempio n. 4
0
def create_detector():
    """
    Creates and returns KWS-2 detector
    """
    u0 = beam_xpos * psize  # in mm
    v0 = beam_ypos * psize  # in mm
    detector = ba.RectangularDetector(npx, det_width, npy, det_height)
    detector.setPerpendicularToDirectBeam(sdd, u0, v0)
    return detector
def create_detector():
    """
    Returns a model of the GALAXY detector
    """
    u0 = beam_xpos*pilatus_pixel_size  # in mm
    v0 = beam_ypos*pilatus_pixel_size  # in mm
    detector = ba.RectangularDetector(pilatus_npx, pilatus_npx*pilatus_pixel_size,
                                      pilatus_npy, pilatus_npy*pilatus_pixel_size)
    detector.setPerpendicularToDirectBeam(detector_distance, u0, v0)
    return detector
Esempio n. 6
0
def create_detector(large=False):
    """
    Creates and returns NREX detector
    """
    if large:  # if simulated detector larger as the real one
        u0 = (beam_center_y + extend_det) * pixel_size  # in mm
        v0 = beam_center_z * pixel_size  # in mm
        detector = ba.RectangularDetector(npx + 2 * extend_det,
                                          (npx + 2 * extend_det) * pixel_size,
                                          npy, npy * pixel_size)
    else:
        u0 = beam_center_y * pixel_size  # in mm
        v0 = beam_center_z * pixel_size  # in mm
        detector = ba.RectangularDetector(npx, npx * pixel_size, npy,
                                          npy * pixel_size)
    normal = ba.kvector_t(sdd * np.cos(ai), 0.0, 1.0 * sdd * np.sin(ai))
    detector.setPosition(normal, u0, v0)
    # detector.setPerpendicularToReflectedBeam(sdd, u0, v0)      # alternatively

    return detector
Esempio n. 7
0
def create_detector():
    """
    Creates and returns KWS=3 detector
    """
    u0 = beam_xpos * pixel_size  # in mm
    v0 = beam_ypos * pixel_size  # in mm
    detector = ba.RectangularDetector(npx, npx * pixel_size, npy,
                                      npy * pixel_size)
    detector.setPerpendicularToDirectBeam(detector_distance, u0, v0)

    return detector
Esempio n. 8
0
def get_kws3_detector():
    """
    Creates and returns KWS-3 detector
    detector dimensions: 90x90 mm
    SDD: 9300 mm (for SANS)
    """
    u0 = 45.7  # in mm
    v0 = 48.5  # in mm
    detector = ba.RectangularDetector(256, 90.0, 256, 90.0)
    detector.setPerpendicularToDirectBeam(9300.0, u0, v0)
    return detector
    def get_simulation():
        simulation = ba.GISASSimulation()

        detector = ba.RectangularDetector(256, 90.0, 256, 90.0)
        detector.setPerpendicularToDirectBeam(1300.0, 45.0, 29.0)
        simulation.setDetector(detector)

        #simulation.setDetectorResolutionFunction(ba.ResolutionFunction2DGaussian(0.34, 0.34))
        simulation.setBeamParameters(1.28 * nm, 0.6 * deg, 0.0 * deg)
        simulation.setBeamIntensity(1.0e+04)
        simulation.setTerminalProgressMonitor()
        return simulation
def get_simulation(params):  # function which defines the GISAXS simulation

    simulation = ba.GISASSimulation()

    detector = ba.RectangularDetector(981, 168.732, 1043,
                                      179.396)  # creates the Pilatus detector
    detector.setPerpendicularToDirectBeam(
        2385.807, 89.522,
        21.83)  # adds the SDD and DB position to the detector
    simulation.setDetector(detector)  # adds the detector to the simulation

    simulation.setBeamParameters(
        0.095373 * nm, 0.378 * deg,
        0.0 * deg)  # adds the beam parameters to the simulation
    beam_intensity = params["beam_intensity"]
    simulation.setBeamIntensity(beam_intensity)
    #simulation.setBackground(ba.PoissonNoiseBackground())

    simulation.setSample(
        get_sample(params))  #  adds the sample to the simulation

    #print(simulation.treeToString())
    print(simulation.parametersToString())

    simulation.getOptions().setIncludeSpecular(False)
    simulation.getOptions().setUseAvgMaterials(
        True)  # enables the graded interfaces formalism
    #simulation.getOptions().setMonteCarloIntegration(False, 50)

    simulation.setRegionOfInterest(85, 38, 164, 143)

    # Masks for full fitting procedure:

    #simulation.addMask(ba.Rectangle(83.696, 36.530, 84.951 , 106.469), True)
    #simulation.addMask(ba.Rectangle(3.732, 70.213, 154.232, 73.011), True)
    #simulation.addMask(ba.Ellipse(59.501, 48.764, 0.239, 0.181), True)
    #simulation.addMask(ba.Ellipse(79.088, 54.814, 3.132, 3.338), True)
    #simulation.addMask(ba.Ellipse(90.57, 105.700, 0.167, 0.191), True)
    #simulation.addMask(ba.Polygon([76.29, 76.88, 7.59, 5.51],[56.26, 57.17, 106.48, 106.53]), True)

    # Size distribution:

    #n_samples = 20
    #R = params["radius"]
    #R_stdev = 0.2*R
    #R_min = 0.1*R
    #R_max = 2*R
    #sigma_par = 2.0*nm
    #radius_distr = ba.DistributionGaussian(R, R_stdev)
    #simulation.addParameterDistribution("*/Radius", radius_distr, n_samples, sigma_par, ba.RealLimits.limited(R_min, R_max))

    simulation.setTerminalProgressMonitor()
    return simulation
Esempio n. 11
0
    def get_simulation():
        simulation = ba.GISASSimulation()

        detector = ba.RectangularDetector(981, 168.732, 1043, 179.396)
        detector.setPerpendicularToDirectBeam(830.0, 106.1068, 47.644)
        simulation.setDetector(detector)

        simulation.setDetectorResolutionFunction(ba.ResolutionFunction2DGaussian(0.43, 0.43))
        simulation.setBeamParameters(0.134 * nm, 0.2 * deg, 0.0 * deg)
        simulation.setBeamIntensity(5.0e+06)
        simulation.setTerminalProgressMonitor()
        simulation.setRegionOfInterest(0, 48, 168.73, 179.396)
        return simulation
Esempio n. 12
0
def get_rectangular_detector():
    """
    Returns rectangular detector representing our PILATUS detector
    """

    detector_distance = 2000.0  # in mm
    pilatus_pixel_size = 0.172  # in mm
    pilatus_npx, pilatus_npy = 981, 1043  # number of pixels

    width = pilatus_npx * pilatus_pixel_size
    height = pilatus_npy * pilatus_pixel_size
    detector = ba.RectangularDetector(pilatus_npx, width, pilatus_npy, height)
    detector.setPerpendicularToSampleX(detector_distance, width / 2., 0.0)
    return detector
Esempio n. 13
0
def get_simulation():
    simulation = ba.GISASSimulation()

    detector = ba.RectangularDetector(981, 168.732, 1043, 179.396)
    detector.setPerpendicularToDirectBeam(3530.0, 104.558, 39.422)
    simulation.setDetector(detector)

    simulation.setDetectorResolutionFunction(
        ba.ResolutionFunction2DGaussian(0.043, 0.043))
    simulation.setBeamParameters(0.1341 * nm, 0.2 * deg, 0.0 * deg)
    simulation.setBeamIntensity(5.0e+06)
    simulation.setTerminalProgressMonitor()
    simulation.setRegionOfInterest(40.0, 50.0, 160.0, 170.0)
    return simulation
Esempio n. 14
0
def create_detector():
    """
    Creates and returns GALAXY detector
    """
    # detector setup as given from instrument responsible
    npx, npy = 981, 1043
    pixel_size = 0.172  # in mm
    detector_distance = 1730.0  # in mm
    beam_xpos, beam_ypos = 597.1, 323.4  # in pixels

    u0 = beam_xpos*pixel_size  # in mm
    v0 = beam_ypos*pixel_size  # in mm
    detector = ba.RectangularDetector(npx, npx*pixel_size, npy, npy*pixel_size)
    detector.setPerpendicularToDirectBeam(detector_distance, u0, v0)
    return detector
def create_simulation():
    """
    Creates and returns GISAS simulation with beam and detector defined
    """

    simulation = ba.GISASSimulation()

    u0 = beam_xpos*pilatus_pixel_size  # in mm
    v0 = beam_ypos*pilatus_pixel_size  # in mm
    detector = ba.RectangularDetector(pilatus_npx, pilatus_npx*pilatus_pixel_size,
                                      pilatus_npy, pilatus_npy*pilatus_pixel_size)
    detector.setPerpendicularToDirectBeam(detector_distance, u0, v0)
    simulation.setDetector(detector)
    simulation.setBeamParameters(wavelength, alpha_i, 0.0)
    return simulation
Esempio n. 16
0
def create_detector():
    """
    Creates rectangular detector.
    """
    m_distance = 909.99  # mm
    m_nx = 1024
    m_ny = 1024
    m_center_x = 108.2
    m_center_y = 942.0
    width, height = m_nx * m_pixel_size, m_ny * m_pixel_size
    u0 = m_center_x * m_pixel_size
    v0 = (m_ny - m_center_y) * m_pixel_size
    detector = ba.RectangularDetector(m_nx, width, m_ny, height)
    detector.setPerpendicularToDirectBeam(m_distance, u0, v0)
    return detector
Esempio n. 17
0
def get_simulation(detPars, ff, trafo=None):
    """Create and return GISAXS simulation

    :param detPars: Detector limits
    :param sample
    """
    simulation = ba.GISASSimulation()
    detector = ba.RectangularDetector(detPars.y.n, detPars.y.range(),
                                      detPars.z.n, detPars.z.range())
    detector.setPerpendicularToSampleX(1., -detPars.y.vmin, -detPars.z.vmin)
    simulation.setDetector(detector)
    simulation.setBeamParameters(1.0 * nanometer, 0, 0)
    sample = get_sample(ff, trafo)
    simulation.setSample(sample)
    return simulation
def get_simulation(params):
    simulation = ba.GISASSimulation()

    detector = ba.RectangularDetector(981, 168.732, 1043, 179.396)
    detector.setPerpendicularToDirectBeam(3532.0, 103.234, 60.062)
    simulation.setDetector(detector)

    simulation.setRegionOfInterest(87, 70, 119, 130)
    simulation.addMask(ba.Rectangle(101.7, 72, 104.7, 107), True)

    simulation.setDetectorResolutionFunction(ba.ResolutionFunction2DGaussian(0.1, 0.1))
    simulation.setBeamParameters(0.1 * nm, 0.2 * deg, 0.0 * deg)
    simulation.setBeamIntensity(1.0e+08)

    simulation.setSample(get_sample(params))
    return simulation
Esempio n. 19
0
def get_simulation():
    simulation = ba.GISASSimulation()

    detector = ba.RectangularDetector(981, 168.732, 1043, 179.396)
    detector.setPerpendicularToDirectBeam(3532.0, 103.234, 60.062)
    simulation.setDetector(detector)
    simulation.setTerminalProgressMonitor()
    background = ba.PoissonNoiseBackground()
    simulation.setBackground(background)
    simulation.getOptions().setIncludeSpecular(True)
    simulation.addMask(ba.Rectangle(82, 0.0, 86, 180), True)

    # distr_1 = ba.DistributionGaussian(0.2 * deg, 0.001 * deg)
    # simulation.addParameterDistribution("*/Beam/InclinationAngle", distr_1, 5, 2.0,
    #                                     ba.RealLimits.limited(0.0 * deg, 90.0 * deg))
    # distr_2 = ba.DistributionGaussian(0.0 * deg, 0.01 * deg)
    # simulation.addParameterDistribution("*/Beam/AzimuthalAngle", distr_2, 5, 2.0,
    #                                     ba.RealLimits.limited(-90.0 * deg, 90.0 * deg))
    simulation.setDetectorResolutionFunction(ba.ResolutionFunction2DGaussian(0.1, 0.1))
    simulation.setBeamParameters(0.1 * nm, 0.2 * deg, 0.0 * deg)
    simulation.setBeamIntensity(1.0e+08)
    return simulation