Skip to content

Commit

Permalink
Refs #4713 use getScattering and new coefficients from ISAW
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed Feb 1, 2012
1 parent 15ef6b0 commit c4ef8cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
21 changes: 9 additions & 12 deletions Code/Mantid/Framework/Crystal/inc/MantidCrystal/SaveHKL.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ namespace Crystal
* @date 2011-09-28
*/
const double pc[4][19] =
{ {0.9369, 0.9490, 0.9778, 1.0083, 1.0295, 1.0389, 1.0392, 1.0338,
1.0261, 1.0180, 1.0107, 1.0046, 0.9997, 0.9957, 0.9929, 0.9909,
0.9896, 0.9888, 0.9886},
{2.1217, 2.0149, 1.7559, 1.4739, 1.2669, 1.1606, 1.1382, 1.1724,
1.2328, 1.3032, 1.3706, 1.4300, 1.4804, 1.5213, 1.5524, 1.5755,
1.5913, 1.6005, 1.6033},
{-0.1304, 0.0423, 0.4664, 0.9427, 1.3112, 1.5201, 1.5844, 1.5411,
1.4370, 1.2998, 1.1543, 1.0131, 0.8820, 0.7670, 0.6712, 0.5951,
0.5398, 0.5063, 0.4955},
{1.1717, 1.0872, 0.8715, 0.6068, 0.3643, 0.1757, 0.0446, -0.0375,
-0.0853, -0.1088, -0.1176, -0.1177, -0.1123, -0.1051, -0.0978,
-0.0914, -0.0868, -0.0840, -0.0833}};
{{1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000,
1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000},
{1.9368, 1.8653, 1.6908, 1.4981, 1.3532, 1.2746, 1.2530, 1.2714, 1.3093, 1.3559,
1.4019, 1.4434, 1.4794, 1.5088, 1.5317, 1.5489, 1.5608, 1.5677, 1.5700},
{0.0145, 0.1596, 0.5175, 0.9237, 1.2436, 1.4308, 1.4944, 1.4635, 1.3770, 1.2585,
1.1297, 1.0026, 0.8828, 0.7768, 0.6875, 0.6159, 0.5637, 0.5320, 0.5216},
{1.1386, 1.0604, 0.8598, 0.6111, 0.3798, 0.1962, 0.0652, -0.0198, -0.0716, -0.0993,
-0.1176, -0.1153, -0.1125, -0.1073, -0.1016, -0.0962, -0.0922, -0.0898, -0.0892}};

const double MAX_WAVELENGTH = 50.0; // max in lamda_weight table

const double STEPS_PER_ANGSTROM = 100; // resolution of lamda table
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Crystal/src/LoadHKL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace Crystal
peak.setIntensity(Inti);
peak.setSigmaIntensity(SigI);
peak.setRunNumber(run);
peak.setBankName(bank);
peak.setBankName("bank"+bank);
ws->addPeak(peak);

} while (!in.eof());
Expand Down
20 changes: 7 additions & 13 deletions Code/Mantid/Framework/Crystal/src/SaveHKL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ namespace Crystal
*/
void SaveHKL::init()
{
declareProperty(new WorkspaceProperty<PeaksWorkspace>("InputWorkspace","",Direction::Input, new InstrumentValidator<PeaksWorkspace>()),
"An input PeaksWorkspace with an instrument.");
declareProperty(new WorkspaceProperty<PeaksWorkspace>("InputWorkspace","",Direction::Input),
"An input PeaksWorkspace.");

BoundedValidator<double> *mustBePositive = new BoundedValidator<double> ();
mustBePositive->setLower(0.0);
Expand Down Expand Up @@ -118,13 +118,6 @@ namespace Crystal
out.open( filename.c_str(), std::ios::out);
}

Instrument_const_sptr inst = ws->getInstrument();
if (!inst) throw std::runtime_error("No instrument in PeaksWorkspace. Cannot save peaks file.");

double l1; V3D beamline; double beamline_norm; V3D samplePos;
inst->getInstrumentParameters(l1, beamline, beamline_norm, samplePos);


// We must sort the peaks first by run, then bank #, and save the list of workspace indices of it
typedef std::map<int, std::vector<size_t> > bankMap_t;
typedef std::map<int, bankMap_t> runMap_t;
Expand Down Expand Up @@ -182,11 +175,9 @@ namespace Crystal
boost::math::isnan(p.getSigmaIntensity())) continue;

double tbar = 0;
// This is the scattered beam direction
V3D dir = p.getDetPos() - inst->getSample()->getPos();

// Two-theta = polar angle = scattering angle = between +Z vector and the scattered beam
double scattering = dir.angle( V3D(0.0, 0.0, 1.0) );
double scattering = p.getScattering();
double lambda = p.getWavelength();
double transmission = absor_sphere(scattering, lambda, tbar);

Expand Down Expand Up @@ -305,7 +296,10 @@ namespace Crystal
// trans = exp(-mu*tbar)

// calculate tbar as defined by coppens.
tbar = -(double)std::log(trans)/mu;
if(mu == 0.0)
tbar=0.0;
else
tbar = -(double)std::log(trans)/mu;

return trans;
}
Expand Down

0 comments on commit c4ef8cf

Please sign in to comment.