PoldiMerge v1

../_images/PoldiMerge-v1_dlg.png

PoldiMerge dialog.

Summary

PoldiMerge takes a list of workspace names and adds the counts, resulting in a new workspace.

Properties

Name Direction Type Default Description
WorkspaceNames Input str list   List of Workspace names to merge.
OutputWorkspace Output Workspace MergedPoldiWorkspaces Workspace where all counts from the list workspaces have been added
CheckInstruments Input boolean True If checked, only workspaces with equalinstrument parameters are merged. Do not disable without a very good reason.

Description

PoldiMerge takes a list of workspace names and adds the counts, resulting in a new workspace. The difference to Plus v1 is that it performs some POLDI-specific tests that determine whether merging those files is sensible or not. The following requirements have to be fulfilled:

  • The time-binning (x-data) of all workspaces must match (offset as well as width of time bins)
  • These quantities from the sample log:
    • Position of the sample table (x, y and z)
    • Rotation speed of the chopper

The algorithm does not perform partial summation - if any of the workspaces does not fulfill the criteria, the intermediate result is discarded.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.

This small usage example merges two compatible POLDI-files which have been loaded before.

# Load the first data file and the correct instrument
raw_6903 = LoadSINQFile(Filename = "poldi2013n006903.hdf", Instrument = "POLDI")
LoadInstrument(raw_6903, RewriteSpectraMap=True, InstrumentName = "POLDI")

# Use Integration and SumSpectra to sum all counts in the spectrum.
# The data must be converted to histogram data for Integration to work.
histo_6903 = ConvertToHistogram(raw_6903)
spectra_6903 = Integration(histo_6903)
total_6903 = SumSpectra(spectra_6903)

# The result has one spectrum with one bin, which contains the total counts.
counts_6903 = int(total_6903.dataY(0)[0])
print "6903 contains a total of", counts_6903, "counts."

# The same with the second data file
raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI")
LoadInstrument(raw_6904, RewriteSpectraMap=True, InstrumentName = "POLDI")
histo_6904 = ConvertToHistogram(raw_6904)
spectra_6904 = Integration(histo_6904)
total_6904 = SumSpectra(spectra_6904)

counts_6904 = int(total_6904.dataY(0)[0])
print "6904 contains a total of", counts_6904, "counts."

# Now PoldiMerge is used to merge the two raw spectra by supplying a list of workspace names.
raw_summed = PoldiMerge("raw_6903,raw_6904")

# The merged data is integrated as well.
histo_summed = ConvertToHistogram(raw_summed)
spectra_summed = Integration(histo_summed)
total_summed = SumSpectra(spectra_summed)

print "6903+6904 contains a total of", int(total_summed.dataY(0)[0]), "counts."
print "Summing the counts of the single data files leads to", counts_6903 + counts_6904, "counts."

Output:

6903 contains a total of 769269 counts.
6904 contains a total of 766777 counts.
6903+6904 contains a total of 1536046 counts.
Summing the counts of the single data files leads to 1536046 counts.

Categories: Algorithms | SINQ\Poldi