BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Public Types | |
enum | EMainType { RUN_SIMULATION , SAVE_DATA } |
Public Member Functions | |
std::string | generateSimulationCode (const Simulation &simulation, EMainType mainType) |
Private Member Functions | |
std::string | definePreamble () const |
std::string | defineGetSimulation (const Simulation *simulation) const |
std::string | defineGISASSimulation (const GISASSimulation *simulation) const |
std::string | defineOffSpecSimulation (const OffSpecSimulation *simulation) const |
std::string | defineSpecularSimulation (const SpecularSimulation *simulation) const |
std::string | defineDetector (const Simulation *simulation) const |
std::string | defineDetectorResolutionFunction (const Simulation *simulation) const |
std::string | defineDetectorPolarizationAnalysis (const Simulation *simulation) const |
std::string | defineGISASBeam (const GISASSimulation &simulation) const |
std::string | defineOffSpecBeam (const OffSpecSimulation &simulation) const |
std::string | defineSpecularScan (const SpecularSimulation &simulation) const |
std::string | defineBeamPolarization (const Beam &beam) const |
std::string | defineBeamIntensity (const Beam &beam) const |
std::string | defineParameterDistributions (const Simulation *simulation) const |
std::string | defineMasks (const Simulation *simulation) const |
std::string | defineSimulationOptions (const Simulation *simulation) const |
std::string | defineBackground (const Simulation *simulation) const |
std::string | defineMain (EMainType mainType=RUN_SIMULATION) |
Write a Python script that allows to run the current simulation.
Definition at line 30 of file SimulationToPython.h.
Enumerator | |
---|---|
RUN_SIMULATION | main function runs simulation |
SAVE_DATA | main function saves intensity data |
Definition at line 33 of file SimulationToPython.h.
std::string SimulationToPython::generateSimulationCode | ( | const Simulation & | simulation, |
EMainType | mainType | ||
) |
Returns a Python script that sets up a simulation and runs it if invoked as main program.
Definition at line 72 of file SimulationToPython.cpp.
References defineGetSimulation(), defineMain(), anonymous_namespace{SimulationToPython.cpp}::defineSimulate, SampleToPython::generateSampleCode(), Simulation::sample(), and pyfmt::scriptPreamble().
Referenced by anonymous_namespace{ExportToPython.cpp}::simulationCode().
|
private |
|
private |
Definition at line 85 of file SimulationToPython.cpp.
References defineGISASSimulation(), defineOffSpecSimulation(), defineSpecularSimulation(), and pyfmt::indent().
Referenced by generateSimulationCode().
|
private |
Definition at line 104 of file SimulationToPython.cpp.
References defineBackground(), defineDetector(), defineDetectorPolarizationAnalysis(), defineDetectorResolutionFunction(), defineGISASBeam(), defineMasks(), defineParameterDistributions(), defineSimulationOptions(), and pyfmt::indent().
Referenced by defineGetSimulation().
|
private |
Definition at line 119 of file SimulationToPython.cpp.
References defineBackground(), defineDetector(), defineDetectorPolarizationAnalysis(), defineDetectorResolutionFunction(), defineMasks(), defineOffSpecBeam(), defineParameterDistributions(), defineSimulationOptions(), and pyfmt::indent().
Referenced by defineGetSimulation().
|
private |
Definition at line 134 of file SimulationToPython.cpp.
References defineBackground(), defineDetectorPolarizationAnalysis(), defineParameterDistributions(), defineSimulationOptions(), defineSpecularScan(), and pyfmt::indent().
Referenced by defineGetSimulation().
|
private |
Definition at line 146 of file SimulationToPython.cpp.
References IDetector::dimension(), RectangularDetector::GENERIC, Instrument::getDetector(), RegionOfInterest::getXlow(), RegionOfInterest::getXup(), RegionOfInterest::getYlow(), RegionOfInterest::getYup(), pyfmt::indent(), Simulation::instrument(), anonymous_namespace{SimulationToPython.cpp}::isDefaultDirection(), RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM, RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM, RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS, RectangularDetector::PERPENDICULAR_TO_SAMPLE, pyfmt::printDegrees(), pyfmt::printDouble(), anonymous_namespace{SimulationToPython.cpp}::printFunc(), pyfmt::printKvector(), and IDetector::regionOfInterest().
Referenced by defineGISASSimulation(), and defineOffSpecSimulation().
|
private |
Definition at line 220 of file SimulationToPython.cpp.
References IDetector::detectorResolution(), Instrument::getDetector(), pyfmt::indent(), Simulation::instrument(), and anonymous_namespace{SimulationToPython.cpp}::printFunc().
Referenced by defineGISASSimulation(), and defineOffSpecSimulation().
|
private |
Definition at line 246 of file SimulationToPython.cpp.
References DetectionProperties::analyzerDirection(), DetectionProperties::analyzerEfficiency(), DetectionProperties::analyzerTotalTransmission(), IDetector::detectionProperties(), Instrument::getDetector(), pyfmt::indent(), Simulation::instrument(), BasicVector3D< T >::mag(), pyfmt::printDouble(), BasicVector3D< T >::x(), BasicVector3D< T >::y(), and BasicVector3D< T >::z().
Referenced by defineGISASSimulation(), defineOffSpecSimulation(), and defineSpecularSimulation().
|
private |
Definition at line 268 of file SimulationToPython.cpp.
References defineBeamIntensity(), defineBeamPolarization(), Beam::getAlpha(), Instrument::getBeam(), Beam::getPhi(), Beam::getWavelength(), pyfmt::indent(), Simulation::instrument(), pyfmt::printDegrees(), and pyfmt::printNm().
Referenced by defineGISASSimulation().
|
private |
Definition at line 283 of file SimulationToPython.cpp.
References OffSpecSimulation::beamAxis(), defineBeamIntensity(), defineBeamPolarization(), Instrument::getBeam(), Beam::getPhi(), Beam::getWavelength(), pyfmt::indent(), Simulation::instrument(), pyfmt::printDegrees(), pyfmt::printNm(), and IAxis::pyString().
Referenced by defineOffSpecSimulation().
|
private |
Definition at line 300 of file SimulationToPython.cpp.
References SpecularSimulation::dataHandler(), defineBeamIntensity(), Instrument::getBeam(), pyfmt::indent(), and Simulation::instrument().
Referenced by defineSpecularSimulation().
|
private |
Definition at line 315 of file SimulationToPython.cpp.
References Beam::getBlochVector(), pyfmt::indent(), and pyfmt::printDouble().
Referenced by defineGISASBeam(), and defineOffSpecBeam().
|
private |
Definition at line 331 of file SimulationToPython.cpp.
References Beam::getIntensity(), pyfmt::indent(), and pyfmt::printScientificDouble().
Referenced by defineGISASBeam(), defineOffSpecBeam(), and defineSpecularScan().
|
private |
Definition at line 341 of file SimulationToPython.cpp.
References Simulation::getDistributionHandler(), DistributionHandler::getDistributions(), pyfmt::indent(), ParameterUtils::poolParameterUnits(), pyfmt2::printDistribution(), pyfmt::printDouble(), and pyfmt::printRealLimitsArg().
Referenced by defineGISASSimulation(), defineOffSpecSimulation(), and defineSpecularSimulation().
|
private |
Definition at line 369 of file SimulationToPython.cpp.
References IDetector::detectorMask(), Instrument::getDetector(), DetectorMask::getMaskShape(), pyfmt::indent(), Simulation::instrument(), DetectorMask::numberOfMasks(), anonymous_namespace{SimulationToPython.cpp}::printFunc(), and pyfmt2::representShape2D().
Referenced by defineGISASSimulation(), and defineOffSpecSimulation().
|
private |
Definition at line 389 of file SimulationToPython.cpp.
References SimulationOptions::getHardwareConcurrency(), SimulationOptions::getMcPoints(), SimulationOptions::getNumberOfThreads(), Simulation::getOptions(), SimulationOptions::includeSpecular(), pyfmt::indent(), SimulationOptions::isIntegrate(), and SimulationOptions::useAvgMaterials().
Referenced by defineGISASSimulation(), defineOffSpecSimulation(), and defineSpecularSimulation().
|
private |
Definition at line 408 of file SimulationToPython.cpp.
References Simulation::background(), pyfmt::indent(), and pyfmt::printScientificDouble().
Referenced by defineGISASSimulation(), defineOffSpecSimulation(), and defineSpecularSimulation().
|
private |
Definition at line 426 of file SimulationToPython.cpp.
References RUN_SIMULATION, and SAVE_DATA.
Referenced by generateSimulationCode().