SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
48 stars 41 forks source link

Utilizing Metadata from NXcanSAS data files #2083

Open ldschmitt opened 2 years ago

ldschmitt commented 2 years ago

Is your feature request related to a problem? Please describe. As of right now the metadata from NXcanSAS is not being used effectively in SASview. This needs to be implemented so that i can access the rotation and tilt angles for magnetic SANS experiment to make rocking curves outlined #2077.

Describe the solution you'd like Adding a new sections to the data information(see picture) which shall be called Rocking information and Environment information. image

Rocking Information will include fields for :

Rocking Sample angle Rocking Environment angle Rocking Tilt angle Rocking Sample and Environment angle

Environment Information: magnetic field, H, units Tesla Sample temperature, T, units K Electric Field, E, units V/m Electric Current, I, units Amps Pressure, P, Bar

It should be easy to add new metadata fields to plot against in future.

smk78 commented 2 years ago

The NXcanSAS format is not a SasView construct. It is a subset of NeXus, an internationally agreed, and controlled, data format. See https://manual.nexusformat.org/classes/applications/NXcanSAS.html. This means that SasView cannot simply add fields to the format; changes have to be proposed, discussed, and approved by the NeXus International Advisory Committee (see https://www.nexusformat.org/). This is usually a constructive dialogue, but not necessarily quick.

However, when NXcanSAS was specified, the CanSAS Working Group (https://www.cansas.org/) took time to try and envisage as many use cases as it could. Some of what you are suggesting may already be specified, albeit under different names for the fields. Please examine the first link above, particular the NXsample section. But if NXcanSAS needs further extension I would advise contacting the CanSAS Working Group on Data Formats for assistance in developing any proposals.

That said, for implementing some sort of proof-of-concept functionality in SasView, one might be able to leverage a free-form field in NXprocess, for example, NXcollection, for the information currently unsupported by NXcanSAS.

Where you say 'so that I can access...the angles' what exactly do you mean by this? What is your envisaged use case?

krzywon commented 2 years ago

Correct me if I'm wrong, @ldschmitt, but I think this is requesting a way to access data that already exists within the NXcanSAS standard. Tilt angles and environment data can already be stored in the NXcanSAS format, but the request is to be able to access that already existing data within SasView for analysis and/or record-keeping purposes.

Potential Use cases:

NB - All information within an NXcanSAS file is loaded into SasView, but values not typically used for analysis are put into the DataInfo.meta_data[1] dictionary by mapping {Nexus class name: data}.

Potential Base Implementation:

[1] DataInfo.meta_data [2] DataInfo class

smk78 commented 2 years ago

Something I wasn't clear about was whether there was a requirement to store angles for the sample environment in addition to those for the sample? The NXcanSAS standard allows the latter but I don't think it allows the former?

krzywon commented 2 years ago

Something I wasn't clear about was whether there was a requirement to store angles for the sample environment in addition to those for the sample? The NXcanSAS standard allows the latter but I don't think it allows the former?

There is no requirement, but NXsample allows for an optional magnetic_field_env entry which is an NXenvironment object. NXenvironment has an optional position entry that defines position and orientation values.

butlerpd commented 1 year ago

it might be good to have @ldschmitt, or some other member of the magsas workshop to verify that this is what is being looked for? If so, I think this is part of a desire more generally (for all uses not just magnetic scattering) to access the metada in useful ways. For example parametric studies (e.g. as a function of temperature, time, etc). That however is probably a fairly hefty design discussion and lot of work?

However I would also agree that just being able to see that information from within SasView would be a nice start and not as heavy a lift? Maybe implementing a popup HDF5/NXcanSAS reader perhaps?

ldschmitt commented 1 year ago

I think if we want to be able to analyze and fit rocking curves we need access to the metadata to plot integrated intensity in a region of interest as function of angle or other metadata.

With more users doing Time-resolved SANS (TR-SANS), we are often making complex plots and visualizations like the attached file. This is only really possibly outside of SASview. Azimuthal_Q2_cont