\(\renewcommand\AA{\unicode{x212B}}\)

LoadEventAndCompress v1

../_images/LoadEventAndCompress-v1_dlg.png

LoadEventAndCompress dialog.

Summary

Load an event workspace by chunks and compress

Properties

Name Direction Type Default Description
Filename Input string Mandatory The name of the Event NeXus file to read, including its full or relative path. The file name is typically of the form INST_####_event.nxs (N.B. case sensitive if running on Linux). Allowed extensions: [‘.nxs.h5’, ‘.nxs’, ‘_event.nxs’]
OutputWorkspace Output Workspace Mandatory The name of the output EventWorkspace or WorkspaceGroup in which to load the EventNexus file.
MaxChunkSize Input number Optional Get chunking strategy for chunks with this number of Gbytes. File will not be loaded if this option is set.
CompressTOFTolerance Input number 0.01  
FilterByTofMin Input number Optional Optional: To exclude events that do not fall within a range of times-of-flight. This is the minimum accepted value in microseconds. Keep blank to load all events.
FilterByTofMax Input number Optional Optional: To exclude events that do not fall within a range of times-of-flight. This is the maximum accepted value in microseconds. Keep blank to load all events.
FilterByTimeStart Input number Optional Optional: To only include events after the provided start time, in seconds (relative to the start of the run).
FilterByTimeStop Input number Optional Optional: To only include events before the provided stop time, in seconds (relative to the start of the run).
NXentryName Input string   Optional: Name of the NXentry to load if it’s not the default.
LoadMonitors Input boolean False Load the monitors from the file (optional, default False).
MonitorsLoadOnly Input string   If multiple repesentations exist, which one to load. Default is to load the one that is present. Allowed values: [‘’, ‘Events’, ‘Histogram’]
FilterMonByTofMin Input number Optional Optional: To exclude events from monitors that do not fall within a range of times-of-flight. This is the minimum accepted value in microseconds.
FilterMonByTofMax Input number Optional Optional: To exclude events from monitors that do not fall within a range of times-of-flight. This is the maximum accepted value in microseconds.
FilterMonByTimeStart Input number Optional Optional: To only include events from monitors after the provided start time, in seconds (relative to the start of the run).
FilterMonByTimeStop Input number Optional Optional: To only include events from monitors before the provided stop time, in seconds (relative to the start of the run).
FilterBadPulses Input number 95  

Description

This is a workflow algorithm that loads an event nexus file in chunks and compresses the resulting chunks before summing them. It uses the algorithms:

  1. DetermineChunking v1
  2. LoadEventNexus v1
  3. FilterBadPulses v1
  4. CompressEvents v1
  5. Plus v1 to accumulate

Usage

Example - LoadEventAndCompress

The files needed for this example are not present in our standard usage data download due to their size. They can however be downloaded using these links: PG3_9830_event.nxs.

PG3_9830_event = LoadEventAndCompress(Filename='PG3_9830_event.nxs',
                                      MaxChunkSize=1.)

Example - Usage with MPI

Create a python driver script called test_mpi.py

from mantid.simpleapi import *
import mantid
if AlgorithmFactory.exists('GatherWorkspaces'):
    HAVE_MPI = True
    from mpi4py import MPI
    mpiRank = MPI.COMM_WORLD.Get_rank()
    mpiSize = MPI.COMM_WORLD.Get_size()
else:
    HAVE_MPI = False
    mpiRank = 0 # simplify if clauses
    mpiSize = 1 # simplify if clauses

wksp = LoadEventAndCompress(Filename="PG3_2538_event.nxs")
print("Rank =  {} Number of Events =  {}".format(mpiRank, wksp.getNumberEvents()))
if mpiRank == 0:
    reduce = AlignAndFocusPowder(InputWorkspace=wksp, CalFileName='PG3_calibrate_d2538_2014_05_13.cal', Params='0.5,0.01,2')
    SaveNexus(reduce,Filename=str(mpiSize)+"tasks.nxs")

And run it using the following commands

$ module load mpi/openmpi-x86_64
$ export LD_PRELOAD=/usr/lib64/openmpi/lib/libmpi.so
$ mpirun -np 8 mantidpython test_mpi.py

to run without mpi is simply

$ mantidpython test_mpi.py

Categories: AlgorithmIndex | Workflow\DataHandling