Mantid
Loading...
Searching...
No Matches
Unit.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
14#include <utility>
15
16#include <algorithm>
17#include <unordered_map>
18#include <vector>
19
20#include "tbb/concurrent_unordered_map.h"
21
22namespace Mantid {
23namespace Kernel {
24
26
27// list of parameter names and values - some code may relay on map behaviour
28// where [] creates element with value 0 if param name not present
29using UnitParametersMap = std::unordered_map<UnitParams, double>;
30
40class MANTID_KERNEL_DLL Unit {
41public:
43 Unit();
45 virtual ~Unit() = default;
46
48 virtual Unit *clone() const = 0;
49
56 virtual const std::string unitID() const = 0;
59 virtual const std::string caption() const = 0;
60
63 virtual const UnitLabel label() const = 0;
64
67 virtual bool isConvertible() const { return true; }
68
69 // Equality operators based on the value returned by unitID();
70 bool operator==(const Unit &u) const;
71 bool operator!=(const Unit &u) const;
72
73 // Check whether the unit can be converted to another via a simple factor
74 bool quickConversion(const Unit &destination, double &factor, double &power) const;
75 bool quickConversion(std::string destUnitName, double &factor, double &power) const;
76
90 void toTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
91 std::initializer_list<std::pair<const UnitParams, double>> params);
92 void toTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
93 const UnitParametersMap &params);
94
110 template <typename Iterator>
111 void toTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode,
112 UnitParametersMap const &params) {
113 this->initialize(l1, emode, params);
114 std::transform(xbegin, xend, xbegin, [this](double const x) { return this->singleToTOF(x); });
115 }
116
118 double convertSingleToTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
119
133 void fromTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
134 std::initializer_list<std::pair<const UnitParams, double>> params);
135
136 void fromTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
137 const UnitParametersMap &params);
138
154 template <typename Iterator>
155 void fromTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode,
156 UnitParametersMap const &params) {
157 this->initialize(l1, emode, params);
158 std::transform(xbegin, xend, xbegin, [this](double const tof) { return this->singleFromTOF(tof); });
159 }
160
162 double convertSingleFromTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
163
165 void initialize(const double &_l1, const int &_emode, const UnitParametersMap &params);
166
169 virtual void init() = 0;
170
175 virtual double singleToTOF(const double x) const = 0;
176
181 virtual double singleFromTOF(const double tof) const = 0;
182
184 bool isInitialized() const { return initialized; }
185
189 virtual double conversionTOFMin() const = 0;
190
193 virtual double conversionTOFMax() const = 0;
194
197 virtual std::pair<double, double> conversionRange() const;
198
199protected:
200 // Add a 'quick conversion' for a unit pair
201 void addConversion(std::string to, const double &factor, const double &power = 1.0) const;
202
203 // validate the contents of the unit parameters map. Throw
204 // std::invalid_argument if it's a global error or std::runtime_error if it's
205 // a detector specific error
206 virtual void validateUnitParams(const int emode, const UnitParametersMap &params);
207
211 double l1;
214 int emode;
221
222private:
225 using ConstantAndPower = std::pair<double, double>;
228 using UnitConversions = tbb::concurrent_unordered_map<std::string, ConstantAndPower>;
231 using ConversionsMap = tbb::concurrent_unordered_map<std::string, UnitConversions>;
234};
235
236//----------------------------------------------------------------------
237// Now the concrete units classes
238//----------------------------------------------------------------------
239
241namespace Units {
242
243//=================================================================================================
245class MANTID_KERNEL_DLL Empty : public Unit {
246public:
247 const std::string unitID() const override;
248 const std::string caption() const override { return ""; }
249 const UnitLabel label() const override;
250
251 bool isConvertible() const override { return false; }
252 double singleToTOF(const double x) const override;
253 double singleFromTOF(const double tof) const override;
254 void init() override;
255 Unit *clone() const override;
256
257 double conversionTOFMin() const override;
258 double conversionTOFMax() const override;
259
261 Empty() : Unit() {}
262};
263
264//=================================================================================================
266class MANTID_KERNEL_DLL Label : public Empty {
267public:
268 const std::string unitID() const override;
269 const std::string caption() const override { return m_caption; }
270 const UnitLabel label() const override;
271
272 Label();
273 Label(const std::string &caption, const std::string &label);
274 void setLabel(const std::string &cpt, const UnitLabel &lbl = UnitLabel(""));
275 Unit *clone() const override;
276
277private:
279 std::string m_caption;
282};
283
284//=================================================================================================
286class MANTID_KERNEL_DLL TOF : public Unit {
287public:
288 const std::string unitID() const override;
289 const std::string caption() const override { return "Time-of-flight"; }
290 const UnitLabel label() const override;
291
292 TOF();
293 void init() override;
294 double singleToTOF(const double x) const override;
295 double singleFromTOF(const double tof) const override;
296 Unit *clone() const override;
298 double conversionTOFMin() const override;
300 double conversionTOFMax() const override;
301};
302
303//=================================================================================================
305class MANTID_KERNEL_DLL Wavelength : public Unit {
306public:
307 const std::string unitID() const override;
308 const std::string caption() const override { return "Wavelength"; }
309 const UnitLabel label() const override;
310
311 double singleToTOF(const double x) const override;
312 double singleFromTOF(const double tof) const override;
313 void init() override;
314 Unit *clone() const override;
315
316 double conversionTOFMin() const override;
317 double conversionTOFMax() const override;
318
320 Wavelength();
321
322protected:
323 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
324 double efixed;
325 double sfpTo;
326 double factorTo;
327 double sfpFrom;
328 double factorFrom;
330};
331
332//=================================================================================================
334class MANTID_KERNEL_DLL Energy : public Unit {
335public:
336 const std::string unitID() const override;
337 const std::string caption() const override { return "Energy"; }
338 const UnitLabel label() const override;
339
340 double singleToTOF(const double x) const override;
341 double singleFromTOF(const double tof) const override;
342 void init() override;
343 Unit *clone() const override;
344
345 double conversionTOFMin() const override;
346 double conversionTOFMax() const override;
347
349 Energy();
350
351protected:
352 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
353 double factorTo;
354 double factorFrom;
355};
356
357//=================================================================================================
359class MANTID_KERNEL_DLL Energy_inWavenumber : public Unit {
360public:
361 const std::string unitID() const override;
362 const std::string caption() const override { return "Energy"; }
363 const UnitLabel label() const override;
364
365 double singleToTOF(const double x) const override;
366 double singleFromTOF(const double tof) const override;
367 void init() override;
368 Unit *clone() const override;
369 double conversionTOFMin() const override;
370 double conversionTOFMax() const override;
371
374
375protected:
376 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
377 double factorTo;
378 double factorFrom;
379};
380
381MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta,
382 const double offset);
383
384MANTID_KERNEL_DLL double calculateDIFCCorrection(const double l1, const double l2, const double twotheta,
385 const double offset, const double binWidth);
386
387//=================================================================================================
389class MANTID_KERNEL_DLL dSpacing : public Unit {
390public:
391 const std::string unitID() const override;
392 const std::string caption() const override { return "d-Spacing"; }
393 const UnitLabel label() const override;
394 double singleToTOF(const double x) const override;
395 double singleFromTOF(const double tof) const override;
396 void init() override;
397 Unit *clone() const override;
398 double conversionTOFMin() const override;
399 double conversionTOFMax() const override;
400 double calcTofMin(const double difc, const double difa, const double tzero, const double tofmin = 0.);
401 double calcTofMax(const double difc, const double difa, const double tzero, const double tofmax = 0.);
402
404 dSpacing();
405
406protected:
407 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
408 std::string toDSpacingError;
409 double difa;
410 double difc;
411 double tzero;
412};
413
414//=================================================================================================
416class MANTID_KERNEL_DLL dSpacingPerpendicular : public Unit {
417public:
418 const std::string unitID() const override;
419 const std::string caption() const override { return "d-SpacingPerpendicular"; }
420 const UnitLabel label() const override;
421
422 double singleToTOF(const double x) const override;
423 double singleFromTOF(const double tof) const override;
424 void init() override;
425 Unit *clone() const override;
426 double conversionTOFMin() const override;
427 double conversionTOFMax() const override;
428
431
432protected:
433 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
434 double twoTheta;
435 double factorTo;
436 double sfpTo;
437 double factorFrom;
438 double sfpFrom;
439};
440
441//=================================================================================================
443class MANTID_KERNEL_DLL MomentumTransfer : public Unit {
444public:
445 const std::string unitID() const override;
446 const std::string caption() const override { return "q"; }
447 const UnitLabel label() const override;
448
449 double singleToTOF(const double x) const override;
450 double singleFromTOF(const double tof) const override;
451 void init() override;
452 Unit *clone() const override;
453 double conversionTOFMin() const override;
454 double conversionTOFMax() const override;
457
458protected:
459 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
460 double difc;
461};
462
463//=================================================================================================
465class MANTID_KERNEL_DLL QSquared : public MomentumTransfer {
466public:
467 const std::string unitID() const override;
468 const std::string caption() const override { return "Q2"; }
469 const UnitLabel label() const override;
470
471 double singleToTOF(const double x) const override;
472 double singleFromTOF(const double tof) const override;
473 Unit *clone() const override;
474 double conversionTOFMin() const override;
475 double conversionTOFMax() const override;
476
478 QSquared();
479};
480
481//=================================================================================================
483class MANTID_KERNEL_DLL DeltaE : public Unit {
484public:
485 const std::string unitID() const override;
486 const std::string caption() const override { return "Energy transfer"; }
487 const UnitLabel label() const override;
488
489 double singleToTOF(const double x) const override;
490 double singleFromTOF(const double tof) const override;
491 void init() override;
492 Unit *clone() const override;
493
494 double conversionTOFMin() const override;
495 double conversionTOFMax() const override;
496
498 DeltaE();
499
500protected:
501 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
502 double efixed;
503 double factorTo;
504 double factorFrom;
505 double t_other;
506 double t_otherFrom;
507 double unitScaling;
508};
509
510//=================================================================================================
512class MANTID_KERNEL_DLL DeltaE_inWavenumber : public DeltaE {
513public:
514 const std::string unitID() const override;
515 const UnitLabel label() const override;
516
517 void init() override;
518 Unit *clone() const override;
521};
522
523//=================================================================================================
525class MANTID_KERNEL_DLL DeltaE_inFrequency : public DeltaE {
526public:
527 const std::string unitID() const override;
528 const UnitLabel label() const override;
529
530 void init() override;
531 Unit *clone() const override;
534};
535
536//=================================================================================================
538class MANTID_KERNEL_DLL Momentum : public Unit {
539public:
540 const std::string unitID() const override;
541 const std::string caption() const override { return "Momentum"; }
542 const UnitLabel label() const override;
543
544 double singleToTOF(const double ki) const override;
545 double singleFromTOF(const double tof) const override;
546 void init() override;
547 Unit *clone() const override;
548 double conversionTOFMin() const override;
549 double conversionTOFMax() const override;
550
552 Momentum();
553
554protected:
555 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
556 double efixed;
557 double sfpTo;
558 double factorTo;
559 double sfpFrom;
560 double factorFrom;
562};
563
564//=================================================================================================
566class MANTID_KERNEL_DLL SpinEchoLength : public Wavelength {
567public:
568 const std::string unitID() const override;
569 const std::string caption() const override { return "Spin Echo Length"; }
570 const UnitLabel label() const override;
571
572 double singleToTOF(const double x) const override;
573 double singleFromTOF(const double tof) const override;
574 void init() override;
575 Unit *clone() const override;
576 double conversionTOFMin() const override;
577 double conversionTOFMax() const override;
578
581
582private:
583 double efixed;
584};
585
586//=================================================================================================
588class MANTID_KERNEL_DLL SpinEchoTime : public Wavelength {
589public:
590 const std::string unitID() const override;
591 const std::string caption() const override { return "Spin Echo Time"; }
592 const UnitLabel label() const override;
593
594 double singleToTOF(const double x) const override;
595 double singleFromTOF(const double tof) const override;
596 void init() override;
597 Unit *clone() const override;
598 double conversionTOFMin() const override;
599 double conversionTOFMax() const override;
600
602 SpinEchoTime();
603
604private:
605 double efixed;
606};
607
608//=================================================================================================
610class MANTID_KERNEL_DLL Time : public Unit {
611public:
612 const std::string unitID() const override;
613 const std::string caption() const override { return "t"; }
614 const UnitLabel label() const override;
615
616 bool isConvertible() const override { return false; }
617 double singleToTOF(const double x) const override;
618 double singleFromTOF(const double tof) const override;
619 double conversionTOFMax() const override;
620 double conversionTOFMin() const override;
621 void init() override;
622 Unit *clone() const override;
623
625 Time();
626
627protected:
628 double factorTo;
629 double factorFrom;
630};
631
632//=================================================================================================
634class MANTID_KERNEL_DLL Degrees : public Empty {
635public:
636 Degrees();
637 const std::string unitID() const override;
638 const std::string caption() const override { return "Scattering angle"; }
639 const UnitLabel label() const override;
640
641 Unit *clone() const override;
642
643 double singleToTOF(const double x) const override;
644 double singleFromTOF(const double tof) const override;
645
646private:
648};
649
650//=================================================================================================
652class MANTID_KERNEL_DLL Phi : public Degrees {
653 const std::string unitID() const override;
654 const std::string caption() const override { return "Phi"; }
655 Unit *clone() const override { return new Phi(*this); }
656};
657
658//=================================================================================================
660class MANTID_KERNEL_DLL Temperature : public Empty {
661public:
662 Temperature();
663 const std::string unitID() const override;
664 const std::string caption() const override { return "Temperature"; }
665 const UnitLabel label() const override;
666
667 Unit *clone() const override;
668
669 double singleToTOF(const double x) const override;
670 double singleFromTOF(const double tof) const override;
671
672private:
674};
675
676//=================================================================================================
678class MANTID_KERNEL_DLL AtomicDistance : public Empty {
679public:
681 const std::string unitID() const override;
682 const std::string caption() const override { return "Atomic Distance"; }
683 const UnitLabel label() const override;
684
685 Unit *clone() const override;
686
687 double singleToTOF(const double x) const override;
688 double singleFromTOF(const double tof) const override;
689
690private:
692};
693
694//=================================================================================================
695
696MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit);
697
698template <typename T>
699void timeConversionVector(std::vector<T> &vec, const std::string &input_unit, const std::string &output_unit) {
700 double factor = timeConversionValue(std::move(input_unit), std::move(output_unit));
701 if (factor != 1.0)
702 std::transform(vec.begin(), vec.end(), vec.begin(), [factor](T x) -> T { return x * static_cast<T>(factor); });
703}
704
705} // namespace Units
706
707} // namespace Kernel
708} // namespace Mantid
std::vector< T > const * vec
A base-class for the a class that is able to return unit labels in different representations.
Definition UnitLabel.h:20
The base units (abstract) class.
Definition Unit.h:40
virtual Unit * clone() const =0
const UnitParametersMap * m_params
additional parameters l2 :: distance from sample to detector (in metres) twoTheta :: scattering angle...
Definition Unit.h:220
virtual void init()=0
Finalize the initialization.
virtual ~Unit()=default
Virtual destructor.
virtual const UnitLabel label() const =0
A label for the unit to be printed on axes,.
void toTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode, UnitParametersMap const &params)
Convert a range of X values in place from the concrete unit to time-of-flight.
Definition Unit.h:111
virtual double conversionTOFMin() const =0
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
virtual double conversionTOFMax() const =0
This function returns maximal TOF value still reversibly convertible into the unit.
virtual double singleToTOF(const double x) const =0
Convert a single X value to TOF.
virtual bool isConvertible() const
Returns if the unit can be used in conversions.
Definition Unit.h:67
bool initialized
The unit values have been initialized.
Definition Unit.h:209
virtual const std::string caption() const =0
The full name of the unit.
tbb::concurrent_unordered_map< std::string, UnitConversions > ConversionsMap
The possible 'quick conversions' are held in a map with the starting unit as the key.
Definition Unit.h:231
virtual const std::string unitID() const =0
The name of the unit.
std::pair< double, double > ConstantAndPower
A 'quick conversion' requires the constant by which to multiply the input and the power to which to r...
Definition Unit.h:225
virtual double singleFromTOF(const double tof) const =0
Convert a single tof value to this unit.
tbb::concurrent_unordered_map< std::string, ConstantAndPower > UnitConversions
Lists, for a given starting unit, the units to which a 'quick conversion' can be made.
Definition Unit.h:228
void fromTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode, UnitParametersMap const &params)
Convert a range of X values in place from time-of-flight to the concrete unit.
Definition Unit.h:155
double l1
l1 :: The source-sample distance (in metres)
Definition Unit.h:211
static ConversionsMap s_conversionFactors
The table of possible 'quick conversions'.
Definition Unit.h:233
int emode
emode :: The energy mode (0=elastic, 1=direct geometry, 2=indirect geometry)
Definition Unit.h:214
bool isInitialized() const
Definition Unit.h:184
Atomic Distance in Angstroms.
Definition Unit.h:678
const std::string caption() const override
The full name of the unit.
Definition Unit.h:682
const std::string unitID() const override
"AtomicDistance"
Degrees that has degrees as unit and "Scattering angle" as title.
Definition Unit.h:634
const std::string unitID() const override
The name of the unit.
const std::string caption() const override
< Degrees
Definition Unit.h:638
Energy transfer in units of frequency (MHz)
Definition Unit.h:525
const std::string unitID() const override
"DeltaE_inFrequency"
Energy transfer in units of wavenumber (cm^-1)
Definition Unit.h:512
const std::string unitID() const override
"DeltaE_inWavenumber"
Energy transfer in milli-electronvolts.
Definition Unit.h:483
const std::string unitID() const override
"DeltaE"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:486
double factorFrom
Constant factor for from conversion.
Definition Unit.h:504
double factorTo
Constant factor for to conversion.
Definition Unit.h:503
double t_otherFrom
Energy mode dependent factor in from conversion.
Definition Unit.h:506
double unitScaling
Apply unit scaling to energy value.
Definition Unit.h:507
double t_other
Energy mode dependent factor in to conversion.
Definition Unit.h:505
const std::string caption() const override
The full name of the unit.
Definition Unit.h:248
Empty()
Constructor.
Definition Unit.h:261
const std::string unitID() const override
"Empty"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition Unit.h:251
Absolute energy in units of wavenumber (cm^-1)
Definition Unit.h:359
const std::string unitID() const override
"Energy_inWavenumber"
double factorFrom
Constant factor for from conversion.
Definition Unit.h:378
const std::string caption() const override
The full name of the unit.
Definition Unit.h:362
double factorTo
Constant factor for to conversion.
Definition Unit.h:377
Energy in milli-electronvolts.
Definition Unit.h:334
const std::string unitID() const override
"Energy"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:337
double factorTo
Constant factor for to conversion.
Definition Unit.h:353
double factorFrom
Constant factor for from conversion.
Definition Unit.h:354
const std::string caption() const override
The full name of the unit.
Definition Unit.h:269
UnitLabel m_label
Label.
Definition Unit.h:281
std::string m_caption
Caption.
Definition Unit.h:279
const std::string unitID() const override
"Label"
Momentum Transfer in Angstrom^-1.
Definition Unit.h:443
const std::string unitID() const override
"MomentumTransfer"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:446
Momentum in Angstrom^-1.
Definition Unit.h:538
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:557
const std::string unitID() const override
"Momentum"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:541
double sfpFrom
Extra correction factor in from conversion.
Definition Unit.h:559
bool do_sfpFrom
Apply the sfpFrom value.
Definition Unit.h:561
double factorTo
Constant factor for to conversion.
Definition Unit.h:558
double factorFrom
Constant factor for from conversion.
Definition Unit.h:560
Phi that has degrees as unit and "Phi" as title.
Definition Unit.h:652
const std::string caption() const override
< Degrees
Definition Unit.h:654
Unit * clone() const override
Definition Unit.h:655
const std::string unitID() const override
The name of the unit.
Momentum transfer squared in Angstrom^-2.
Definition Unit.h:465
const std::string unitID() const override
"QSquared"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:468
SpinEchoLength in nm.
Definition Unit.h:566
const std::string unitID() const override
"SpinEchoLength"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:569
SpinEchoTime in ns.
Definition Unit.h:588
const std::string unitID() const override
"SpinEchoTime"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:591
Time of flight in microseconds.
Definition Unit.h:286
const std::string caption() const override
The full name of the unit.
Definition Unit.h:289
const std::string unitID() const override
"TOF"
Temperature in kelvin.
Definition Unit.h:660
const std::string unitID() const override
"Temperature"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:664
Time In Second.
Definition Unit.h:610
double factorFrom
Constant factor for from conversion.
Definition Unit.h:629
const std::string caption() const override
The full name of the unit.
Definition Unit.h:613
const std::string unitID() const override
"Time"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition Unit.h:616
double factorTo
Constant factor for to conversion.
Definition Unit.h:628
Wavelength in Angstrom.
Definition Unit.h:305
const std::string caption() const override
The full name of the unit.
Definition Unit.h:308
const std::string unitID() const override
"Wavelength"
bool do_sfpFrom
Apply the sfpFrom value.
Definition Unit.h:329
double sfpFrom
Extra correction factor in from conversion.
Definition Unit.h:327
double factorTo
Constant factor for to conversion.
Definition Unit.h:326
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:325
double factorFrom
Constant factor for from conversion.
Definition Unit.h:328
d-SpacingPerpendicular in Angstrom
Definition Unit.h:416
const std::string caption() const override
The full name of the unit.
Definition Unit.h:419
double sfpFrom
Extra correction factor in to conversion.
Definition Unit.h:438
double factorFrom
Constant factor for from conversion.
Definition Unit.h:437
double factorTo
Constant factor for to conversion.
Definition Unit.h:435
const std::string unitID() const override
"dSpacingPerpendicular"
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:436
d-Spacing in Angstrom
Definition Unit.h:389
const std::string unitID() const override
"dSpacing"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:392
void timeConversionVector(std::vector< T > &vec, const std::string &input_unit, const std::string &output_unit)
Definition Unit.h:699
MANTID_KERNEL_DLL double calculateDIFCCorrection(const double l1, const double l2, const double twotheta, const double offset, const double binWidth)
Calculate DIFC in case of logarithmic binning, used in CalculateDIFC with Signed mode.
Definition Unit.cpp:565
MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta, const double offset)
Calculate and return conversion factor from tof to d-spacing.
Definition Unit.cpp:589
MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit)
Definition Unit.cpp:1430
std::unordered_map< UnitParams, double > UnitParametersMap
Definition Unit.h:29
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)