cheminfo / nmrium

React component to display and process nuclear magnetic resonance (NMR) spectra.
https://docs.nmrium.org
MIT License
55 stars 25 forks source link

2D: if no 1D spectra is available, calculate the projection and display it #449

Closed jwist closed 4 years ago

jwist commented 4 years ago

add a button in the spectra menu for 2D that generates a projection. The projection should be generated as a 1D and this 1D is then displayed as projection of the 2D

lpatiny commented 4 years ago

The button should be label 'Add missing projection'.

@hamed-musallam Please add the button and create a function that has access to the 2D spectrum. From there we will create one or two 1D spectrum but this means also that in this function we need to know both nucleus and which traces are missing.

The button could also check first if there is any trace missing because if both projection are available there should be a message to tell that there is nothing to calculate.

You can use this font-awesome icon

image

hamed-musallam commented 4 years ago

@lpatiny it's done from my side, the button will be visible only if you are in 2d tab and you select one of the 2d spectrum

lpatiny commented 4 years ago

@hamed-musallam You can point to the function that we need to complete ?

The goal is that you call the function with a Datum2D.

After we will calculate 2 Datum1D, one for x axis and one for y axis.

How would you like to do after ? We add them in SpectraManager and return them as {x: Datum1D, y: Datum1D} ?

hamed-musallam commented 4 years ago

@lpatiny yes i have reference to 2d object that i need to call the function and return the result after you done the process that you need to do it from your side and then i have to add the result as 1d spectrum using the same function when we load the spectrum from jcamp or json file.

or another solution and because this feature we need in it to deal with the 1d and 2d in the same time we can define a function inside spectrumManager that take only id of the active 2d spectrum as a parameter and inside this function you can generate 1d spectrum and add it to the 1D List. in this case what i have to do form my side is to get new data and refresh the whole displayer.