NXcanSAS v1.1: Difference between revisions

From canSAS
Line 33: Line 33:


Throughout these proposals, all references to polarization and its derivative forms shall be deemed to use American English (ie, spelt with a "z")!
Throughout these proposals, all references to polarization and its derivative forms shall be deemed to use American English (ie, spelt with a "z")!
In general, NXcanSAS classes, <SASsomething>, are assumed to be of the NeXus type, <NXsomething>.


Mandatory and recommended refer to whether the information ''must'' be present in a Magnetic-SANS NXcanSAS file, or if it is only encouraged.
Mandatory and recommended refer to whether the information ''must'' be present in a Magnetic-SANS NXcanSAS file, or if it is only encouraged.

Revision as of 15:04, 2 October 2024

THIS PAGE IS WORK IN PROGRESS

Latest News

2024-09 : Proposals for NXcanSAS v1.1 in development

Overview

Since its release in 2017, the NXcanSAS format has served the community well, but mostly in the role of an HDF equivalent to the CanSAS1D XML format. However, as is evident in its founding discussions, far greater functionality was originally envisaged. Advances in instrumentation and science are now starting to push at the boundaries of NXcanSAS v1.0. One such area is what may be termed Magnetic-SANS which encompasses a number of different SANS techniques involving manipulation of the neutron spin. To meet the needs of this area revisions are required to both NXcanSAS v1.0 and NeXus.

NXcanSAS is currently implemented by Mantid and SasView.

Since January 2024 the ISIS Mantid Team have been implementing a Magnetic-SANS reduction workflow. It is now at the testing stage and the output file format will form part of this.

The Magnetic-SANS Problem

To reliably and unambigulously interpret Magnetic-SANS data it is necessary to know the spin history of the neutrons during the measurement. It makes sense to store this in the reduced output file as metadata which, in turn, requires NXcanSAS to:

  • have a way to include the polarization (aka spin state) information with the SANS data;
  • have a way to denote the polarization;
  • have a way to identify the type of Magnetic-SANS technique that generated the data, and;
  • to include metadata relating to the spin manipulating devices (order encountered, type, etc) used during the measurement of the data.

NXcanSAS v1.0 and NeXus provide for some, but alas not all, of this information.

v1.1 Sub-group

  • Dirk Honecker (ISIS)
  • Steve King (ISIS & CanSAS)
  • Annika Stellhorn (ESS)
  • Lucas Wilkins (ISIS Data Scientist)

Proposals

Throughout these proposals, all references to polarization and its derivative forms shall be deemed to use American English (ie, spelt with a "z")!

In general, NXcanSAS classes, <SASsomething>, are assumed to be of the NeXus type, <NXsomething>.

Mandatory and recommended refer to whether the information must be present in a Magnetic-SANS NXcanSAS file, or if it is only encouraged.

For NXcanSAS v1.1

PROPOSAL 1: (Mandatory) That the polarization simply be included as additional, optional, data axes within <SASdata/>. This functionality is already part of v1.0, but perhaps had not been envisaged for this particular use case!

Aside: This proposal does mean that every Q point will have associated polarization information (if the file contains Magnetic-SANS data), but this can be leveraged to address other requirements (see below), and the overhead is tiny. It also means the polarization data is directly available to a file reader. An alternative that was considered was something like <SASdata name="title" polarization="value"/>, but this was rejected because it would a) require processing of "value" and b) require introducing something to denote the different types of Magnetic-SANS measurement.

PROPOSAL 2: (Mandatory) That the additional polarization axes be labelled Pin and Pout for before and after the sample, respectively. The units of each are "none". Either both axes must be present, or neither.

Aside: This was the proposal that generated the most discussion in the sub-group! In the Magnetic-SANS literature Pin and Pout are variously called P_i / P_f, P_0 / P, or P / P'. Concerns were also expressed that any use of "P" risked confusion with pressure (amongst other quantities). However, examination of axis labels already in use in CanSAS1D and NXcanSAS showed a preference for concise labels without underscores (eg, Q, I, T, Idev, Qdev, Tdev, and Lambda) and it was not clear what else one might call polarization or what label other than P-something made sense!. This proposal is thus a compromise that was reached, rather than a unanimous endorsement!

