From 707cb42a03757367f935082f58576c66595c4fec Mon Sep 17 00:00:00 2001 From: Samuel Jones <samjones714@gmail.com> Date: Mon, 13 Aug 2018 09:24:11 +0100 Subject: [PATCH] Re #22705 Bug fixes, improvements and documentation. --- .../inc/MantidDataHandling/LoadPSIMuonBin.h | 24 ++++++ Framework/DataHandling/src/Load.cpp | 1 + Framework/DataHandling/src/LoadPSIMuonBin.cpp | 83 ++++++++++++++++++- docs/source/algorithms/LoadPSIMuonBin-v1.rst | 34 ++++++++ docs/source/release/v3.14.0/muon.rst | 1 + instrument/Facilities.xml | 14 +++- 6 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 docs/source/algorithms/LoadPSIMuonBin-v1.rst diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h b/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h index 37a5339f65f..c3048984058 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h @@ -7,6 +7,30 @@ #include "MantidKernel/BinaryStreamReader.h" #include <cstdint> +/** LoadPSIMuonBin : Loads a bin file from the PSI facility for muon spectroscopy + + Copyright © 2018 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + File change history is stored at: <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> + */ + namespace Mantid { namespace DataHandling { diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 5d17398df7b..db1b67746d6 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -284,6 +284,7 @@ void Load::init() { exts.emplace_back(".hd5"); exts.emplace_back(".sqw"); exts.emplace_back(".fits"); + exts.emplace_back(".bin"); declareProperty( Kernel::make_unique<MultipleFileProperty>("Filename", exts), diff --git a/Framework/DataHandling/src/LoadPSIMuonBin.cpp b/Framework/DataHandling/src/LoadPSIMuonBin.cpp index 4d15bcafdc3..5fd1f661e27 100644 --- a/Framework/DataHandling/src/LoadPSIMuonBin.cpp +++ b/Framework/DataHandling/src/LoadPSIMuonBin.cpp @@ -430,8 +430,8 @@ void LoadPSIMuonBin::assignOutputWorkspaceParticulars( i < sizeof(m_header.firstGood) / sizeof(*m_header.firstGood); ++i) { if (m_header.firstGood[i] != 0) { logAlg->setProperty("LogType", "String"); - logAlg->setProperty("LogName", "Spectra" + std::to_string(i) + - "first and last good"); + logAlg->setProperty("LogName", "First and Last good for Spectra #" + + std::to_string(i)); logAlg->setProperty("LogText", std::to_string(m_header.firstGood[i]) + " - " + std::to_string(m_header.lastGood[i])); @@ -444,6 +444,85 @@ void LoadPSIMuonBin::assignOutputWorkspaceParticulars( logAlg->setProperty("LogName", "Total Number of Events"); logAlg->setProperty("LogText", std::to_string(m_header.totalEvents)); logAlg->executeAsChildAlg(); + + // tdcResolution + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "TDC Resolution"); + logAlg->setProperty("LogText", std::to_string(m_header.tdcResolution)); + logAlg->executeAsChildAlg(); + + // tdcOverflow + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "TDC Overflow"); + logAlg->setProperty("LogText", std::to_string(m_header.tdcOverflow)); + logAlg->executeAsChildAlg(); + + // Length of spectra + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Spectra Length"); + logAlg->setProperty("LogText", std::to_string(m_header.lengthOfHistograms)); + logAlg->executeAsChildAlg(); + + // Number of Spectra + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Number of Spectra"); + logAlg->setProperty("LogText", std::to_string(m_header.numberOfHistograms)); + logAlg->executeAsChildAlg(); + + // monNumber of events + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon number of events"); + logAlg->setProperty("LogText", std::to_string(m_header.monNumberOfevents)); + logAlg->executeAsChildAlg(); + + // Mon Period + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon Period"); + logAlg->setProperty("LogText", std::to_string(m_header.periodOfMon)); + logAlg->executeAsChildAlg(); + + if (m_header.monLow[0] == 0 && m_header.monHigh[0] == 0) { + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon Low"); + logAlg->setProperty("LogText", "0"); + logAlg->executeAsChildAlg(); + + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon High"); + logAlg->setProperty("LogText", "0"); + logAlg->executeAsChildAlg(); + } else { + for (auto i = 0u; i < 4; ++i) { + if (m_header.monLow[i] == 0 || m_header.monHigh[i] == 0) + break; + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon Low" + i); + logAlg->setProperty("LogText", std::to_string(m_header.monLow[i])); + logAlg->executeAsChildAlg(); + + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon High + i"); + logAlg->setProperty("LogText", std::to_string(m_header.monHigh[i])); + logAlg->executeAsChildAlg(); + } + } + + // Mon Deviation + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "Mon Deviation"); + logAlg->setProperty("LogText", m_header.monDeviation); + logAlg->executeAsChildAlg(); + + if (m_header.realT0[0] != 0) { + for (auto i = 0u; i < 16; ++i) { + if (m_header.realT0[i] == 0) + break; + logAlg->setProperty("LogType", "String"); + logAlg->setProperty("LogName", "realT0 + i"); + logAlg->setProperty("LogText", std::to_string(m_header.realT0[i])); + logAlg->executeAsChildAlg(); + } + } } } // namespace DataHandling diff --git a/docs/source/algorithms/LoadPSIMuonBin-v1.rst b/docs/source/algorithms/LoadPSIMuonBin-v1.rst new file mode 100644 index 00000000000..b05475d92d8 --- /dev/null +++ b/docs/source/algorithms/LoadPSIMuonBin-v1.rst @@ -0,0 +1,34 @@ +.. algorithm:: + +.. summary:: + +.. relatedalgorithms:: + +.. properties:: + +Description +----------- + +The algorithm LoadPSIMuonBin will read in a .bin file from the PSI +facility, from one of the various machines that use that format. +The file name can be absolute or relative path and should have the +extension .bin. The file should only be loaded if the first two bytes +are "1N" representing it as the format that this will load. + +Errors +###### + +The error for each histogram count is set as the square root of the +number of counts. + +Child Algorithms used +##################### + +The ChildAlgorithms used by LoadMuonNexus are: + +* :ref:`algm-AddSampleLog-v1` - It adds to the Sample Log of the +workspace + +.. categories:: + +.. sourcelink:: diff --git a/docs/source/release/v3.14.0/muon.rst b/docs/source/release/v3.14.0/muon.rst index e0350f5c48c..1b9f534c317 100644 --- a/docs/source/release/v3.14.0/muon.rst +++ b/docs/source/release/v3.14.0/muon.rst @@ -25,6 +25,7 @@ New - :ref:`ApplyMuonDetectorGrouping <algm-ApplyMuonDetectorGrouping>` added to allow scripting of the Muon Analysis GUI workflow. Applies grouping counts/asymmetry to muon data and stores the result in the ADS. - :ref:`ApplyMuonDetectorGroupPairing <algm-ApplyMuonDetectorGroupPairing>` added to allow scripting of the Muon Analysis GUI workflow. Applies a group pairing asymmetry calculation to muon data and stores the result in the ADS. - :ref:`LoadAndApplyMuonDetectorGrouping <algm-LoadAndApplyMuonDetectorGrouping>` added to allow scripting of the Muon Analysis GUI workflow. The grouping/pairing information is loaded from an XML format file, which can be produced through the muon analysis GUI via the 'Save Grouping' button. Replicates the `Load Grouping` button of the grouping tab, adds workspaces to the ADS. +- :ref:`LoadPSIMuonBin <algm-LoadPSIMuonBin>` added the ability to load a .bin file from the PSI facility in switzerland, as a workspace. Improvements ############ diff --git a/instrument/Facilities.xml b/instrument/Facilities.xml index 2e820c06b58..cec94122942 100644 --- a/instrument/Facilities.xml +++ b/instrument/Facilities.xml @@ -778,7 +778,8 @@ </facility> -<facility name="SmuS" FileExtensions=".nxs,.xml"> +<!-- PSI Facility (Switzerland) --> +<facility name="SmuS" FileExtensions=".nxs,.xml,.bin"> <timezone>Europe/Zurich</timezone> <instrument name="GPD"> @@ -791,6 +792,17 @@ <technique>Muon spectroscopy</technique> </instrument> + <instrument name="DOLLY"> + <technique>Muon spectroscopy</technique> + </instrument> + + <instrument name="LEM"> + <technique>Muon spectroscopy</technique> + </instrument> + + <instrument name="LTF"> + <technique>Muon spectroscopy</technique> + </instrument> </facility> <!-- Reactor Orphee (France) --> -- GitLab