Skip to main content
https://raw.githubusercontent.com/HawkMRS/pyAMARES/main/pyAMARES_logo.svg

The full documentation for pyAMARES can be found at pyAMARES Documentation.

What is pyAMARES?

The pyAMARES package provides the MRS community with an open-source, easy-to-use MRS fitting method in Python. It imports prior knowledge from Excel or CSV spreadsheets as initial values and constraints for fitting MRS data according to the AMARES model function.

Getting Started

Requirements

Python Version Ruff

Installation

pip install pyAMARES

See the Installation Guide for detailed information.

Run pyAMARES as standard-alone script

amaresFit -f ./pyAMARES/examples/fid.txt -p  ./pyAMARES/examples/example_human_brain_31P_7T.csv --MHz 120.0 --sw 10000 --deadtime 300e-6 --ifplot --xlim 10 -20 -o simple_example

Run pyAMARES in a Jupyter Notebook

Try Jupyter Notebook on Google Colab here

import pyAMARES
# Load FID from a 2-column ASCII file, and set the MR parameters
MHz = 120.0 # 31P nuclei at 7T
sw = 10000 # spectrum width in Hz
deadtime = 300e-6 # 300 us begin time for the FID signal acquisition

fid = pyAMARES.readmrs('./pyAMARES/examples/fid.txt')
# Load Prior Knowledge
FIDobj = pyAMARES.initialize_FID(fid=fid,
                                 priorknowledgefile='./pyAMARES/examples/example_human_brain_31P_7T.csv',
                                 MHz=MHz,
                                 sw=sw,
                                 deadtime=deadtime,
                                 preview=False,
                                 normalize_fid=False,
                                 xlim=(10, -20))# Region of Interest for visualization, -20 to 10 ppm

# Initialize the parameter using Levenberg-Marquard method
out1 = pyAMARES.fitAMARES(fid_parameters=FIDobj,
                           fitting_parameters=FIDobj.initialParams,
                           method='leastsq',
                           ifplot=False)

# Fitting the MRS data using the optimized parameter

out2 = pyAMARES.fitAMARES(fid_parameters=out1,
                          fitting_parameters=out1.fittedParams, # optimized parameter for last step
                          method='least_squares',
                          ifplot=False)

# Save the data
out2.styled_df.to_html('simple_example.html') # Save highlighted table to an HTML page
                                              # Python 3.6 does not support to_html.
out2.result_sum.to_csv('simple_example.csv') # Save table to CSV spreadsheet
out2.plotParameters.lb = 2.0 # Line Broadening factor for visualization
out2.plotParameters.ifphase = True # Phase the spectrum for visualization
pyAMARES.plotAMARES(fid_parameters=out1, filename='simple_example.svg') # Save plot to SVG

Fitting Result for Example 31P MRS data

https://raw.githubusercontent.com/HawkMRS/pyAMARES/main/pyAMARES/examples/simple_example.svg https://raw.githubusercontent.com/HawkMRS/pyAMARES/main/pyAMARES/examples/simple_example_html.jpeg

Contributing

PyAMARES is currently in its early stages of development and is actively being improved. We welcome contributions to pyAMARES! Please see our CONTRIBUTING.rst guidelines for more information on how to get started.

How to cite

If you use pyAMARES in your research, please cite:

Xu, J.; Vaeggemose, M.; Schulte, R.F.; Yang, B.; Lee, C.-Y.; Laustsen, C.; Magnotta, V.A. PyAMARES, an Open-Source Python Library for Fitting Magnetic Resonance Spectroscopy Data. Diagnostics 2024, 14, 2668. https://doi.org/10.3390/diagnostics14232668

Metadata

Release files for pyAMARES 0.3.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyAMARES 0.3.28
File Size Uploaded
pyamares-0.3.28.tar.gz 929.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyAMARES 0.3.28
File Interpreter ABI Platform
pyamares-0.3.28-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / pyamares-0.3.28.tar.gz

Download URL pyamares-0.3.28.tar.gz
Size 929.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a6790faf485861bbaad55dbcfb204d7ec7347db2aadfb44d0046cbdab80ed30
BLAKE2b-256 checksum
How to use checksums
97bdc251f129e717ee7f68d58b39b1bb27497f94a8226e49ed76d1ca4c4b89d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / pyamares-0.3.28-py3-none-any.whl

Download URL pyamares-0.3.28-py3-none-any.whl
Size 258.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc77b2711600e06912d1101c6f6de687677766c805d3b0cc3bec47e76a33940a
BLAKE2b-256 checksum
How to use checksums
d6997083f7ff079927abae51cc55d8c41e8293a3c16476d66343af43f4f4107a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release history Release notifications | RSS feed

This release

0.3.28 This release

2 release files

0.3.24

2 release files

0.3.20

2 release files

0.3.19

2 release files

0.3.16

2 release files

0.3.8

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page