Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Utilizing Metadata from NXcanSAS data files #2083

Open
ldschmitt opened this issue Jun 15, 2022 · 6 comments
Open

Utilizing Metadata from NXcanSAS data files #2083

ldschmitt opened this issue Jun 15, 2022 · 6 comments
Labels
Cross Package Issue This issue involves a package other than SasView/sasview Enhancement Feature requests and/or general improvements Loading and Saving Concerns loading, saving and serialisation more generally

Comments

@ldschmitt
Copy link

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
Copy link
Contributor

smk78 commented Jun 15, 2022

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
Copy link
Contributor

krzywon commented Jun 15, 2022

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:

  • View SE values within the Data Info window
  • Plot multiple IvQ (data and fits) in a single plot window for a single sample at different sample environment conditions and have those different SE values appear on the window in a meaningful way

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:

  • Modify the DataInfo[2] class in data_info.py to include a dictionary of SE variables mapping each SE device to its SE data. {SEnvDevice_1: SEnvData_1, SEnvDevice_2: SEnvData_2, ..., SEnvDevice_n: SEnvData_n
  • Add a SE Device class to data_info.py that describes a generic piece of SE.
  • Add a SE Data class to data_info.py that describes a generic set of SE data (units, data array, scaling, etc.)
  • Add a __str__() method to both classes that outputs relevant data when the .toString() is called on an instance of the class
  • Modify the __str__() method of the DataInfo class so SE data are shown when the Data Info window is opened in the GUI.

[1] DataInfo.meta_data
[2] DataInfo class

@smk78
Copy link
Contributor

smk78 commented Jun 16, 2022

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
Copy link
Contributor

krzywon commented Jun 16, 2022

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.

@lucas-wilkins lucas-wilkins added the Loading and Saving Concerns loading, saving and serialisation more generally label Jul 21, 2022
@lucas-wilkins lucas-wilkins added Enhancement Feature requests and/or general improvements and removed Feature Request labels Aug 31, 2022
@krzywon krzywon added Cross Package Issue This issue involves a package other than SasView/sasview and removed SasData - Add Ticket labels Sep 16, 2022
@butlerpd
Copy link
Member

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
Copy link
Author

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Cross Package Issue This issue involves a package other than SasView/sasview Enhancement Feature requests and/or general improvements Loading and Saving Concerns loading, saving and serialisation more generally
Projects
None yet
Development

No branches or pull requests

5 participants