-
Notifications
You must be signed in to change notification settings - Fork 33
Choose unit on axis and store it in the view #4040
Description
@tpoisseau
Hi, I would like some help to convert the scale from chart unit (default, generally in ppm) to the workspace unit (user choose between ppm, pt and hz).
- HorizontalAxis1D: chartUnit is
mode === 'RTL' ? 'ppm' : 's', I wonder if this is true, because DirectAxis2D rely on spectrum info isFid to choose between hz and ppm - DirectAxis2D: spectrumUnit is
spectrum?.info?.isFid ? 's' : 'ppm'. But I wonder how we should manage the case where multiple spectra are selected. - IndirectAxis2D: chartUnit is
/^[0-9]+[A-Z][a-z]?$/.test(maybeNucleusUnit) ? 'ppm' : undefinedand the label fallback tomaybeNucleusUnit. Another way of looking at it is: if the second part of the nucleus (maybeNucleusUnit) does not resemble a nucleus, it is considered to be the unit. I suppose in this case, no conversion and displaymaybeNucleusUnit. but for other case, we have to convert ppm to unit choose by the user in workspace config.
For me the scale conversion is not obvious.
Originally posted by @tpoisseau in #4004 (comment)
@luc
I don't know what means RTL.
For 1D we should know if we are in the mode isFID or isFT.
- isFID: we can only display either point index or the time in second (the current value)
- isFT: we have 3 possibilities: point index, ppm or hz.
To convert ppm to Hz you can currently multiply the value in ppm by I think info.baseFrequency
@jobo322 Should we use to convert to Hz info.baseFrequency or info.originFrequency ?
For 2D it is something similar but in both dimension depending if it is before or after FT. Before FT we have both axes in time like in 1D.
For 2D, the units have to be selected individually because for example the JResolv (after processing (FT in both direction)) experiment would put on the real axis ppm as unit by default while on the vertical it should be in Hz. For all other 2D experiments by default after FT we would put ppm on both axis.
For the indirect dimension if it does not match a nucleus (your regexp) we would not propose any axis modification. Unit can become pretty weird like in DOSY experiment
I don't know what means RTL.
RTL is for "Right to Left", it is stored in chart, it looks like it is derived from isFID / isFT
@luc
Yes it is derived. Before FT (so isFID is true) we have time and the 0 is on the left
After FT (isFT is true) we have chemical shifts and the 0 is on the right
@tpoisseau
Shouldn't the unit selection be directly in the graph? This would allow the application to respond correctly to constraints and avoid getting stuck on inconsistencies between workspace preferences and the type/selection of spectra displayed.
I feel that the unit should be managed at the view level rather than the workspace level.
If so, I would remove unit work from this PR and implement it (type and UX) in another PR. I'm not sure to be able to manage the conversion.
@luc
Ok for me it is at the level of the view and not the workspace for the unit. It is extremely rare that you don't want the default settings anyway.
To customise the axis we could think about something similar to this
@targos
We could also start using more the right click (context menu). It's easy to implement with blueprint APIs
@luc
Both are ok for me so the easier is better.
- Should the unit be stored by spectra or by axis (HorizontalAxis1D, DirectAxis2D, IndirectAxis2D)? (or both?)
- How to maintain consistency with selected spectra ?
- apply a coherent segregation of units (constant
axisUnitsinnmrium-core) if needed
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
