reflectivity / file_format

2 stars 4 forks source link

tentative first draft of resolution specifiers #12

Open bmaranville opened 2 years ago

bmaranville commented 2 years ago

This is just to get the conversation started... I would like to be able to specify the resolution for angle and wavelength in an ORSO file, and there is currently no standard way to do this.

andyfaff commented 2 years ago

I think this would be fine for most monochromatic instrument. However, it'd prove difficult for energy dispersive, especially TOF-NR.

The angular part is mostly fine, the angular divergence is pretty much constant for all measured Q-points. However, the angle of incidence is wavelength dependent on horizontal reflectometers such as Figaro or Platypus. Longer wavelengths have a higher angle of incidence.

The wavelength part is more detailed, with several wavelength components to be considered (see https://doi.org/10.1107/S1600576714009595). Those wavelength components have different sizes for different wavelengths. A first order treatment says that dlamba/lambda is constant, but second order corrections are frequently required.

Can we develop something more complex for recording the resolution, such as a set of basis functions for describing dQ on a point by point basis?

arm61 commented 2 years ago

I think I agree with @andyfaff on this. We should try and define a set of functions that we can describe in additional columns of the file. I think CanSAS/SasView have been thinking a bit about this for SAS so maybe we should speak with them on it.

bmaranville commented 2 years ago

I agree that more complicated functional forms than trapezoid and gaussian will be required. To address the needs of referring to (an arbitrary number of) columns, I think it would be useful define a simple 'column' reference type, and allow it in places like the Value.magnitude attribute, or in the shape parameters so we can do e.g.

instrument_settings:
  incident_angle:
    value:
      units: degrees
      magnitude: 
        column: incident_angle    #  you could name your column alpha_i instead if you want

(For comparison, this is the form we currently support in orsopy for Value):

instrument_settings:
  incident_angle:
    value:
      units: degrees
      magnitude: [0.0, 0.01, 0.02] # or a single value 

Then for something like a polynomial basis, we could do

instrument_settings:
  incident_angle:
    value:
      units: degrees
      magnitude: 
        column: incident_angle
  incident_angle_resolution:
    shape: polynomial
    parameters:
      order: 3
      type: Chebyshev
      coefficients: 
        - column: dalpha_p1
        - column: dalpha_p2
        - column: dalpha_p3

and the gaussian shape could be parameterized as

instrument_settings:
  incident_angle:
    value:
      units: degrees
      magnitude: 
        column: incident_angle
  incident_angle_resolution:
    shape: gaussian
    unit: degrees
    parameters:
      sigma:
        column: incident_angle_resolution
      truncation_width: 0.2  # may be fixed number

I don't know if the parameters object is strictly necessary - we could just put e.g. sigma at the same level as shape