-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12902 from mantidproject/load_and_save_calfile
The new algorithms can save and load offset, mask and group workspaces as designed. The only issue found is that the instrument of the original mask workspace and the one of saved-loaded mask workspace are not same. I point it out though I think it is another issue to mask workspace. Issue is thus closed.
- Loading branch information
Showing
12 changed files
with
1,080 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadDiffCal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#ifndef MANTID_DATAHANDLING_LOADDIFFCAL_H_ | ||
#define MANTID_DATAHANDLING_LOADDIFFCAL_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
|
||
namespace H5 { | ||
class H5File; | ||
class Group; | ||
} | ||
|
||
namespace Mantid { | ||
namespace DataHandling { | ||
|
||
/** LoadDiffCal : TODO: DESCRIPTION | ||
Copyright © 2015 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> | ||
*/ | ||
class DLLExport LoadDiffCal : public API::Algorithm { | ||
public: | ||
LoadDiffCal(); | ||
virtual ~LoadDiffCal(); | ||
|
||
virtual const std::string name() const; | ||
virtual int version() const; | ||
virtual const std::string category() const; | ||
virtual const std::string summary() const; | ||
|
||
private: | ||
void init(); | ||
void exec(); | ||
void getInstrument(H5::H5File &file); | ||
std::vector<int32_t> readInt32Array(H5::Group &group, const std::string &name); | ||
std::vector<double> readDoubleArray(H5::Group &group, const std::string &name); | ||
void makeGroupingWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &groups); | ||
void makeMaskWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &use); | ||
void makeCalWorkspace(const std::vector<int32_t> &detids, const std::vector<double> &difc, | ||
const std::vector<double> &difa, const std::vector<double> &tzero, | ||
const std::vector<int32_t> &dasids, const std::vector<double> &offsets); | ||
|
||
std::string m_filename; | ||
std::string m_workspaceName; | ||
Geometry::Instrument_const_sptr m_instrument; | ||
}; | ||
|
||
} // namespace DataHandling | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_DATAHANDLING_LOADDIFFCAL_H_ */ |
68 changes: 68 additions & 0 deletions
68
Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/SaveDiffCal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#ifndef MANTID_DATAHANDLING_SAVEDIFFCAL_H_ | ||
#define MANTID_DATAHANDLING_SAVEDIFFCAL_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
#include "MantidAPI/ITableWorkspace_fwd.h" | ||
#include "MantidDataObjects/SpecialWorkspace2D.h" | ||
|
||
namespace H5 { | ||
class Group; | ||
} | ||
|
||
namespace Mantid { | ||
namespace DataHandling { | ||
|
||
/** SaveDiffCal : TODO: DESCRIPTION | ||
Copyright © 2015 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> | ||
*/ | ||
class DLLExport SaveDiffCal : public API::Algorithm { | ||
public: | ||
SaveDiffCal(); | ||
virtual ~SaveDiffCal(); | ||
|
||
virtual const std::string name() const; | ||
virtual int version() const; | ||
virtual const std::string category() const; | ||
virtual const std::string summary() const; | ||
|
||
private: | ||
void init(); | ||
void exec(); | ||
std::map<std::string, std::string> validateInputs(); | ||
|
||
void writeDoubleFieldFromTable(H5::Group &group, const std::string &name); | ||
void writeIntFieldFromTable(H5::Group &group, const std::string &name); | ||
void writeIntFieldFromSVWS(H5::Group &group, const std::string &name, | ||
DataObjects::SpecialWorkspace2D_const_sptr ws); | ||
void generateDetidToIndex(); | ||
bool tableHasColumn(const std::string name) const; | ||
|
||
API::ITableWorkspace_sptr m_calibrationWS; | ||
std::map<detid_t, size_t> m_detidToIndex; | ||
}; | ||
|
||
} // namespace DataHandling | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_DATAHANDLING_SAVEDIFFCAL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.