PyAMARES, an Open-Source Python Library for Fitting Magnetic Resonance Spectroscopy Data

Diagnostics (Basel). 2024 Nov 27;14(23):2668. doi: 10.3390/diagnostics14232668.

Abstract

Background/Objectives: Magnetic resonance spectroscopy (MRS) is a valuable tool for studying metabolic processes in vivo. While numerous quantification methods exist, the advanced method for accurate, robust, and efficient spectral fitting (AMARES) is among the most used. This study introduces pyAMARES, an open-source Python implementation of AMARES, addressing the need for a flexible, user-friendly, and versatile MRS quantification tool within the Python ecosystem. Methods: PyAMARES was developed as a Python library, implementing the AMARES algorithm with additional features such as multiprocessing capabilities and customizable objective functions. The software was validated against established AMARES implementations (OXSA and jMRUI) using both simulated and in vivo MRS data. Monte Carlo simulations were conducted to assess robustness and accuracy across various signal-to-noise ratios and parameter perturbations. Results: PyAMARES utilizes spreadsheet-based prior knowledge and fitting parameter settings, enhancing flexibility and ease of use. It demonstrated comparable performance to existing software in terms of accuracy, precision, and computational efficiency. In addition to conventional AMARES fitting, pyAMARES supports fitting without prior knowledge, frequency-selective AMARES, and metabolite residual removal from mobile macromolecule (MM) spectra. Utilizing multiple CPU cores significantly enhances the performance of pyAMARES. Conclusions: PyAMARES offers a robust, flexible, and user-friendly solution for MRS quantification within the Python ecosystem. Its open-source nature, comprehensive documentation, and integration with popular data science tools enhance reproducibility and collaboration in MRS research. PyAMARES bridges the gap between traditional MRS fitting methods and modern machine learning frameworks, potentially accelerating advancements in metabolic studies and clinical applications.

Keywords: 31P MRS; AMARES; MRS quantification; Python; X-nuclei; dynamic MRS; magnetic resonance spectroscopy; metabolite quantification; open-source software.