nmr-processing 3.4.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/lib/assignment/get13CAssignments.js.map +1 -1
  2. package/lib/assignment/get1HAssignments.d.ts +2 -2
  3. package/lib/{types → assignment}/nmrAssigment.d.ts +2 -2
  4. package/lib/{types → assignment}/nmrAssigment.js +0 -0
  5. package/lib/assignment/nmrAssigment.js.map +1 -0
  6. package/lib/assignment/utils/buildAssignments.js.map +1 -1
  7. package/lib/assignment/utils/createMapPossibleAssignments.d.ts +1 -1
  8. package/lib/assignment/utils/createMapPossibleAssignments.js.map +1 -1
  9. package/lib/constants/couplingValues.js.map +1 -1
  10. package/lib/databases/DatabaseNMREntry.d.ts +1 -1
  11. package/lib/index.d.ts +9 -10
  12. package/lib/index.js +1 -1
  13. package/lib/ml-matrix-convolution.d.ts +8 -0
  14. package/lib/ml-matrix-convolution.js +2 -0
  15. package/lib/ml-matrix-convolution.js.map +1 -0
  16. package/lib/ml-simple-clustering.d.ts +8 -0
  17. package/lib/ml-simple-clustering.js +2 -0
  18. package/lib/ml-simple-clustering.js.map +1 -0
  19. package/lib/peaks/NMRPeak1D.d.ts +4 -0
  20. package/lib/{types → peaks}/NMRPeak1D.js +0 -0
  21. package/lib/{types → peaks}/NMRPeak1D.js.map +1 -1
  22. package/lib/peaks/peaksFilterImpurities.d.ts +1 -1
  23. package/lib/peaks/peaksFilterImpurities.js +1 -1
  24. package/lib/peaks/peaksFilterImpurities.js.map +1 -1
  25. package/lib/peaks/peaksToRanges.d.ts +2 -2
  26. package/lib/peaks/peaksToRanges.js +11 -17
  27. package/lib/peaks/peaksToRanges.js.map +1 -1
  28. package/lib/peaks/util/determineRealTop.d.ts +2 -2
  29. package/lib/peaks/util/determineRealTop.js +3 -2
  30. package/lib/peaks/util/determineRealTop.js.map +1 -1
  31. package/lib/peaks/util/jAnalyzer.d.ts +2 -2
  32. package/lib/peaks/util/jAnalyzer.js +12 -13
  33. package/lib/peaks/util/jAnalyzer.js.map +1 -1
  34. package/lib/peaks/util/joinRanges.d.ts +1 -1
  35. package/lib/peaks/util/peakOptimizer.d.ts +3 -3
  36. package/lib/peaks/util/peakOptimizer.js.map +1 -1
  37. package/lib/{types → prediction}/dataStructure.d.ts +0 -0
  38. package/lib/{types → prediction}/dataStructure.js +0 -0
  39. package/lib/prediction/dataStructure.js.map +1 -0
  40. package/lib/prediction/predictAll.d.ts +1 -1
  41. package/lib/prediction/predictAll.js +1 -1
  42. package/lib/prediction/predictAll.js.map +1 -1
  43. package/lib/prediction/predictCOSY.d.ts +1 -1
  44. package/lib/prediction/predictCOSY.js.map +1 -1
  45. package/lib/prediction/predictCarbon.d.ts +2 -2
  46. package/lib/prediction/predictCarbon.js.map +1 -1
  47. package/lib/prediction/predictHMBC.d.ts +1 -1
  48. package/lib/prediction/predictHMBC.js.map +1 -1
  49. package/lib/prediction/predictHSQC.d.ts +1 -1
  50. package/lib/prediction/predictHSQC.js.map +1 -1
  51. package/lib/prediction/predictProton.d.ts +1 -1
  52. package/lib/prediction/predictProton.js +1 -1
  53. package/lib/prediction/predictProton.js.map +1 -1
  54. package/lib/{types → prediction}/prediction1D.d.ts +2 -2
  55. package/lib/{types → prediction}/prediction1D.js +0 -0
  56. package/lib/prediction/prediction1D.js.map +1 -0
  57. package/lib/prediction/utils/fetchPrediction.d.ts +1 -1
  58. package/lib/prediction/utils/getFilteredIDiaIDs.d.ts +1 -1
  59. package/lib/prediction/utils/getFilteredIDiaIDs.js.map +1 -1
  60. package/lib/prediction/utils/getNuclei.js +1 -1
  61. package/lib/prediction/utils/getNuclei.js.map +1 -1
  62. package/lib/prediction/utils/getPredictions.d.ts +2 -2
  63. package/lib/prediction/utils/predict2D.d.ts +2 -2
  64. package/lib/prediction/utils/queryByHOSE.d.ts +1 -1
  65. package/lib/prediction/utils/queryByHOSE.js.map +1 -1
  66. package/lib/ranges/rangesToACS.d.ts +1 -1
  67. package/lib/ranges/rangesToXY.d.ts +3 -3
  68. package/lib/ranges/rangesToXY.js.map +1 -1
  69. package/lib/signal/signalJoinCouplings.d.ts +2 -2
  70. package/lib/signal/signalJoinCouplings.js +3 -3
  71. package/lib/signal/signalJoinCouplings.js.map +1 -1
  72. package/lib/signal/signalMultiplicityPattern.d.ts +1 -1
  73. package/lib/{types → signals}/NMRSignal1D.d.ts +1 -1
  74. package/lib/{types → signals}/NMRSignal1D.js +0 -0
  75. package/lib/{types → signals}/NMRSignal1D.js.map +1 -1
  76. package/lib/signals/hackSignalsToXY.d.ts +1 -1
  77. package/lib/{types → signals}/jcoupling.d.ts +1 -1
  78. package/lib/{types → signals}/jcoupling.js +0 -0
  79. package/lib/{types → signals}/jcoupling.js.map +1 -1
  80. package/lib/signals/signals2DToZ.d.ts +1 -1
  81. package/lib/signals/signalsJoin.d.ts +4 -4
  82. package/lib/signals/signalsJoin.js +7 -7
  83. package/lib/signals/signalsJoin.js.map +1 -1
  84. package/lib/signals/signalsToRanges.d.ts +2 -2
  85. package/lib/signals/signalsToRanges.js.map +1 -1
  86. package/lib/signals/signalsToXY.d.ts +3 -3
  87. package/lib/signals/simulation/signalsToSpinSystem.d.ts +2 -2
  88. package/lib/signals/simulation/simulate1D.d.ts +5 -4
  89. package/lib/signals/simulation/simulate1D.js.map +1 -1
  90. package/lib/signals/simulation/splitSpinSystem.d.ts +1 -1
  91. package/lib/signals/simulation/splitSpinSystem.js.map +1 -1
  92. package/lib/{types → signals}/spinSystem.d.ts +0 -0
  93. package/lib/{types → signals}/spinSystem.js +0 -0
  94. package/lib/{types → signals}/spinSystem.js.map +1 -1
  95. package/lib/{types → utilities}/MakeMandatory.d.ts +0 -0
  96. package/lib/{types → utilities}/MakeMandatory.js +0 -0
  97. package/lib/utilities/MakeMandatory.js.map +1 -0
  98. package/lib/utilities/joinPatterns.js.map +1 -1
  99. package/lib/utilities/rangeFromSignal.d.ts +1 -1
  100. package/lib/utilities/resurrect.d.ts +1 -1
  101. package/lib/utilities/resurrectRange.d.ts +1 -1
  102. package/lib/{types → xy}/NMRRange.d.ts +1 -1
  103. package/lib/{types → xy}/NMRRange.js +0 -0
  104. package/lib/{types → xy}/NMRRange.js.map +1 -1
  105. package/lib/xy/xyAutoPeaksPicking.d.ts +4 -60
  106. package/lib/xy/xyAutoPeaksPicking.js +3 -3
  107. package/lib/xy/xyAutoPeaksPicking.js.map +1 -1
  108. package/lib/xy/xyAutoRangesPicking.d.ts +2 -2
  109. package/lib/xy/xyAutoRangesPicking.js.map +1 -1
  110. package/lib/{types → xyz}/NMRSignal2D.d.ts +6 -7
  111. package/lib/{types → xyz}/NMRSignal2D.js +0 -0
  112. package/lib/{types → xyz}/NMRSignal2D.js.map +1 -1
  113. package/lib/xyz/NMRZone.d.ts +8 -0
  114. package/lib/{types → xyz}/NMRZone.js +0 -0
  115. package/lib/{types → xyz}/NMRZone.js.map +1 -1
  116. package/lib/xyz/{xyzAutoPeaksPicking.d.ts → xyzAutoZonesPicking.d.ts} +3 -3
  117. package/lib/xyz/{xyzAutoPeaksPicking.js → xyzAutoZonesPicking.js} +38 -24
  118. package/lib/xyz/xyzAutoZonesPicking.js.map +1 -0
  119. package/lib/xyz/xyzJResAnalyzer.d.ts +1 -1
  120. package/lib/xyz/xyzJResAnalyzer.js.map +1 -1
  121. package/lib-esm/assignment/get13CAssignments.js.map +1 -1
  122. package/lib-esm/{types → assignment}/nmrAssigment.js +0 -0
  123. package/lib-esm/assignment/nmrAssigment.js.map +1 -0
  124. package/lib-esm/assignment/utils/buildAssignments.js.map +1 -1
  125. package/lib-esm/assignment/utils/createMapPossibleAssignments.js.map +1 -1
  126. package/lib-esm/constants/couplingValues.js.map +1 -1
  127. package/lib-esm/index.js +1 -1
  128. package/lib-esm/ml-matrix-convolution.js +2 -0
  129. package/lib-esm/ml-matrix-convolution.js.map +1 -0
  130. package/lib-esm/ml-simple-clustering.js +2 -0
  131. package/lib-esm/ml-simple-clustering.js.map +1 -0
  132. package/lib-esm/{types → peaks}/NMRPeak1D.js +0 -0
  133. package/lib-esm/{types → peaks}/NMRPeak1D.js.map +1 -1
  134. package/lib-esm/peaks/peaksFilterImpurities.js +1 -1
  135. package/lib-esm/peaks/peaksFilterImpurities.js.map +1 -1
  136. package/lib-esm/peaks/peaksToRanges.js +11 -17
  137. package/lib-esm/peaks/peaksToRanges.js.map +1 -1
  138. package/lib-esm/peaks/util/determineRealTop.js +4 -3
  139. package/lib-esm/peaks/util/determineRealTop.js.map +1 -1
  140. package/lib-esm/peaks/util/jAnalyzer.js +12 -13
  141. package/lib-esm/peaks/util/jAnalyzer.js.map +1 -1
  142. package/lib-esm/peaks/util/peakOptimizer.js.map +1 -1
  143. package/lib-esm/{types → prediction}/dataStructure.js +0 -0
  144. package/lib-esm/prediction/dataStructure.js.map +1 -0
  145. package/lib-esm/prediction/predictAll.js +1 -1
  146. package/lib-esm/prediction/predictAll.js.map +1 -1
  147. package/lib-esm/prediction/predictCOSY.js.map +1 -1
  148. package/lib-esm/prediction/predictCarbon.js.map +1 -1
  149. package/lib-esm/prediction/predictHMBC.js.map +1 -1
  150. package/lib-esm/prediction/predictHSQC.js.map +1 -1
  151. package/lib-esm/prediction/predictProton.js +1 -1
  152. package/lib-esm/prediction/predictProton.js.map +1 -1
  153. package/lib-esm/{types → prediction}/prediction1D.js +0 -0
  154. package/lib-esm/prediction/prediction1D.js.map +1 -0
  155. package/lib-esm/prediction/utils/getFilteredIDiaIDs.js.map +1 -1
  156. package/lib-esm/prediction/utils/getNuclei.js +1 -1
  157. package/lib-esm/prediction/utils/getNuclei.js.map +1 -1
  158. package/lib-esm/prediction/utils/queryByHOSE.js.map +1 -1
  159. package/lib-esm/ranges/rangesToXY.js.map +1 -1
  160. package/lib-esm/signal/signalJoinCouplings.js +3 -3
  161. package/lib-esm/signal/signalJoinCouplings.js.map +1 -1
  162. package/lib-esm/{types → signals}/NMRSignal1D.js +0 -0
  163. package/lib-esm/{types → signals}/NMRSignal1D.js.map +1 -1
  164. package/lib-esm/{types → signals}/jcoupling.js +0 -0
  165. package/lib-esm/{types → signals}/jcoupling.js.map +1 -1
  166. package/lib-esm/signals/signalsJoin.js +7 -7
  167. package/lib-esm/signals/signalsJoin.js.map +1 -1
  168. package/lib-esm/signals/signalsToRanges.js.map +1 -1
  169. package/lib-esm/signals/simulation/simulate1D.js.map +1 -1
  170. package/lib-esm/signals/simulation/splitSpinSystem.js.map +1 -1
  171. package/lib-esm/{types → signals}/spinSystem.js +0 -0
  172. package/lib-esm/{types → signals}/spinSystem.js.map +1 -1
  173. package/lib-esm/{types → utilities}/MakeMandatory.js +0 -0
  174. package/lib-esm/utilities/MakeMandatory.js.map +1 -0
  175. package/lib-esm/utilities/joinPatterns.js.map +1 -1
  176. package/lib-esm/{types → xy}/NMRRange.js +0 -0
  177. package/lib-esm/{types → xy}/NMRRange.js.map +1 -1
  178. package/lib-esm/xy/xyAutoPeaksPicking.js +3 -3
  179. package/lib-esm/xy/xyAutoPeaksPicking.js.map +1 -1
  180. package/lib-esm/xy/xyAutoRangesPicking.js.map +1 -1
  181. package/lib-esm/{types → xyz}/NMRSignal2D.js +0 -0
  182. package/lib-esm/{types → xyz}/NMRSignal2D.js.map +1 -1
  183. package/lib-esm/{types → xyz}/NMRZone.js +0 -0
  184. package/lib-esm/{types → xyz}/NMRZone.js.map +1 -1
  185. package/lib-esm/xyz/{xyzAutoPeaksPicking.js → xyzAutoZonesPicking.js} +36 -22
  186. package/lib-esm/xyz/xyzAutoZonesPicking.js.map +1 -0
  187. package/lib-esm/xyz/xyzJResAnalyzer.js.map +1 -1
  188. package/package.json +20 -17
  189. package/src/assignment/get13CAssignments.ts +5 -2
  190. package/src/assignment/get1HAssignments.ts +2 -2
  191. package/src/{types → assignment}/nmrAssigment.ts +2 -2
  192. package/src/assignment/utils/buildAssignments.ts +1 -4
  193. package/src/assignment/utils/createMapPossibleAssignments.ts +5 -2
  194. package/src/constants/couplingValues.ts +1 -1
  195. package/src/databases/DatabaseNMREntry.ts +1 -1
  196. package/src/index.ts +9 -10
  197. package/src/{types/ml-levenberg-marquardt/index.d.ts → ml-levenberg-marquardt.d.ts} +0 -0
  198. package/src/{types/ml-matrix-convolution/index.d.ts → ml-matrix-convolution.ts} +0 -0
  199. package/src/{types/ml-matrix-peaks-finder/index.d.ts → ml-matrix-peaks-finder.d.ts} +2 -2
  200. package/src/{types/ml-simple-clustering/index.d.ts → ml-simple-clustering.ts} +1 -1
  201. package/src/{types/ml-sparse-matrix/index.d.ts → ml-sparse-matrix.d.ts} +0 -0
  202. package/src/{types/ml-spectra-processing/index.d.ts → ml-spectra-processing.d.ts} +8 -2
  203. package/src/{types/ml-tree-set/index.d.ts → ml-tree-set.d.ts} +0 -0
  204. package/src/nmr-parser.d.ts +17 -0
  205. package/src/{types/openchemlib-utils/index..d.ts → openchemlib.d.ts} +17 -6
  206. package/src/peaks/NMRPeak1D.ts +5 -0
  207. package/src/peaks/peaksFilterImpurities.ts +3 -2
  208. package/src/peaks/peaksToRanges.ts +15 -21
  209. package/src/peaks/util/determineRealTop.ts +6 -9
  210. package/src/peaks/util/jAnalyzer.ts +16 -18
  211. package/src/peaks/util/joinRanges.ts +1 -1
  212. package/src/peaks/util/peakOptimizer.ts +5 -4
  213. package/src/{types → prediction}/dataStructure.ts +1 -1
  214. package/src/prediction/predictAll.ts +6 -7
  215. package/src/prediction/predictCOSY.ts +1 -2
  216. package/src/prediction/predictCarbon.ts +4 -4
  217. package/src/prediction/predictHMBC.ts +1 -2
  218. package/src/prediction/predictHSQC.ts +5 -3
  219. package/src/prediction/predictProton.ts +4 -3
  220. package/src/{types → prediction}/prediction1D.ts +2 -2
  221. package/src/prediction/utils/fetchPrediction.ts +1 -1
  222. package/src/prediction/utils/getFilteredIDiaIDs.ts +1 -2
  223. package/src/prediction/utils/getNuclei.ts +3 -3
  224. package/src/prediction/utils/getPredictions.ts +3 -3
  225. package/src/prediction/utils/predict2D.ts +4 -4
  226. package/src/prediction/utils/queryByHOSE.ts +2 -2
  227. package/src/ranges/rangesToACS.ts +2 -2
  228. package/src/ranges/rangesToXY.ts +5 -5
  229. package/src/signal/signalJoinCouplings.ts +6 -6
  230. package/src/signal/signalMultiplicityPattern.ts +1 -1
  231. package/src/{types → signals}/NMRSignal1D.ts +2 -1
  232. package/src/signals/hackSignalsToXY.ts +2 -2
  233. package/src/{types → signals}/jcoupling.ts +1 -1
  234. package/src/signals/signals2DToZ.ts +1 -1
  235. package/src/signals/signalsJoin.ts +11 -10
  236. package/src/signals/signalsToRanges.ts +4 -3
  237. package/src/signals/signalsToXY.ts +6 -6
  238. package/src/signals/simulation/signalsToSpinSystem.ts +4 -4
  239. package/src/signals/simulation/simulate1D.ts +5 -4
  240. package/src/signals/simulation/splitSpinSystem.ts +11 -3
  241. package/src/{types → signals}/spinSystem.ts +0 -0
  242. package/src/{types → utilities}/MakeMandatory.ts +0 -0
  243. package/src/utilities/joinPatterns.ts +0 -1
  244. package/src/utilities/rangeFromSignal.ts +1 -1
  245. package/src/utilities/resurrect.ts +1 -1
  246. package/src/utilities/resurrectRange.ts +2 -2
  247. package/src/{types → xy}/NMRRange.ts +1 -1
  248. package/src/xy/xyAutoPeaksPicking.ts +19 -58
  249. package/src/xy/xyAutoRangesPicking.ts +3 -2
  250. package/src/{types → xyz}/NMRSignal2D.ts +6 -8
  251. package/src/xyz/NMRZone.ts +10 -0
  252. package/src/xyz/{xyzAutoPeaksPicking.ts → xyzAutoZonesPicking.ts} +44 -27
  253. package/src/xyz/xyzJResAnalyzer.ts +7 -6
  254. package/CHANGELOG.md +0 -550
  255. package/lib/types/MPFPeak.d.ts +0 -9
  256. package/lib/types/MPFPeak.js +0 -3
  257. package/lib/types/MPFPeak.js.map +0 -1
  258. package/lib/types/MakeMandatory.js.map +0 -1
  259. package/lib/types/NMRPeak1D.d.ts +0 -11
  260. package/lib/types/NMRZone.d.ts +0 -12
  261. package/lib/types/XYNumberArray.d.ts +0 -4
  262. package/lib/types/XYNumberArray.js +0 -3
  263. package/lib/types/XYNumberArray.js.map +0 -1
  264. package/lib/types/dataStructure.js.map +0 -1
  265. package/lib/types/nmrAssigment.js.map +0 -1
  266. package/lib/types/prediction1D.js.map +0 -1
  267. package/lib/types/prediction2D.d.ts +0 -0
  268. package/lib/types/prediction2D.js +0 -2
  269. package/lib/types/prediction2D.js.map +0 -1
  270. package/lib/xyz/xyzAutoPeaksPicking.js.map +0 -1
  271. package/lib-esm/types/MPFPeak.js +0 -2
  272. package/lib-esm/types/MPFPeak.js.map +0 -1
  273. package/lib-esm/types/MakeMandatory.js.map +0 -1
  274. package/lib-esm/types/XYNumberArray.js +0 -2
  275. package/lib-esm/types/XYNumberArray.js.map +0 -1
  276. package/lib-esm/types/dataStructure.js.map +0 -1
  277. package/lib-esm/types/nmrAssigment.js.map +0 -1
  278. package/lib-esm/types/prediction1D.js.map +0 -1
  279. package/lib-esm/types/prediction2D.js +0 -2
  280. package/lib-esm/types/prediction2D.js.map +0 -1
  281. package/lib-esm/xyz/xyzAutoPeaksPicking.js.map +0 -1
  282. package/src/types/MPFPeak.ts +0 -9
  283. package/src/types/NMRPeak1D.ts +0 -11
  284. package/src/types/NMRZone.ts +0 -10
  285. package/src/types/XYNumberArray.ts +0 -4
  286. package/src/types/ml-gsd/index.d.ts +0 -164
  287. package/src/types/prediction2D.ts +0 -0
@@ -1,6 +1,6 @@
1
- import type { Molecule } from "openchemlib";
1
+ import type { Molecule } from 'openchemlib';
2
2
 
3
- import type { Prediction1D } from "../../types/prediction1D";
3
+ import type { Prediction1D } from '../prediction1D';
4
4
 
5
5
  import type { Predictions, PredictOptions, Predictors } from './predict2D';
6
6
 
@@ -21,4 +21,4 @@ export async function getPredictions(
21
21
  : undefined;
22
22
  }
23
23
  return prediction;
24
- }
24
+ }
@@ -11,12 +11,12 @@ import type {
11
11
  PathInfo,
12
12
  } from 'openchemlib-utils';
13
13
 
14
- import type { MakeMandatory } from '../../types/MakeMandatory';
15
- import type { NMRSignal1D } from '../../types/NMRSignal1D';
16
- import type { NMRSignal2D } from '../../types/NMRSignal2D';
17
- import type { Prediction1D } from '../../types/prediction1D';
14
+ import type { NMRSignal1D } from '../../signals/NMRSignal1D';
15
+ import type { MakeMandatory } from '../../utilities/MakeMandatory';
16
+ import type { NMRSignal2D } from '../../xyz/NMRSignal2D';
18
17
  import type { PredictCarbon, PredictCarbonOptions } from '../predictCarbon';
19
18
  import type { PredictProton, PredictProtonOptions } from '../predictProton';
19
+ import type { Prediction1D } from '../prediction1D';
20
20
 
21
21
  import { getNuclei } from './getNuclei';
22
22
  import { getPredictions } from './getPredictions';
@@ -1,4 +1,4 @@
1
- import type { DataBaseStructure } from '../../types/dataStructure';
1
+ import type { DataBaseStructure } from '../dataStructure';
2
2
 
3
3
  import type { GroupedDiaIDsWithHose } from './getFilteredIDiaIDs';
4
4
 
@@ -37,7 +37,7 @@ export function queryByHose(
37
37
  for (const atomNumber of element.atoms) {
38
38
  let atom = {
39
39
  diaIDs: [element.oclID],
40
- delta: res ? res[0]: null,
40
+ delta: res ? res[0] : null,
41
41
  atoms: [atomNumber],
42
42
  nbAtoms: 1,
43
43
  level: level,
@@ -1,7 +1,7 @@
1
1
  import { signalJoinCouplings } from '../signal/signalJoinCouplings';
2
2
  import { signalMultiplicityPattern } from '../signal/signalMultiplicityPattern';
3
- import type { NMRRange } from '../types/NMRRange';
4
- import type { NMRSignal1D } from '../types/NMRSignal1D';
3
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
4
+ import type { NMRRange } from '../xy/NMRRange';
5
5
 
6
6
  const globalOptions = {
7
7
  h: {
@@ -1,12 +1,12 @@
1
1
  import { DoubleArray } from 'cheminfo-types';
2
2
  import arraySequentialFill from 'ml-array-sequential-fill';
3
+ import type { Shape1D } from 'ml-peak-shape-generator';
3
4
  import { SpectrumGenerator } from 'spectrum-generator';
4
- import type { Shape1DOptions } from 'spectrum-generator';
5
5
 
6
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
6
7
  import { hackSignalsToXY } from '../signals/hackSignalsToXY';
7
- import type { MakeMandatory } from '../types/MakeMandatory';
8
- import type { NMRRange } from '../types/NMRRange';
9
- import type { NMRSignal1D } from '../types/NMRSignal1D';
8
+ import type { MakeMandatory } from '../utilities/MakeMandatory';
9
+ import type { NMRRange } from '../xy/NMRRange';
10
10
 
11
11
  type RangeWithSignal = MakeMandatory<NMRRange, 'signals'>;
12
12
 
@@ -40,7 +40,7 @@ export interface RangeToXYOptions {
40
40
  * options of signals.
41
41
  * @default { kind: 'gaussian' }
42
42
  */
43
- shape: Shape1DOptions;
43
+ shape: Shape1D;
44
44
  }
45
45
  function checkForSignals(
46
46
  ranges: NMRRange[],
@@ -1,8 +1,8 @@
1
1
  import sum from 'ml-array-sum';
2
2
 
3
- import type { MakeMandatory } from '../types/MakeMandatory';
4
- import type { NMRSignal1D } from '../types/NMRSignal1D';
5
- import type { Jcoupling } from '../types/jcoupling';
3
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
4
+ import type { Jcoupling } from '../signals/jcoupling';
5
+ import type { MakeMandatory } from '../utilities/MakeMandatory';
6
6
  import { joinPatterns } from '../utilities/joinPatterns';
7
7
 
8
8
  export interface SignalJoinCouplingsOptions {
@@ -46,7 +46,7 @@ const takeCareDiaIDs = (
46
46
  /**
47
47
  * Join couplings smaller than a define tolerance.
48
48
  * The resulting coupling should be an average of the existing one.
49
- * If distance is specified and is not always the same this property will be removed.
49
+ * If pathLength is specified and is not always the same this property will be removed.
50
50
  */
51
51
  export function signalJoinCouplings(
52
52
  signal: NMRSignal1D,
@@ -111,7 +111,7 @@ function groupJCouplings(
111
111
  ) as string[];
112
112
 
113
113
  let distances = distinctValues(
114
- group.map((group) => group.distance) as number[],
114
+ group.map((group) => group.pathLength) as number[],
115
115
  ) as number[];
116
116
 
117
117
  let multiplicity = joinPatterns(
@@ -126,7 +126,7 @@ function groupJCouplings(
126
126
  };
127
127
 
128
128
  if (diaIDs.length === 1) newJ.diaIDs = diaIDs;
129
- if (distances.length === 1 && distances[0]) newJ.distance = distances[0];
129
+ if (distances.length === 1 && distances[0]) newJ.pathLength = distances[0];
130
130
  if (assignment.length > 0) newJ.assignment = assignment;
131
131
  if (atoms.length > 0) newJ.atoms = atoms;
132
132
  signal.js.push(newJ);
@@ -1,4 +1,4 @@
1
- import type { NMRSignal1D } from '../types/NMRSignal1D';
1
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
2
2
  /**
3
3
  * Return
4
4
  * @param {*} signal
@@ -1,4 +1,5 @@
1
- import type { NMRPeak1D } from './NMRPeak1D';
1
+ import type { NMRPeak1D } from '../peaks/NMRPeak1D';
2
+
2
3
  import type { Jcoupling } from './jcoupling';
3
4
 
4
5
  export interface NMRSignal1D {
@@ -1,7 +1,7 @@
1
1
  import { couplingPatterns } from '../constants/couplingPatterns';
2
- import type { NMRSignal1D } from '../types/NMRSignal1D';
3
- import type { Jcoupling } from '../types/jcoupling';
4
2
 
3
+ import type { NMRSignal1D } from './NMRSignal1D';
4
+ import type { Jcoupling } from './jcoupling';
5
5
  import { OptionsSignalsToXY, signalsToXY } from './signalsToXY';
6
6
 
7
7
  /**
@@ -4,5 +4,5 @@ export interface Jcoupling {
4
4
  assignment?: string | string[];
5
5
  diaIDs?: string[];
6
6
  multiplicity?: string;
7
- distance?: number;
7
+ pathLength?: number;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  import { generateSpectrum2D } from 'spectrum-generator';
2
2
  import type { XYNumber } from 'spectrum-generator';
3
3
 
4
- import type { NMRSignal2D } from '../types/NMRSignal2D';
4
+ import type { NMRSignal2D } from '../xyz/NMRSignal2D';
5
5
 
6
6
  interface Signals2DToZOptions {
7
7
  /**
@@ -3,9 +3,10 @@ import sum from 'ml-array-sum';
3
3
 
4
4
  import { signalJoinCouplings } from '../signal/signalJoinCouplings';
5
5
  import type { SignalJoinCouplingsOptions } from '../signal/signalJoinCouplings';
6
- import type { MakeMandatory } from '../types/MakeMandatory';
7
- import type { NMRSignal1D } from '../types/NMRSignal1D';
8
- import type { Jcoupling } from '../types/jcoupling';
6
+ import type { MakeMandatory } from '../utilities/MakeMandatory';
7
+
8
+ import type { NMRSignal1D } from './NMRSignal1D';
9
+ import type { Jcoupling } from './jcoupling';
9
10
 
10
11
  export interface SignalsJoinOptions {
11
12
  /**
@@ -17,7 +18,7 @@ export interface SignalsJoinOptions {
17
18
 
18
19
  type JcouplingFromPrediction = MakeMandatory<
19
20
  Jcoupling,
20
- 'multiplicity' | 'diaIDs' | 'distance'
21
+ 'multiplicity' | 'diaIDs' | 'pathLength'
21
22
  >;
22
23
  type Signal1DWidthDiaID = MakeMandatory<NMRSignal1D, 'diaIDs'>;
23
24
  type Signal1DWidthJsAndDiaID = Omit<Signal1DWidthDiaID, 'js'> & {
@@ -29,8 +30,8 @@ const localeCompareJcouplingKeys = (
29
30
  a: JcouplingFromPrediction,
30
31
  b: JcouplingFromPrediction,
31
32
  ) => {
32
- const aa = `${a.diaIDs.join(' ')}${a.distance}`;
33
- const bb = `${b.diaIDs.join(' ')}${b.distance}`;
33
+ const aa = `${a.diaIDs.join(' ')}${a.pathLength}`;
34
+ const bb = `${b.diaIDs.join(' ')}${b.pathLength}`;
34
35
  return localeCompare(aa, bb);
35
36
  };
36
37
  function checkForMandatory(
@@ -41,7 +42,7 @@ function checkForMandatory(
41
42
  if (!signal.diaIDs) throw new Error('there is not diaIDs');
42
43
  for (const jcoupling of signal.js) {
43
44
  if (!jcoupling.diaIDs) throw new Error('there is not diaIDs');
44
- if (!jcoupling.distance) throw new Error('there is not distance');
45
+ if (!jcoupling.pathLength) throw new Error('there is not pathLength');
45
46
  }
46
47
  }
47
48
  }
@@ -68,7 +69,7 @@ export function signalsJoin(
68
69
  const keyDiaIDs = signal.diaIDs.join(' ');
69
70
  let id = `${keyDiaIDs} ${signal.js
70
71
  .map(
71
- (j: JcouplingFromPrediction) => `${j.diaIDs.join(' ')} ${j.distance}`,
72
+ (j: JcouplingFromPrediction) => `${j.diaIDs.join(' ')} ${j.pathLength}`,
72
73
  )
73
74
  .sort(localeCompare)
74
75
  .join(' ')}`;
@@ -80,13 +81,13 @@ export function signalsJoin(
80
81
  // for each group we need to combine assignments and average couplings
81
82
  let newSignals: Signal1DWidthJsAndDiaID[] = [];
82
83
  Object.values(groupedSignals).forEach((group) => {
83
- // joining couplings only if diaID and distance are equal
84
+ // joining couplings only if diaID and pathLength are equal
84
85
  let js: JcouplingFromPrediction[] = [];
85
86
  for (let i = 0; i < group[0].js.length; i++) {
86
87
  const coupling = group[0].js[i];
87
88
  js.push({
88
89
  diaIDs: coupling.diaIDs,
89
- distance: coupling.distance,
90
+ pathLength: coupling.pathLength,
90
91
  multiplicity: coupling.multiplicity,
91
92
  coupling: mean(group.map((item) => item.js[i].coupling)),
92
93
  });
@@ -1,7 +1,8 @@
1
- import type { MakeMandatory } from '../types/MakeMandatory';
2
- import type { NMRRange } from '../types/NMRRange';
3
- import type { NMRSignal1D } from '../types/NMRSignal1D';
1
+ import type { MakeMandatory } from '../utilities/MakeMandatory';
4
2
  import { rangeFromSignal } from '../utilities/rangeFromSignal';
3
+ import type { NMRRange } from '../xy/NMRRange';
4
+
5
+ import type { NMRSignal1D } from './NMRSignal1D';
5
6
 
6
7
  interface SignalsToRangesOptions {
7
8
  /**
@@ -1,11 +1,11 @@
1
1
  import rescale from 'ml-array-rescale';
2
2
  import arraySequentialFill from 'ml-array-sequential-fill';
3
- import type { Shape1DOptions } from 'spectrum-generator';
3
+ import type { Shape1D } from 'ml-peak-shape-generator';
4
4
 
5
- import type { MakeMandatory } from '../types/MakeMandatory';
6
- import type { NMRSignal1D } from '../types/NMRSignal1D';
7
- import type { Jcoupling } from '../types/jcoupling';
5
+ import type { MakeMandatory } from '../utilities/MakeMandatory';
8
6
 
7
+ import type { NMRSignal1D } from './NMRSignal1D';
8
+ import type { Jcoupling } from './jcoupling';
9
9
  import { signalsToSpinSystem } from './simulation/signalsToSpinSystem';
10
10
  import simulate1D from './simulation/simulate1D';
11
11
  import { splitSpinSystem } from './simulation/splitSpinSystem';
@@ -25,7 +25,7 @@ export interface OptionsSignalsToXY {
25
25
  /**
26
26
  * Shape options for ml-spectrum-generator
27
27
  */
28
- shape?: Shape1DOptions;
28
+ shape?: Shape1D;
29
29
  /**
30
30
  * The linewidth of the output spectrum, expresed in Hz.
31
31
  * @default 1
@@ -48,7 +48,7 @@ export interface OptionsSignalsToXY {
48
48
  maxClusterSize?: number;
49
49
  }
50
50
 
51
- type JcouplingFromPrediction = MakeMandatory<Jcoupling, 'distance'>;
51
+ type JcouplingFromPrediction = MakeMandatory<Jcoupling, 'pathLength'>;
52
52
  type Signal1DWidthAtomsIDsAndDiaID = MakeMandatory<NMRSignal1D, 'atoms'>;
53
53
  type Signal1DWidthJsAndDiaID = Omit<Signal1DWidthAtomsIDsAndDiaID, 'js'> & {
54
54
  js: JcouplingFromPrediction[];
@@ -1,10 +1,10 @@
1
1
  import { Matrix } from 'ml-matrix';
2
2
  import simpleClustering from 'ml-simple-clustering';
3
3
 
4
- import type { MakeMandatory } from '../../types/MakeMandatory';
5
- import type { NMRSignal1D } from '../../types/NMRSignal1D';
6
- import type { Jcoupling } from '../../types/jcoupling';
7
- import type { SpinSystem } from '../../types/spinSystem';
4
+ import type { MakeMandatory } from '../../utilities/MakeMandatory';
5
+ import type { NMRSignal1D } from '../NMRSignal1D';
6
+ import type { Jcoupling } from '../jcoupling';
7
+ import type { SpinSystem } from '../spinSystem';
8
8
 
9
9
  interface Ids {
10
10
  [index: number]: number;
@@ -1,11 +1,12 @@
1
1
  import binarySearch from 'binary-search';
2
+ import { DataXY } from 'cheminfo-types';
2
3
  import { Matrix, EVD } from 'ml-matrix';
3
4
  import type { Matrix as MatrixClassType } from 'ml-matrix';
5
+ import type { Shape1D } from 'ml-peak-shape-generator';
4
6
  import { SparseMatrix } from 'ml-sparse-matrix';
5
7
  import { SpectrumGenerator } from 'spectrum-generator';
6
- import type { Shape1DOptions } from 'spectrum-generator';
7
8
 
8
- import type { SpinSystem } from '../../types/spinSystem';
9
+ import type { SpinSystem } from '../spinSystem';
9
10
 
10
11
  import getPauliMatrix from './getPauliMatrix';
11
12
 
@@ -46,7 +47,7 @@ interface Simulate1DOptions {
46
47
  * Shape options
47
48
  * @default {kind:'gaussian'}
48
49
  */
49
- shape?: Shape1DOptions;
50
+ shape?: Shape1D;
50
51
  }
51
52
 
52
53
  /**
@@ -59,7 +60,7 @@ export default function simulate1D(
59
60
  */
60
61
  spinSystem: SpinSystem,
61
62
  options: Simulate1DOptions = {},
62
- ) {
63
+ ): DataXY {
63
64
  let {
64
65
  lineWidth = 1,
65
66
  maxClusterSize = 8,
@@ -2,7 +2,7 @@ import { agnes } from 'ml-hclust';
2
2
  import type { Cluster } from 'ml-hclust';
3
3
  import { Matrix } from 'ml-matrix';
4
4
 
5
- import type { SpinSystem } from '../../types/spinSystem';
5
+ import type { SpinSystem } from '../spinSystem';
6
6
 
7
7
  export interface SplitSpinSystemOptions {
8
8
  /**
@@ -53,7 +53,11 @@ interface SplitClusterOptions {
53
53
  connectivity: Matrix;
54
54
  }
55
55
 
56
- function splitCluster(cluster: Cluster, clusterList: Array<Int16Array>, options: SplitClusterOptions) {
56
+ function splitCluster(
57
+ cluster: Cluster,
58
+ clusterList: Array<Int16Array>,
59
+ options: SplitClusterOptions,
60
+ ) {
57
61
  let { maxClusterSize, force, nSpins, connectivity } = options;
58
62
  if (!force && cluster.size <= maxClusterSize) {
59
63
  clusterList.push(getMembers(cluster.indices(), nSpins));
@@ -102,7 +106,11 @@ function splitCluster(cluster: Cluster, clusterList: Array<Int16Array>, options:
102
106
  }
103
107
  }
104
108
 
105
- function calculateBetas(chemicalShifts: number[], couplingConstants: Matrix, frequency: number) {
109
+ function calculateBetas(
110
+ chemicalShifts: number[],
111
+ couplingConstants: Matrix,
112
+ frequency: number,
113
+ ) {
106
114
  let nRows = couplingConstants.rows;
107
115
  let nColumns = couplingConstants.columns;
108
116
  let betas = Matrix.zeros(nRows, nRows);
File without changes
File without changes
@@ -1,7 +1,6 @@
1
1
  import { couplingPatterns } from '../constants/couplingPatterns';
2
2
  import { couplingValues } from '../constants/couplingValues';
3
3
 
4
-
5
4
  export function joinPatterns(patterns: string[]) {
6
5
  const sum = patterns.reduce((sum, pattern) => {
7
6
  if (isNaN(couplingValues[pattern])) {
@@ -1,5 +1,5 @@
1
1
  import { couplingValues } from '../constants/couplingValues';
2
- import type { NMRSignal1D } from '../types/NMRSignal1D';
2
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
3
3
 
4
4
  export interface RangeFromSignalOptions {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { NMRRange } from '../types/NMRRange';
1
+ import type { NMRRange } from '../xy/NMRRange';
2
2
 
3
3
  import { resurrectRange } from './resurrectRange';
4
4
  import { splitParenthesis } from './splitParenthesis';
@@ -1,5 +1,5 @@
1
- import type { NMRRange } from '../types/NMRRange';
2
- import type { NMRSignal1D } from '../types/NMRSignal1D';
1
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
2
+ import type { NMRRange } from '../xy/NMRRange';
3
3
 
4
4
  import { rangeFromSignal } from './rangeFromSignal';
5
5
  import { splitParenthesis } from './splitParenthesis';
@@ -1,4 +1,4 @@
1
- import type { NMRSignal1D } from './NMRSignal1D';
1
+ import type { NMRSignal1D } from '../signals/NMRSignal1D';
2
2
 
3
3
  export interface NMRRange {
4
4
  from: number;
@@ -1,12 +1,17 @@
1
1
  import { DataXY } from 'cheminfo-types';
2
2
  import { gsd, joinBroadPeaks, optimizePeaks } from 'ml-gsd';
3
+ import type {
4
+ Peak1D,
5
+ GSDOptions,
6
+ OptimizePeaksOptions,
7
+ JoinBroadPeaksOptions,
8
+ } from 'ml-gsd';
3
9
  import {
4
10
  xyExtract,
5
11
  xNoiseSanPlot,
6
12
  xAbsoluteMedian,
7
13
  } from 'ml-spectra-processing';
8
14
 
9
- import type { NMRPeak1D } from '../types/NMRPeak1D';
10
15
  /**
11
16
  * Implementation of the peak picking method described by Cobas in:
12
17
  * A new approach to improving automated analysis of proton NMR spectra
@@ -20,63 +25,19 @@ interface OptionsGetCutOff {
20
25
  thresholdFactor: number;
21
26
  }
22
27
 
23
- interface OptionsGetPeakList {
24
- /**
25
- * Noise threshold in spectrum y units. Default is three/thresholdFactor times the absolute median of data.y.
26
- * @default `median(data.y) * (options.thresholdFactor || 3)`
27
- */
28
- noiseLevel?: number;
29
- /**
30
- * Threshold to determine if a given peak should be considered as a noise, bases on its relative height compared to the highest peak.
31
- * @default 0.01
32
- */
33
- minMaxRatio: number;
34
- /**
35
- * If broadRatio is higher than 0, then all the peaks which second derivative smaller than broadRatio * maxAbsSecondDerivative will be marked with the soft mask equal to true.
36
- * @default 0.00025
37
- */
38
- broadRatio: number;
39
- /**
40
- * Select the peak intensities from a smoothed version of the independent variables.
41
- * @default true
42
- */
43
- smoothY: boolean;
28
+ export interface IGetPeakListOptions
29
+ extends GSDOptions,
30
+ OptimizePeaksOptions,
31
+ JoinBroadPeaksOptions {
44
32
  /**
45
33
  * If it is true, the peaks parameters will be optimized.
46
34
  * @default false
47
35
  */
48
36
  optimize: boolean;
49
- /**
50
- * factor to determine the width at the moment to group the peaks in signals in 'GSD.optimizePeaks' function.
51
- * @default 4
52
- */
53
- factorWidth: number;
54
- /**
55
- * if it is true, it optimizes the x and intensity by extrapolation.
56
- */
57
- realTopDetection: boolean;
58
- /**
59
- * options to shape used to adapt the FWHM
60
- * @default {kind:'gaussian'}
61
- */
62
- shape: { kind: string };
63
- /**
64
- * options for optimization step, kind represent the algorithm
65
- * @default {kind:'lm'}
66
- */
67
- optimization: { kind: string };
68
- /**
69
- * Threshold to determine if some peak is candidate to clustering into range.
70
- * @default 0.25
71
- */
72
- broadWidth: number;
73
- /**
74
- * Options for savitz Golay
75
- */
76
- sgOptions: { windowSize: number; polynomial: number };
77
37
  }
78
38
 
79
- export interface OptionsXYAutoPeaksPicking extends Partial<OptionsGetPeakList> {
39
+ export interface OptionsXYAutoPeaksPicking
40
+ extends Partial<IGetPeakListOptions> {
80
41
  /**
81
42
  * Low limit value in the x axis to extract a sub set of points from the input data.
82
43
  */
@@ -105,7 +66,7 @@ export interface OptionsXYAutoPeaksPicking extends Partial<OptionsGetPeakList> {
105
66
  export function xyAutoPeaksPicking(
106
67
  data: DataXY,
107
68
  options: OptionsXYAutoPeaksPicking = {},
108
- ): NMRPeak1D[] {
69
+ ): Peak1D[] {
109
70
  const {
110
71
  from,
111
72
  to,
@@ -131,7 +92,7 @@ export function xyAutoPeaksPicking(
131
92
 
132
93
  const cutOff = getCutOff(data.y, { noiseLevel, useSanPlot, thresholdFactor });
133
94
 
134
- let getPeakOptions = {
95
+ let getPeakOptions: IGetPeakListOptions = {
135
96
  shape,
136
97
  broadWidth,
137
98
  optimize,
@@ -154,7 +115,7 @@ export function xyAutoPeaksPicking(
154
115
  return peaks;
155
116
  }
156
117
 
157
- function getPeakList(data: DataXY, options: OptionsGetPeakList) {
118
+ function getPeakList(data: DataXY, options: IGetPeakListOptions) {
158
119
  const {
159
120
  shape,
160
121
  broadWidth,
@@ -173,15 +134,15 @@ function getPeakList(data: DataXY, options: OptionsGetPeakList) {
173
134
  shape,
174
135
  sgOptions,
175
136
  minMaxRatio,
176
- broadRatio,
177
137
  noiseLevel,
178
138
  smoothY,
179
139
  realTopDetection,
180
140
  });
181
141
 
182
142
  if (broadWidth) {
183
- peakList = joinBroadPeaks(peakList, {
184
- width: broadWidth,
143
+ peakList = joinBroadPeaks(data, peakList, {
144
+ broadRatio,
145
+ broadWidth,
185
146
  shape,
186
147
  optimization,
187
148
  });
@@ -198,7 +159,7 @@ function getPeakList(data: DataXY, options: OptionsGetPeakList) {
198
159
  return peakList;
199
160
  }
200
161
 
201
- function getNegativePeaks(data: DataXY, options: OptionsGetPeakList) {
162
+ function getNegativePeaks(data: DataXY, options: IGetPeakListOptions) {
202
163
  let { x, y } = data;
203
164
  let negativeDataY = new Float64Array(data.y.length);
204
165
  for (let i = 0; i < negativeDataY.length; i++) {
@@ -1,7 +1,8 @@
1
+ import type { DataXY } from 'cheminfo-types';
2
+
1
3
  import { peaksFilterImpurities } from '../peaks/peaksFilterImpurities';
2
4
  import type { OptionsPeaksFilterImpurities } from '../peaks/peaksFilterImpurities';
3
5
  import { OptionsPeaksToRanges, peaksToRanges } from '../peaks/peaksToRanges';
4
- import type { XYNumberArray } from '../types/XYNumberArray';
5
6
 
6
7
  import { xyAutoPeaksPicking } from './xyAutoPeaksPicking';
7
8
  import type { OptionsXYAutoPeaksPicking } from './xyAutoPeaksPicking';
@@ -16,7 +17,7 @@ interface OptionsXYAutoRangesPicking {
16
17
  * Detect peaks, optimize parameters and compile multiplicity if required.
17
18
  */
18
19
  export function xyAutoRangesPicking(
19
- data: XYNumberArray,
20
+ data: DataXY,
20
21
  options: OptionsXYAutoRangesPicking = {},
21
22
  ) {
22
23
  let peaks = xyAutoPeaksPicking(data, options.peakPicking);
@@ -1,4 +1,5 @@
1
- import type { MPFPeak } from './MPFPeak';
1
+ import type { FromTo } from 'cheminfo-types';
2
+ import type { Peak2D } from 'ml-matrix-peaks-finder';
2
3
 
3
4
  export interface Signal2DAxisData {
4
5
  nucleus?: string;
@@ -6,17 +7,14 @@ export interface Signal2DAxisData {
6
7
  resolution?: number;
7
8
  atoms?: number[];
8
9
  diaIDs?: string[];
9
- fromTo?: {
10
- from: number;
11
- to: number
12
- };
13
10
  }
14
11
  export interface NMRSignal2D {
15
12
  x: Signal2DAxisData;
16
13
  y: Signal2DAxisData;
14
+ j?: {
15
+ pathLength?: number | FromTo;
16
+ };
17
17
  id?: string;
18
- peaks?: MPFPeak[];
18
+ peaks?: Peak2D[];
19
19
  kind?: string;
20
- //eslint-disable-next-line
21
- _highlight?: (number | string)[];
22
20
  }
@@ -0,0 +1,10 @@
1
+ import type { FromTo } from 'cheminfo-types';
2
+
3
+ import type { NMRSignal2D } from './NMRSignal2D';
4
+
5
+ export interface NMRZone {
6
+ x: FromTo;
7
+ y: FromTo;
8
+ id?: string;
9
+ signals: NMRSignal2D[];
10
+ }