PROPOSAL 3: (Mandatory) That each polarization axis is restricted to one of the following values: +1 when the polarization is parallel to the polarizer; -1 when the polarization is antiparallel to the polarizer; and 0 when there is no polarisation. When both polarization axes would take the value 0 - ie, a conventional, unpolarised, SANS measurement - the polarization axes need not be specified. The values are to be stored as int[2].

Aside: Other options considered were: "0" / "1" (eg, denoting a flipper is off / on), but this carries the risk that a coding error could be interpreted as off or not polarized), and "+" / "-", "p" / "m" (eg, denoting plus / minus), or "p" / "a" (eg, denoting parallel / antiparallel), but which require translation into a number or boolean for use in a program. It was noted that ORSO have opted for "p" / "m" in their emerging NR data format but their reasoning was not known.

PROPOSAL 4: (Mandatory) That the definition of the polarization be "For a magnetically saturated sample with collinear magnetic moments aligned along the polarization axis z, the non-spin-flip component with higher intensity is defined as the <minus, minus> spin state, but denoted here as [-1, -1]". This definition is to be incorporated in all relevant documentation relating to the production and use of NXcanSAS files.

Aside: A definition of the spin states is mandatory if the data is to have any meaning at all! This definition is a less ambiguous statement of the Moon-Riste-Koehler definition "for a polariser in the Northern hemisphere with the field aligned to the Earth's magnetic field, the transmitted beam is defined as - / minus." And in other literature the <minus, minus> state is said to transmit higher intensity than the <plus, plus> state.

Note: The astute reader will realise that this definition must invert in the Southern hemisphere! Data reduction software for polarized-SANS data measured at facilities there would need to correctly compensate when writing NXcanSAS files.

PROPOSAL 5a: (Recommended) That the wavelength-dependent neutron transmissions of polarizers, flippers or analyzers be written as separate <SAStransmission_spectrum/> blocks with appropriate names (eg, <SAStransmission_spectrum name="polarizer">), in exactly the same way that TOF-SANS CanSAS1D / NXcanSAS files presently incorporate the sample or background transmissions.

Aside: This proposal simply makes use of existing functionality in NXcanSAS v1.0.

PROPOSAL 5b: (Recommended) That the fixed-wavelength neutron transmissions of polarizers, flippers or analyzers be written as a single value (@transmission) under the respective sub-class in <SASinstrument/>.

Aside: This proposal represents an addition to NXcanSAS. It is also noted that neither NXpolarizer or NXflipper provide for transmission values.

PROPOSAL 6a: (Recommended) That the wavelength-dependent efficiency of polarizers, flippers or analyzers be written as separate <SASefficiency_spectrum/> blocks with appropriate names (eg, <SASefficiency_spectrum name="polarizer">), by analogy with way that TOF-SANS CanSAS1D / NXcanSAS files presently incorporate the sample or background transmissions (see Proposal 5a).

Aside: This proposal represents an addition to NXcanSAS, but is a simple and logical extension from <SAStransmission_spectrum/>.

PROPOSAL 6b: (Recommended) That the fixed-wavelength efficiency of polarizers, flippers or analyzers be written as a single value (@efficiency) under the respective sub-class in <SASinstrument/>.

Aside: This proposal represents an addition to NXcanSAS. It is noted that whilst NXpolarizer does provide for an efficiency value, NXflipper does not.

PROPOSAL 7: (Recommended) That the magnitude (@magnetic_field/@electric_field) and direction (@direction) of a magnetic/electric field across the sample be written under <SASsample/>.

Aside: This proposal represents an addition to NXcanSAS, but is entirely consistent with NXsample.

Note: @direction in NeXus is defined as "Any of these values: x | y | z"; ie, just a single axis. It would be much more preferable if a vector description of the field direction could be used (cf if using the ISIS 3D Vector Field Magnet).

PROPOSAL 8: (Recommended) That the magnitude (@magnetic_field) and direction (@direction) of the magnetic field across polarizers, flippers or analyzers be written under the respective sub-class in <SASinstrument/>.

Aside: This proposal represents an addition to both NXcanSAS and NeXus (there is no provision for the magnetic field in NXpolarizer or NXflipper).

