From 6d07748ed9391c75d85f3047f6f77cae1f26dda5 Mon Sep 17 00:00:00 2001 From: Mathieu Doucet <doucetm@ornl.gov> Date: Thu, 7 Jul 2011 19:59:03 +0000 Subject: [PATCH] Make Q2D algo compatible with non-EQSANS workspaces. Re #3324 --- .../WorkflowAlgorithms/src/EQSANSQ2D.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp index c4ed5272c48..dba4927a2a1 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp @@ -86,13 +86,25 @@ void EQSANSQ2D::exec() double maxdist = std::max(dxmax, dymax); // Wavelength bandwidths - const double wavelength_min = getRunProperty(inputWS, "wavelength_min"); - const double wavelength_max = getRunProperty(inputWS, "wavelength_max"); + double wavelength_min = 0.0; + if (inputWS->run().hasProperty("wavelength_min")) + wavelength_min = getRunProperty(inputWS, "wavelength_min"); + else if (inputWS->dataX(0).size()>1) + wavelength_min = (inputWS->dataX(1)[0]+inputWS->dataX(1)[1])/2.0; + else if (inputWS->dataX(0).size()==1) + wavelength_min = inputWS->dataX(1)[0]; + else + { + g_log.error("Can't determine the minimum wavelength for the input workspace."); + throw std::invalid_argument("Can't determine the minimum wavelength for the input workspace."); + } + double qmax = 4*M_PI/wavelength_min*std::sin(0.5*std::atan(maxdist/sample_detector_distance)); if (frame_skipping) { // In frame skipping mode, treat each frame separately + const double wavelength_max = getRunProperty(inputWS, "wavelength_max"); const double wavelength_min_f2 = getRunProperty(inputWS, "wavelength_min_frame2"); const double wavelength_max_f2 = getRunProperty(inputWS, "wavelength_max_frame2"); -- GitLab