Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
1dff0833
Commit
1dff0833
authored
Feb 14, 2017
by
Antti Soininen
Browse files
Code beautification.
Re #18842
parent
28275545
Changes
3
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/inc/MantidDataHandling/LoadILLTOF2.h
View file @
1dff0833
...
...
@@ -60,9 +60,9 @@ private:
void
exec
()
override
;
void
loadInstrumentDetails
(
NeXus
::
NXEntry
&
);
std
::
vector
<
std
::
vector
<
int
>>
getMonitorInfo
(
NeXus
::
NXEntry
&
firstEntry
);
std
::
vector
<
std
::
vector
<
int
>
>
getMonitorInfo
(
NeXus
::
NXEntry
&
firstEntry
);
void
initWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
);
const
std
::
vector
<
std
::
vector
<
int
>
>
&
);
void
initInstrumentSpecific
();
void
addAllNexusFieldsAsProperties
(
const
std
::
string
&
filename
);
void
addEnergyToRun
();
...
...
@@ -71,9 +71,8 @@ private:
void
loadTimeDetails
(
NeXus
::
NXEntry
&
entry
);
void
loadDataIntoTheWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
);
void
loadSpectra
(
size_t
&
spec
,
const
size_t
numberOfTubes
,
const
std
::
vector
<
std
::
vector
<
int
>
>
&
);
void
loadSpectra
(
size_t
&
spec
,
const
size_t
numberOfTubes
,
const
std
::
vector
<
Mantid
::
detid_t
>
&
detectorIDs
,
NeXus
::
NXInt
data
,
Mantid
::
API
::
Progress
progress
);
...
...
Framework/DataHandling/src/LoadILLTOF2.cpp
View file @
1dff0833
...
...
@@ -21,8 +21,9 @@ using namespace HistogramData;
DECLARE_NEXUS_FILELOADER_ALGORITHM
(
LoadILLTOF2
)
/// A vector containing the supported instrument names
const
std
::
vector
<
std
::
string
>
LoadILLTOF2
::
SUPPORTED_INSTRUMENTS
=
{
"IN4"
,
"IN5"
,
"IN6"
};
const
std
::
vector
<
std
::
string
>
LoadILLTOF2
::
SUPPORTED_INSTRUMENTS
=
{
"IN4"
,
"IN5"
,
"IN6"
};
/**
* Return the confidence with with this algorithm can load the file
...
...
@@ -38,12 +39,11 @@ int LoadILLTOF2::confidence(Kernel::NexusDescriptor &descriptor) const {
if
(
descriptor
.
pathExists
(
"/entry0/wavelength"
)
&&
descriptor
.
pathExists
(
"/entry0/experiment_identifier"
)
&&
descriptor
.
pathExists
(
"/entry0/mode"
)
&&
!
descriptor
.
pathExists
(
"/entry0/dataSD"
)
// This one is for LoadILLIndirect
&&
!
descriptor
.
pathExists
(
"/entry0/instrument/VirtualChopper"
)
// This one is for
// LoadILLReflectometry
!
descriptor
.
pathExists
(
"/entry0/dataSD"
)
// This one is for
// LoadILLIndirect
&&
!
descriptor
.
pathExists
(
"/entry0/instrument/VirtualChopper"
)
// This one is for
// LoadILLReflectometry
)
{
return
80
;
}
else
{
...
...
@@ -61,8 +61,8 @@ void LoadILLTOF2::init() {
make_unique
<
FileProperty
>
(
"Filename"
,
""
,
FileProperty
::
Load
,
".nxs"
),
"File path of the Data file to load"
);
declareProperty
(
make_unique
<
WorkspaceProperty
<>>
(
"OutputWorkspace"
,
""
,
Direction
::
Output
),
declareProperty
(
make_unique
<
WorkspaceProperty
<>
>
(
"OutputWorkspace"
,
""
,
Direction
::
Output
),
"The name to use for the output workspace"
);
}
...
...
@@ -108,10 +108,10 @@ void LoadILLTOF2::exec() {
*
* @return List of monitor data
*/
std
::
vector
<
std
::
vector
<
int
>>
std
::
vector
<
std
::
vector
<
int
>
>
LoadILLTOF2
::
getMonitorInfo
(
NeXus
::
NXEntry
&
firstEntry
)
{
std
::
vector
<
std
::
vector
<
int
>>
monitorList
;
std
::
vector
<
std
::
vector
<
int
>
>
monitorList
;
for
(
std
::
vector
<
NXClassInfo
>::
const_iterator
it
=
firstEntry
.
groups
().
begin
();
...
...
@@ -168,8 +168,9 @@ void LoadILLTOF2::loadInstrumentDetails(NeXus::NXEntry &firstEntry) {
* @param entry The NeXus entry
* @param monitors List of monitor data
*/
void
LoadILLTOF2
::
initWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
)
{
void
LoadILLTOF2
::
initWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>
>
&
monitors
)
{
// read in the data
NXData
dataGroup
=
entry
.
openNXData
(
"data"
);
...
...
@@ -333,7 +334,7 @@ void LoadILLTOF2::addPulseInterval() {
* @param monitors List of monitor data
*/
void
LoadILLTOF2
::
loadDataIntoTheWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
)
{
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>
>
&
monitors
)
{
g_log
.
debug
()
<<
"Loading data into the workspace...
\n
"
;
// read in the data
...
...
@@ -358,8 +359,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace(
Progress
progress
(
this
,
0
,
1
,
m_numberOfTubes
*
m_numberOfPixelsPerTube
);
loadSpectra
(
spec
,
m_numberOfTubes
,
detectorIDs
,
data
,
progress
);
loadSpectra
(
spec
,
m_numberOfTubes
,
detectorIDs
,
data
,
progress
);
g_log
.
debug
()
<<
"Loading detector data into the workspace: DONE!
\n
"
;
...
...
@@ -379,8 +379,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace(
Progress
progressRosace
(
this
,
0
,
1
,
numberOfTubes
*
m_numberOfPixelsPerTube
);
loadSpectra
(
spec
,
numberOfTubes
,
detectorIDs
,
dataRosace
,
progressRosace
);
loadSpectra
(
spec
,
numberOfTubes
,
detectorIDs
,
dataRosace
,
progressRosace
);
}
const
auto
monitorIDs
=
instrument
->
getMonitors
();
...
...
@@ -405,8 +404,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace(
* @param data The NeXus data to load into the workspace
* @param progress The progress monitor
*/
void
LoadILLTOF2
::
loadSpectra
(
size_t
&
spec
,
const
size_t
numberOfTubes
,
void
LoadILLTOF2
::
loadSpectra
(
size_t
&
spec
,
const
size_t
numberOfTubes
,
const
std
::
vector
<
detid_t
>
&
detectorIDs
,
NXInt
data
,
Progress
progress
)
{
for
(
size_t
i
=
0
;
i
<
numberOfTubes
;
++
i
)
{
...
...
@@ -415,8 +413,7 @@ void LoadILLTOF2::loadSpectra(size_t &spec,
m_localWorkspace
->
setHistogram
(
spec
,
m_localWorkspace
->
binEdges
(
0
),
Counts
(
data_p
,
data_p
+
m_numberOfChannels
));
m_localWorkspace
->
getSpectrum
(
spec
)
.
setDetectorID
(
detectorIDs
[
spec
]);
m_localWorkspace
->
getSpectrum
(
spec
).
setDetectorID
(
detectorIDs
[
spec
]);
spec
++
;
progress
.
report
();
}
...
...
@@ -437,7 +434,8 @@ void LoadILLTOF2::runLoadInstrument() {
loadInst
->
setProperty
(
"RewriteSpectraMap"
,
Mantid
::
Kernel
::
OptionalBool
(
false
));
loadInst
->
execute
();
}
catch
(...)
{
}
catch
(...)
{
g_log
.
information
(
"Cannot load the instrument definition."
);
}
}
...
...
Framework/DataHandling/test/LoadILLTOF2Test.h
View file @
1dff0833
...
...
@@ -40,12 +40,10 @@ public:
* This test only loads the Sample Data
* The elastic peak is obtained on the fly from the sample data.
*/
MatrixWorkspace_sptr
loadDataFile
(
const
std
::
string
dataFile
,
const
size_t
numberOfHistograms
,
const
size_t
numberOfMonitors
,
const
size_t
numberOfChannels
,
const
double
tofDelay
,
const
double
tofChannelWidth
)
{
MatrixWorkspace_sptr
loadDataFile
(
const
std
::
string
dataFile
,
const
size_t
numberOfHistograms
,
const
size_t
numberOfMonitors
,
const
size_t
numberOfChannels
,
const
double
tofDelay
,
const
double
tofChannelWidth
)
{
LoadILLTOF2
loader
;
loader
.
setRethrows
(
true
);
TS_ASSERT_THROWS_NOTHING
(
loader
.
initialize
())
...
...
@@ -112,8 +110,8 @@ public:
const
size_t
histogramCount
=
397
;
const
size_t
monitorCount
=
1
;
MatrixWorkspace_sptr
ws
=
loadDataFile
(
"ILL/IN4/084446.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
loadDataFile
(
"ILL/IN4/084446.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
const
double
pulseInterval
=
ws
->
run
().
getLogAsSingleValue
(
"pulse_interval"
);
...
...
@@ -127,8 +125,8 @@ public:
const
size_t
channelCount
=
512
;
const
size_t
histogramCount
=
98305
;
const
size_t
monitorCount
=
1
;
loadDataFile
(
"ILL/IN5/104007.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
loadDataFile
(
"ILL/IN5/104007.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
}
void
test_IN6_load
()
{
...
...
@@ -139,8 +137,8 @@ public:
const
size_t
histogramCount
=
340
;
const
size_t
monitorCount
=
3
;
MatrixWorkspace_sptr
ws
=
loadDataFile
(
"ILL/IN6/164192.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
loadDataFile
(
"ILL/IN6/164192.nxs"
,
histogramCount
,
monitorCount
,
channelCount
,
tofDelay
,
tofChannelWidth
);
const
double
pulseInterval
=
ws
->
run
().
getLogAsSingleValue
(
"pulse_interval"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment