Commit dd0b10a2 authored by Geish Miladinovic's avatar Geish Miladinovic
Browse files

add pelican reduction to base (no ticket)

parent fe9217b3
......@@ -447,7 +447,7 @@ void LoadPLN::init() {
declareProperty(std::make_unique<API::FileProperty>(FilenameStr, "", API::FileProperty::Load, exts),
"The input filename of the stored data");
declareProperty(PathToBinaryStr, "", std::make_shared<Kernel::MandatoryValidator<std::string>>(),
declareProperty(PathToBinaryStr, "./", std::make_shared<Kernel::MandatoryValidator<std::string>>(),
"Relative or absolute path to the compressed binary\n"
"event file linked to the HDF file, eg /storage/data/");
......@@ -857,7 +857,9 @@ void LoadPLN::exec() {
// dataset index to be loaded
m_datasetIndex = getProperty(SelectDatasetStr);
// if path provided build the file path
// if path provided build the file path from the directory name and dataset
// number from the hdf file, however if this is not a valid path then try
// the basename with a '.bin' extension
if (fs::is_directory(evtPath)) {
NeXus::NXRoot root(hdfFile);
NeXus::NXEntry entry = root.openFirstEntry();
......@@ -869,15 +871,25 @@ void LoadPLN::exec() {
dataset = 0;
}
// build the path to the event file as if a relative or absolute
// path is passed:
// 'relpath/[daq_dirname]/DATASET_[n]/EOS.bin' or the
// build the path to the event file using the standard storage convention at ansto:
// 'relpath/[daq_dirname]/DATASET_[n]/EOS.bin'
// but if the file is missing, try relpath/{source}.bin
char buffer[255] = {};
snprintf(buffer, sizeof(buffer), "%s/DATASET_%d/EOS.bin", eventDir.c_str(), dataset);
fs::path path = evtPath;
path /= buffer;
path = fs::absolute(path);
evtPath = path.generic_string();
std::string nomPath = path.generic_string();
if (fs::is_regular_file(nomPath)) {
evtPath = nomPath;
} else {
fs::path hp = hdfFile;
snprintf(buffer, sizeof(buffer), "%s.bin", hp.stem().generic_string().c_str());
fs::path path = evtPath;
path /= buffer;
path = fs::absolute(path);
evtPath = path.generic_string();
}
}
// finally check that the event file exists
......
......@@ -144,6 +144,7 @@ set(PYTHON_PLUGINS
algorithms/PeakMatching.py
algorithms/PearlMCAbsorption.py
algorithms/PEARLTransfit.py
algorithms/PelicanReduction.py
algorithms/PoldiCreatePeaksFromFile.py
algorithms/PoldiLoadRuns.py
algorithms/PoldiMerge.py
......
79aafceb503b927a2725e392c41b8f7f
.. algorithm::
.. summary::
.. relatedalgorithms::
.. properties::
Description
-----------
Reduces the data from the Pelican instrument from time of flight versus two theta to S(Q,w). Data can be corrected for background with an empty can subtraction and normalised to vanadium (both optional). Output can be for a powder S(Q,w) or for a single crystal S(Q,w) in the latter case an nxspe file is written. Data can be processed for the specified region of Q and w space. Data can also be processed for the lamda/2 option for Pelican. As a default the output for a powder also includes the Q integrated data S(ω) and the energy integrated data S(Q).
The portion of the detector that is used is defined in the config file. A frame overlap option is also available, where for low temperature data, a portion of the neutron energy gain spectrum can be used to extend the range of the neutron energy loss side.
Usage
-----
.. testcode:: PelicanReductionExample
test = PelicanReduction('44464', EnergyTransfer='-2,0.05,2', MomentumTransfer='0,0.05,2', ConfigurationFile='pelican_doctest.ini')
print('Workspaces in group = {}'.format(test.getNumberOfEntries()))
gp = test.getNames()
print('First workspace: {}'.format(gp[0]))
.. testoutput:: PelicanReductionExample
Workspaces in group = 3
First workspace: test_qw1_1D_dE
References
----------
.. sourcelink::
.. categories::
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment