cheminfo / convert-to-jcamp

Convert strings into JCAMP
https://cheminfo.github.io/convert-to-jcamp/
MIT License
0 stars 3 forks source link

Improve from1DNMRVariables #81

Closed lpatiny closed 2 months ago

lpatiny commented 3 months ago

It is not clear what is required and what is not. What is required should not be optional parameters and because it ends up in ##. or ##$ it should be in the corresponding parameters info or meta.

I would like to create a JCAMP-DX file using something like or even simpler if possible.

  const xy = signalsToXY(signals, { frequency });
  const data = {
    x: {
      data: xy.x,
      label: 'Chemical Shift (ppm)',
    },
    y: {
      data: xy.y,
    },
  };
  const jcamp = from1DNMRVariables(data, {
    xyEncoding: 'DIFDUP',
    info: {
      title: '1H NMR',
      dataType: 'NMR Spectrum',
    },
    meta: {
      '.OBSERVE FREQUENCY': frequency
  });
jobo322 commented 2 months ago

@lpatiny in the type MeasurementXYVariables the property label is mandatory, looking in your example, do you prefer it to be optional?

jobo322 commented 2 months ago

I suggest this

const data = {
      x: {
        data: xy.x,
        label: 'Chemical Shift (ppm)',
      },
      r: {
        data: xy.y,
        label: 'Real data',
      },
    };
    const jcamp = from1DNMRVariables(data, {
      xyEncoding: 'DIFDUP',
      info: {
        title: '1H NMR',
        dataType: 'NMR Spectrum',
        '.OBSERVE FREQUENCY': frequency,
      },
    });

we need to manage the possibility of complex data. so { x, r } and { x, r, i }

jobo322 commented 2 months ago

it was done by

exposed in the version 5.4.11