Note: @direction in NeXus is defined as "Any of these values: x | y | z". Clarity is required as to whether, for example, "xy" is allowed? But it would be much more preferable if a vector description of the field direction could be used (see Proposal 7).

PROPOSAL 9: (Optional) That the initial polarization (@polarization_initial) and (decay) time constant (@time_constant) of 3He polarizers/analyzers be written under <SASpolarizer/> / <SASanalyzer/>.

Aside: This proposal represents an addition to both NXcanSAS and NeXus (there is no provision for the time-dependent polarisation of a 3He cell in NXpolarizer).

PROPOSAL 10: (Mandatory) That the order (@order) with which the neutron encounters polarizers, flippers or analyzers be written under the respective sub-class in <SASinstrument/>.

Aside: This proposal represents an addition to both NXcanSAS and NeXus (there is no provision for the order of components in NXpolarizer or NXflipper).

For NeXus

In formulating the proposals for NXcanSAS above it became clear that there were places where the type association between NXcanSAs and NeXus broke down. To remedy this, the following additions to the NeXus standard are proposed:

Proposal NX1: That the NXpolarizer base class be granted the additional parameters @transmission, @transmission_empty, @pressure, @length, @polarization_initial and @decay_constant.

Aside: As currently defined, NXpolarizer is very much predicated on a supermirror polarizer. Although it recognises a polarizer may be of type "3He", almost none of the current parameters would describe a 3He cell.

Note: It would also be helpful to be able to distinguish whether a polarizer device is being used as a polarizer or an analyzer!

Proposal NX2: That the NXflipper base class be granted the additional parameters @transmission and @efficiency.

Proposal NX3: That the NXpolarizer and NXflipper base classes be granted the additional parameters @magnetic_field and @direction.

Aside: This would give NXpolarizer and NXflipper the same functionality as NXsample.

Note: @direction in NeXus is defined as "Any of these values: x | y | z"; ie, just a single axis. It would be much more preferable if a vector description of the field direction could be used.

Pseudo-code Examples

In the following examples, only the base classes and labels specifically relevant to the Magnetic-SANS case are being shown; it would be perfectly valid for additional metadata from the base classes shown (expand the links) to also be included, and in most cases this already happens in existing implementations of NXcanSAS v1.0.

TOF-SANS

<SASroot>
   
   <SASentry> This represents a single sample
       <Title/>
       <Run/>
         
       <SASdata/>
           Pin_indices=0
           Pout_indices=1
           Q_indices=0,1,2
           I_axes=Pin,Pout,Q
              
           I: float[2,2,nQ]
           Pin: int[2]  (restricted to -1, 1, in fact=[-1, 1])
           Pout: int[2] (restricted to -1, 1)
           Qx: float[nQ]
           Qy: float[nQ]
       <SASdata/>
         
       <SASdata/>
           Pout_indices=0
           Q_indices=0,1
           I_axes=Pout,Q
              
           I: float[2,2,nQ]
           Pout: int[2] (restricted to -1, 1)
           Qx: float[nQ]
           Qy: float[nQ]
       <SASdata/>
       
       <SAStransmission_spectrum name="sample"/>          Transmission data block for the sample (already in NXcanSAS v1.0)
       <SAStransmission_spectrum name="can"/>             Transmission data block for the sample container (already in NXcanSAS v1.0)
       
       <SAStransmission_spectrum name=”polarizer”/>       Transmission data block for the polariser (optional)
       <SAStransmission_spectrum name=”polarizer_empty”/> Transmission data block for the empty polariser (optional)
       <SAStransmission_spectrum name=”flipper”/>         Transmission data block for the flipper (optional)
       <SAStransmission_spectrum name=”analyser”/>        Transmission data block for the analyzer (optional)
       <SAStransmission_spectrum name=”analyser_empty”/>  Transmission data block for the empty analyzer (optional)
       
       <SASefficiency_spectrum name=”polarizer”/>         Efficiency data block for the polariser (optional)
       <SASefficiency_spectrum name=”flipper”/>           Efficiency data block for the flipper (optional)
       <SASefficiency_spectrum name=”analyser”/>          Efficiency data block for the analyzer (optional)
       
       <SASinstrument>
           <SASsource>
               radiation:
           <\SASsource>
           
           <SAScollimation/>
           
           <SASpolarizer> 
                type: (optional) one of: “crystal”, “supermirror”, “3He”
                order: (mandatory) relative position of device in beamline
                polarization_initial: (optional) initial polarization of a 3He cell
                time_constant: (optional) polarization decay time constant of a 3He cell
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASpolarizer>
              
           <SASflipper>
                type: (optional) one of: “coil”, “current-sheet”
                order: (mandatory) relative position of device in beamline
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASflipper>
              
           <SASanalyzer>  (optional for polarisation analysis)              
                type: (optional) one of: “crystal”, “supermirror”, “3He”
                order: (mandatory) relative position of device in beamline
                polarization_initial: (optional) initial polarization of a 3He cell
                time_constant: (optional) polarization decay time constant of a 3He cell
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASanalyser>
              
           <SASdetector/> 
              
      </SASinstrument>
         
       <SASsample>
               <temperature/> Average value and uncertainty from SE logs
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
                electric_field: (optional) field strength
                    @direction: (optional) field direction
       </SASSsample>
         
       <SASprocess>
           <SASprocessnote>
               Include Mantid workspace history?
           </SASprocessnote>
       </SASprocess>
         
       <SASnote/>

  </SASentry>
   
