Skip to main content

PyAMARES repackaged for clean pip installs on Apple Silicon (arm64): hlsvdpro is made platform-conditional. A faithful BSD repackage of HawkMRS/pyAMARES with zero algorithm changes; still 'import pyAMARES'.

Project description

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-xmris

(The import name remains pyAMARES. To install the original upstream distribution instead, use pip install pyAMARES — note that it does not install on arm64.)

See the Installation Guide for detailed information.

Run pyAMARES in any web browser

New: PyAMARES now offers a user-friendly web interface for fitting AMARES models without writing any code. The web app provides a graphical interface to:

  • Upload your FID data file

  • Upload the prior knowledge spreadsheet (Excel or CSV)

  • Edit the prior knowledge spreadsheet as needed

  • Set MR parameters (MHz, spectrum width, deadtime, etc)

  • Visualize results with interactive plots

  • Download fitted results and figures

Streamlit App

No installation required - just visit the link and start fittting your MRS data right away!

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyamares_xmris-0.3.33.tar.gz (947.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyamares_xmris-0.3.33-py3-none-any.whl (270.7 kB view details)

Uploaded Python 3

File details

Details for the file pyamares_xmris-0.3.33.tar.gz.

File metadata

  • Download URL: pyamares_xmris-0.3.33.tar.gz
  • Upload date:
  • Size: 947.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyamares_xmris-0.3.33.tar.gz
Algorithm Hash digest
SHA256 eb3776c6ab07fb09fd32d28c4fca8255331029e84bae6310445a097e16ee0559
MD5 d024a1fb900bb53f0de105399e490d91
BLAKE2b-256 383a51f15271c7a989934690edae0ec2c3b638f0274e1c8540c5c4cded8d0bb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyamares_xmris-0.3.33.tar.gz:

Publisher: publish.yml on andrewendlinger/pyAMARES

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyamares_xmris-0.3.33-py3-none-any.whl.

File metadata

  • Download URL: pyamares_xmris-0.3.33-py3-none-any.whl
  • Upload date:
  • Size: 270.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyamares_xmris-0.3.33-py3-none-any.whl
Algorithm Hash digest
SHA256 666bb29a17d2825c36871917c4623c192fb503cdfb741cbcdb9626e3c987c195
MD5 49f49c18947755d58670e753bbb265e0
BLAKE2b-256 f48be82f48f840e6f82c4e249d600a4a0e3c9c3eb8f33b18c5bdf08ab3fa56e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyamares_xmris-0.3.33-py3-none-any.whl:

Publisher: publish.yml on andrewendlinger/pyAMARES

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page