Skip to main content

pySRFit

A modern, interactive GUI application for analysing muon spin rotation, relaxation and resonance (μSR) data. pySRFit is inspired by musrfit and uses a similar parameter and THEORY style.

Python PyQt5 License

Features

Core Capabilities

  • Multi-beamline support: Load raw μSR data from PSI, ISIS, J-PARC and TRIUMF.
  • Fitting: Perform single-run, global and sequential fits using MINUIT.
  • Fourier transform: Display data and fits in the time domain or as Fourier transforms.
  • Save dataset: Save complete analyses as .pysrfit projects.
  • Generate a tabulated result table: Collect fitted projects into CSV result tables.
  • Custom relaxation functions: Add custom Python relaxation functions.

Installation

pip install pysrfit

# Launch the GUI
pysrfit

Usage

Basic Workflow

  1. Launch the application:

    pysrfit
    
  2. Load data:

    • Configure the selected run in Runs / Data.
  3. Model:

    • Define the parameters and THEORY model.
  4. Fit and visualise:

    • Apply the parameters, fit the data, and save the .pysrfit project.

Supported Facilities

  • PSI: MusrRoot .root files and legacy PSI-BIN .bin files, tested with GPS, GPD, FLAME, HAL and LEM.
  • ISIS: NeXus .nxs files.
  • J-PARC: NeXus .nxs files, tested with MS1 and MD1.
  • TRIUMF: binary MUD .msr and .mud files, tested with M20 and M15.

Theory

Consecutive THEORY lines multiply, while + starts an additive component:

asymmetry 1
simplExpo 2
TFieldCos 3 4
+
asymmetry 5

Built-in functions include exponential, stretched-exponential and Gaussian relaxation, cosine and Bessel oscillations, Gaussian and Lorentzian Kubo–Toyabe models, and their longitudinal-field and dynamic forms. Additional models can be registered with Python in Custom models.

Generalized two-state collision model

The two-state model from O. K. Forslund, Phys. Rev. B 112, 024309 (2025) accepts any registered static function:

twoState nu1 nu2 g | staticFunction1 ... | staticFunction2 ...

For example, symmetric switching between two Gaussian Kubo–Toyabe states is:

asymmetry 1
twoState 2 2 3 | statGssKt 4 | statGssKt 5

The first two references are the switching rates. The third is the probability of starting in state 1 and should be constrained between 0 and 1.


Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.


Citation

If you use pySRFit in your research, please cite:



Metadata

Release files for pysrfit 1.1.0

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

Source distribution (sdist)

Source distribution for pysrfit 1.1.0
File Size Uploaded Provenance Actions
pysrfit-1.1.0.tar.gz 100.0 kB Without provenance Details for pysrfit-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysrfit 1.1.0
File Interpreter ABI Platform Actions
pysrfit-1.1.0-py3-none-any.whl Python 3 none any Details for pysrfit-1.1.0-py3-none-any.whl

Total release size: 189.1 kB

Release files / pysrfit-1.1.0.tar.gz

Download URL pysrfit-1.1.0.tar.gz
Size 100.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4d141dc28ac54b49d60132ad4658d6853aa821046f03f4c4658a69ac94104d25
BLAKE2b-256 checksum
How to use checksums
80c40e216fd852875f136207e533215fad82fe9d1322e5b05e3f71222bf31bdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / pysrfit-1.1.0-py3-none-any.whl

Download URL pysrfit-1.1.0-py3-none-any.whl
Size 89.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d666b0dd58396fa0c9a3aa77884334126048980cb9408dd0b3a345ba0a2bb455
BLAKE2b-256 checksum
How to use checksums
c8e62a1f055afa812b2140b03176a4feca260cc3264aa3b0520c2f0c18a079e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for pysrfit 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

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