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

SavePolarizedNXcanSAS v1

Summary

Save a Group Workspace with reduced SANS polarized data in NXcanSAS Format.

See Also

SaveNXcanSAS, LoadNXcanSAS

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

Workspace

Mandatory

The input workspace, which must be in units of Q. Can be a 1D or a 2D workspace.

Filename

Input

string

Mandatory

The name of the .h5 file to save. Allowed extensions: [‘.h5’]

RadiationSource

Input

string

Spallation Neutron Source

The type of radiation used. Allowed values: [‘Spallation Neutron Source’, ‘Pulsed Reactor Neutron Source’, ‘Reactor Neutron Source’, ‘Synchrotron X-ray Source’, ‘Pulsed Muon Source’, ‘Rotating Anode X-ray’, ‘Fixed Tube X-ray’, ‘neutron’, ‘x-ray’, ‘muon’, ‘electron’]

DetectorNames

Input

string

Specify in a comma separated list, which detectors to store information about; where each name must match a name given for a detector in the [[IDF|instrument definition file (IDF)]]. IDFs are located in the instrument sub-directory of the Mantid install directory.

Transmission

Input

MatrixWorkspace

The transmission workspace. Optional. If given, will be saved at TransmissionSpectrum

TransmissionCan

Input

MatrixWorkspace

The transmission workspace of the Can. Optional. If given, will be saved at TransmissionSpectrum

SampleTransmissionRunNumber

Input

string

The run number for the sample transmission workspace. Optional.

SampleDirectRunNumber

Input

string

The run number for the sample direct workspace. Optional.

CanScatterRunNumber

Input

string

The run number for the can scatter workspace. Optional.

CanDirectRunNumber

Input

string

The run number for the can direct workspace. Optional.

BackgroundSubtractionWorkspace

Input

string

The name of the workspace used in the scaled background subtraction, to be included in the metadata. Optional.

BackgroundSubtractionScaleFactor

Input

number

0

The scale factor used in the scaled background subtraction, to be included in the metadata. Optional.

Geometry

Input

string

Unknown

The geometry type of the collimation. Allowed values: [‘Cylinder’, ‘FlatPlate’, ‘Flat plate’, ‘Disc’, ‘Unknown’]

SampleHeight

Input

number

0

The height of the collimation element in mm. If specified as 0 it will not be recorded.

SampleWidth

Input

number

0

The width of the collimation element in mm. If specified as 0 it will not be recorded.

SampleThickness

Input

number

0

The thickness of the sample in mm. If specified as 0 it will not be recorded.

InputSpinStates

Input

string

The order of the spin states in the input group workspace: +1 Polarization parallel to polarizer, -1 antiparallel and 0 no polarization

PolarizerComponentName

Input

string

The name of the Polarizer Component as defined in the IDF. i.e. ‘short-polarizer’

AnalyzerComponentName

Input

string

The name of the Analyzer Component as defined in the IDF. i.e. ‘helium-analyzer’

FlipperComponentNames

Input

string

Comma separated list of flipper components as defined in the IDF i.e. ‘RF-flipper

MagneticFieldStrengthLogName

Input

string

The name of sample logs in which the magnetic field strength is stored

MagneticFieldDirection

Input

string

Direction of the magnetic field on the sample: comma separated vectorwith three values: Polar, Azimuthal and Rotation angles

Description

Saves a workspace with momentum transfer units into a file adhering to the NXcanSAS format specified by NXcanSAS Data Formats Working Group schema.

This algorithm in particular, adheres to the WIP proposal to update the format to include reduced SANS polarized data.

The algorithm is an extension of SaveNXcanSAS v1, all the metadata available in SaveNXcanSAS v1 can be saved here too.

The InputWorkspace property must be a Workspace Group containing as many members as measured polarization states, which typically would be 2 members for half-polarized SANS measurements and 4 members for full-polarized SANS.

The spin states are set through the InputSpinStates property, every polarization configuration is defined as a PinPout pair, with the possible values for each spin state before (Pin) or after (Pout) the sample being “+1”, “-1” or “0” as defined in the proposal. There must be as many PinPout pairs as workspace members in the InputWorkspace property, in the same order of polarization as that on the workspaces. For example, a full polarized measurement could be defined in the InputSpinStates property as “+1+1,-1+1,-1-1,-1-1” , with “-1-1” and “+1+1” being the non spin-flip configurations and “-1+1 , +1-1” the spin-flip ones.

In addition, the magnetic field strength can be added by referring to the sample log of the InputWorkspace containing the data in MagneticFieldStrengthLogName, the direction of the magnetic field in spherical coordinates is specified in the MagneticFieldDirection property by setting the dimensions of the spherical vector (polar, azimuthal, rotation angles) as comma separated values.

The information for the polarizing components (polarizer, flippers, analyzer) must be specified in PolarizerComponentName, FlipperComponentNames, AnalyzerComponentName properties by writing the polarizer component name as defined in the corresponding Instrument Definition File (IDF). For each component; name, type and distance to sample will be written in the the corresponding dataset. If there is more than one flipper, they can be added by their IDF component name as comma separated lists in the FlipperComponentNames property.

Usage

Example

#Create sample workspace group with simple test data and adding ZOOM instrument.
names = []
for n in range(4):
    name = f"out_{n}"
    CreateSampleWorkspace(OutputWorkspace=name, Function="User Defined", UserDefinedFunction=f"name=Lorentzian, Amplitude=1000, PeakCentre={n+1}, FWHM=1", XUnit="MomentumTransfer", NumBanks=1, BankPixelWidth=1, XMin=0, XMax=16.5, BinWidth=0.1)
    LoadInstrument(name,InstrumentName="ZOOM", RewriteSpectraMap=False)
    names.append(name)

group = GroupWorkspaces(names)
SavePolarizedNXcanSAS(group, "test_file", InputSpinStates="+1-1,-1-1,+1+1,-1+1")

Categories: AlgorithmIndex | DataHandling\Nexus

Source

C++ header: SavePolarizedNXcanSAS.h

C++ source: SavePolarizedNXcanSAS.cpp