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, 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.0.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.0.0
File Size Uploaded Provenance Actions
pysrfit-1.0.0.tar.gz 96.1 kB Without provenance Details for pysrfit-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 182.1 kB

Release files / pysrfit-1.0.0.tar.gz

Download URL pysrfit-1.0.0.tar.gz
Size 96.1 kB
Tags Source
SHA-256 checksum
How to use checksums
33cd385bad7c20753e0e53d71d7a191d9939729db9118472448906de0473dca3
BLAKE2b-256 checksum
How to use checksums
4dceb82a2d368382b6a3f757318216169a8f84630deb46b4cfecb4e2940afa03
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.0.0-py3-none-any.whl

Download URL pysrfit-1.0.0-py3-none-any.whl
Size 86.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71f97f7fad98aa939441c769a12a0304f23db73f34e7b187b000b2f27f2917f1
BLAKE2b-256 checksum
How to use checksums
b457703ac3d1ae632ed930042f23066afe7590aa82d071e7156d112bd29ebf4b
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.0.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.0.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