Skip to content
Snippets Groups Projects
Commit c2a1d6af authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Fixed python functional test polmagcylinders2; fixed default detector polarization projector

parent 76edfd63
No related branches found
No related tags found
No related merge requests found
......@@ -207,8 +207,7 @@ double Detector::getSolidAngle(OutputData<double> *p_data, size_t index) const
void Detector::initPolarization()
{
kvector_t zero;
setPolarization(zero);
m_polarization = Eigen::Matrix2cd::Identity();
}
void Detector::print(std::ostream &ostr) const
......
......@@ -17,7 +17,7 @@ from libBornAgainCore import *
# ----------------------------------
# describe sample and run simulation
# ----------------------------------
def RunSimulation():
def getSimulationIntensity(rho_beam, rho_detector):
# defining materials
mAmbience = HomogeneousMaterial("Air", 0.0, 0.0)
mSubstrate = HomogeneousMaterial("Substrate", 15e-6, 0.0)
......@@ -45,25 +45,28 @@ def RunSimulation():
# build and run experiment
simulation = Simulation()
simulation.setDetectorParameters(100, -1*degree, 1.0*degree, 100, 0.0*degree, 2.0*degree)
simulation.setDetectorPolarization(rho_detector)
simulation.setBeamParameters(1.0*angstrom, 0.2*degree, 0.0*degree)
simulation.setBeamPolarization(rho_beam)
simulation.setSample(multi_layer)
simulation.setBeamIntensity(1e7)
simulation.runSimulation()
simulation.normalize()
return simulation
return simulation.getIntensityData().getArray()
# --------------------------------------------------------------
# run test and analyse test results
# --------------------------------------------------------------
def run_test():
simulation = RunSimulation()
zplus = kvector_t(0.0, 0.0, 1.0)
zmin = kvector_t(0.0, 0.0, -1.0)
diff = 0.0
diff += get_difference(simulation.getPolarizedIntensityData(0, 0).getArray(), get_reference_data('polmagcylinders2_reference_00.int.gz').getArray())
diff += get_difference(simulation.getPolarizedIntensityData(0, 1).getArray(), get_reference_data('polmagcylinders2_reference_01.int.gz').getArray())
diff += get_difference(simulation.getPolarizedIntensityData(1, 0).getArray(), get_reference_data('polmagcylinders2_reference_10.int.gz').getArray())
diff += get_difference(simulation.getPolarizedIntensityData(1, 1).getArray(), get_reference_data('polmagcylinders2_reference_11.int.gz').getArray())
diff += get_difference(getSimulationIntensity(zplus, zplus), get_reference_data('polmagcylinders2_reference_00.int.gz').getArray())
diff += get_difference(getSimulationIntensity(zplus, zmin), get_reference_data('polmagcylinders2_reference_01.int.gz').getArray())
diff += get_difference(getSimulationIntensity(zmin, zplus), get_reference_data('polmagcylinders2_reference_10.int.gz').getArray())
diff += get_difference(getSimulationIntensity(zmin, zmin), get_reference_data('polmagcylinders2_reference_11.int.gz').getArray())
diff /= 4.0
status = "OK"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment