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

Removed normalization of unused polarized intensity

parent 9a187ea3
No related branches found
No related tags found
No related merge requests found
...@@ -90,11 +90,8 @@ public: ...@@ -90,11 +90,8 @@ public:
virtual std::string addParametersToExternalPool(std::string path, ParameterPool *external_pool, virtual std::string addParametersToExternalPool(std::string path, ParameterPool *external_pool,
int copy_number = -1) const; int copy_number = -1) const;
#ifndef GCCXML_SKIP_THIS
//! Normalize intensity data with detector cell sizes. //! Normalize intensity data with detector cell sizes.
void normalize(OutputData<double> *p_data, OutputData<Eigen::Matrix2d> *p_polarized_data, void normalize(OutputData<double> *p_data, double sin_alpha_i) const;
double sin_alpha_i) const;
#endif
protected: protected:
virtual void print(std::ostream &ostr) const; virtual void print(std::ostream &ostr) const;
......
...@@ -107,8 +107,7 @@ public: ...@@ -107,8 +107,7 @@ public:
#ifndef GCCXML_SKIP_THIS #ifndef GCCXML_SKIP_THIS
//! normalize a detector image //! normalize a detector image
void normalize(OutputData<double> *p_intensity, void normalize(OutputData<double> *p_intensity) const;
OutputData<Eigen::Matrix2d> *p_polarized_intensity = 0) const;
#endif #endif
protected: protected:
......
...@@ -147,8 +147,7 @@ std::string Detector::addParametersToExternalPool(std::string path, ParameterPoo ...@@ -147,8 +147,7 @@ std::string Detector::addParametersToExternalPool(std::string path, ParameterPoo
return new_path; return new_path;
} }
void Detector::normalize(OutputData<double> *p_data, OutputData<Eigen::Matrix2d> *p_polarized_data, void Detector::normalize(OutputData<double> *p_data, double sin_alpha_i) const
double sin_alpha_i) const
{ {
// if shapes do not match, do nothing // if shapes do not match, do nothing
if (!dataShapeMatches(p_data)) if (!dataShapeMatches(p_data))
...@@ -168,17 +167,9 @@ void Detector::normalize(OutputData<double> *p_data, OutputData<Eigen::Matrix2d> ...@@ -168,17 +167,9 @@ void Detector::normalize(OutputData<double> *p_data, OutputData<Eigen::Matrix2d>
// This normalization assumes that the intensity map contains // This normalization assumes that the intensity map contains
// total differential scattering cross sections // total differential scattering cross sections
// (as opposed to the usual cross section per scattering particle) // (as opposed to the usual cross section per scattering particle)
OutputData<Eigen::Matrix2d>::iterator it_pol;
if (p_polarized_data) {
it_pol = p_polarized_data->begin();
}
for (OutputData<double>::iterator it = p_data->begin(); it != p_data->end(); ++it) { for (OutputData<double>::iterator it = p_data->begin(); it != p_data->end(); ++it) {
double factor = getSolidAngle(p_data, it.getIndex()) / sin_alpha_i; double factor = getSolidAngle(p_data, it.getIndex()) / sin_alpha_i;
(*it) *= factor; (*it) *= factor;
if (p_polarized_data) {
(*it_pol) *= factor;
++it_pol;
}
} }
} }
......
...@@ -91,9 +91,14 @@ GISASSimulation *GISASSimulation::clone() const ...@@ -91,9 +91,14 @@ GISASSimulation *GISASSimulation::clone() const
void GISASSimulation::prepareSimulation() void GISASSimulation::prepareSimulation()
{ {
if(!m_instrument.getDetectorDimension()) { if(!m_instrument.getDetectorDimension()) {
throw LogicErrorException("Simulation::prepareSimulation() " throw LogicErrorException("GISASSimulation::prepareSimulation() "
"-> Error. The detector was not configured."); "-> Error. The detector was not configured.");
} }
if (getWavelength() <= 0.0) {
throw ClassInitializationException(
"GISASSimulation::prepareSimulation() "
"-> Error. Incoming wavelength <= 0.");
}
Simulation::prepareSimulation(); Simulation::prepareSimulation();
} }
......
...@@ -114,16 +114,11 @@ std::string Instrument::addParametersToExternalPool( ...@@ -114,16 +114,11 @@ std::string Instrument::addParametersToExternalPool(
return new_path; return new_path;
} }
void Instrument::normalize(OutputData<double> *p_intensity, void Instrument::normalize(OutputData<double> *p_intensity) const
OutputData<Eigen::Matrix2d> *p_polarized_intensity) const
{ {
// normalize by intensity, if strictly positive // normalize by intensity, if strictly positive
if (getIntensity()>0.0) { if (getIntensity()>0.0) {
p_intensity->scaleAll(getIntensity()); p_intensity->scaleAll(getIntensity());
if (p_polarized_intensity) {
p_polarized_intensity->scaleAll(
Eigen::Matrix2d::Identity() * getIntensity());
}
} }
kvector_t realpart(getBeam().getCentralK().x().real(), kvector_t realpart(getBeam().getCentralK().x().real(),
getBeam().getCentralK().y().real(), getBeam().getCentralK().y().real(),
...@@ -131,7 +126,7 @@ void Instrument::normalize(OutputData<double> *p_intensity, ...@@ -131,7 +126,7 @@ void Instrument::normalize(OutputData<double> *p_intensity,
// normalize by detector cell sizes // normalize by detector cell sizes
double sin_alpha_i = std::abs(realpart.cosTheta()); double sin_alpha_i = std::abs(realpart.cosTheta());
m_detector.normalize(p_intensity, p_polarized_intensity, sin_alpha_i); m_detector.normalize(p_intensity, sin_alpha_i);
} }
void Instrument::setDetectorResolutionFunction( void Instrument::setDetectorResolutionFunction(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment