コード例 #1
0
ファイル: PoldiTruncateData.cpp プロジェクト: BigShows/mantid
/** Returns a MatrixWorkspace with all extra counts
 *
 *  This method takes the input workspce and exracts the extranous time bins that do
 *  not match the experimental parameters. In an experiment with a chopper cycle time
 *  of 1500 microseconds and a time bin width of 3 microseconds, there would be 500 bins
 *  that contain data. If there are more than 500 bins, these can be used to check if
 *  the instrument is okay - there should be only very few counts in these bins.
 *
 *  The method extracts the extra bins and sums them over all spectra (= detector wires),
 *  so if there were 10 extra bins, this workspace will contain one histogram with 10 bins.
 *
 *  @param workspace :: Raw POLDI data.
 *  @return MatrixWorkspace with summed extra counts.
 */
MatrixWorkspace_sptr PoldiTruncateData::getExtraCountsWorkspace(MatrixWorkspace_sptr workspace)
{
    double minimumXValue = getMinimumExtraTimeValue(getCalculatedBinCount());
    MatrixWorkspace_sptr croppedOutput = getWorkspaceAboveX(workspace, minimumXValue);

    return getSummedSpectra(croppedOutput);
}
コード例 #2
0
ファイル: PoldiTruncateData.cpp プロジェクト: BigShows/mantid
void PoldiTruncateData::exec()
{
    MatrixWorkspace_sptr inputWorkspace = getProperty("InputWorkspace");

    setChopperFromWorkspace(inputWorkspace);
    setTimeBinWidthFromWorkspace(inputWorkspace);

    try {
        MatrixWorkspace_sptr cropped = getCroppedWorkspace(inputWorkspace);
        setProperty("OutputWorkspace", cropped);

        if(!getPointerToProperty("ExtraCountsWorkspaceName")->isDefault()) {
            try {
                MatrixWorkspace_sptr extraCounts = getExtraCountsWorkspace(inputWorkspace);

                std::string extraCountsWorkspaceName = getProperty("ExtraCountsWorkspaceName");
                declareProperty(new WorkspaceProperty<MatrixWorkspace>("ExtraCountsWorkspace", extraCountsWorkspaceName, Direction::Output));
                setProperty("ExtraCountsWorkspace", extraCounts);
            } catch(std::invalid_argument) {
                m_log.warning() << "Extra count information was requested, but there are no extra bins." << std::endl;
            }
        }
    } catch(std::invalid_argument) {
        m_log.error() << "Cannot crop workspace. Please check the timing information." << std::endl;
        m_log.error() << "  Calculated bin count: " << getCalculatedBinCount() << std::endl;
        m_log.error() << "  Bin count in the workspace: " << getActualBinCount() << std::endl;

        removeProperty("OutputWorkspace");
    }
}
コード例 #3
0
/** Returns a MatrixWorkspace cropped to the correct time bin count
 *
 *  @param workspace :: Raw POLDI data with possible additional time bins.
 *  @return Workspace with exactly as many time bins as expected for the
 *experiment parameters.
 */
MatrixWorkspace_sptr
PoldiTruncateData::getCroppedWorkspace(MatrixWorkspace_sptr workspace) {
  double maximumXValue = getMaximumTimeValue(getCalculatedBinCount());

  return getWorkspaceBelowX(workspace, maximumXValue);
}