</SASroot>


Fixed-wavelength SANS

<SASroot>
   
   <SASentry> This represents a single sample
       <Title/>
       <Run/>
         
       <SASdata/>
           Pin_indices=0
           Pout_indices=1
           Q_indices=0,1,2
           I_axes=Pin,Pout,Q
              
           I: float[2,2,nQ]
           Pin: int[2]  (restricted to -1, 1, in fact=[-1, 1])
           Pout: int[2] (restricted to -1, 1)
           Qx: float[nQ]
           Qy: float[nQ]
       <SASdata/>
         
       <SASdata/>
           Pout_indices=0
           Q_indices=0,1
           I_axes=Pout,Q
              
           I: float[2,2,nQ]
           Pout: int[2] (restricted to -1, 1)
           Qx: float[nQ]
           Qy: float[nQ]
       <SASdata/>
       
       <SAStransmission_spectrum name="sample"/>          Transmission data block for the sample (already in NXcanSAS v1.0)
       <SAStransmission_spectrum name="can"/>             Transmission data block for the sample container (already in NXcanSAS v1.0)
               
       <SASinstrument>
           <SASsource>
               radiation:
           <\SASsource>
           
           <SAScollimation/>
           
           <SASpolarizer> 
                type: (optional) one of: “crystal”, “supermirror”, “3He”
                order: (mandatory) relative position of device in beamline
                transmission: (optional) transmission of polarizer
                transmission_empty: (optional) transmission of empty 3He cell
                efficiency: (optional) efficiency of polarizer
                polarization_initial: (optional) initial polarization of a 3He cell
                time_constant: (optional) polarization decay time constant of a 3He cell
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASpolarizer>
              
           <SASflipper>
                type: (optional) one of: “coil”, “current-sheet”
                order: (mandatory) relative position of device in beamline
                transmission: (optional) transmission of flipper
                efficiency: (optional) efficiency of flipper
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASflipper>
              
           <SASanalyzer>  (optional for polarisation analysis)              
                type: (optional) one of: “crystal”, “supermirror”, “3He”
                order: (mandatory) relative position of device in beamline
                transmission: (optional) transmission of polarizer
                transmission_empty: (optional) transmission of empty 3He cell
                efficiency: (optional) efficiency of polarizer
                polarization_initial: (optional) initial polarization of a 3He cell
                time_constant: (optional) polarization decay time constant of a 3He cell
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
           <\SASanalyser>
              
           <SASdetector/> 
              
      </SASinstrument>
         
       <SASsample>
               <temperature/> Average value and uncertainty from SE logs
                magnetic_field: (optional) field strength
                    @direction: (optional) field direction
                electric_field: (optional) field strength
                    @direction: (optional) field direction
       </SASSsample>
         
       <SASprocess>
           <SASprocessnote>
               Include Mantid workspace history?
           </SASprocessnote>
       </SASprocess>
         
       <SASnote/>

  </SASentry>
   
</SASroot>