Simple yet powerful package for neutron resonance fitting
Project description
nbragg
nbragg is a package designed for fitting neutron Bragg edge data using NCrystal cross-sections. This tool provides a straightforward way to analyze neutron transmission through polycrystalline materials, leveraging Bragg edges to extract information on material structure and composition.
Features
- Flexible Cross-Section Calculations: Interfaces with NCrystal to fetch cross-sections for crystalline materials.
- Built-In Tools for Response and Background Functions: Includes predefined models for instrument response (e.g., Jorgensen, square) and background components (polynomial functions).
- LMFit Integration: Allows flexible, nonlinear fitting of experimental data using the powerful lmfit library.
- Rietveld-type analysis: Enables iterative, parametric refinement of Bragg edge data using the Rietveld method, accumulating parameters across stages for robust fitting.
- Pythonic API: Simple-to-use, yet flexible enough for custom modeling.
- Plotting Utilities: Provides ready-to-use plotting functions for easy visualization of results.
- Bragg Edge Analysis: Perform Bragg edge fitting to extract information such as d-spacing, strain, and texture.
Installation
To install use:
pip install nbragg
Usage
Here's a quick example to get started:
import nbragg
data = nbragg.Data.from_transmission("iron_powder.csv") # read data
xs = nbragg.CrossSection(iron="Fe_sg229_Iron-alpha.ncmat") # define sample
model = nbragg.TransmissionModel(xs, vary_background=True, vary_response=True) # define model
result = model.fit(data) # perform fit
result.plot() # plot results
Tutorials and Documentation
For more detailed examples and advanced usage, including custom stage definitions and Rietveld fitting, please refer to our documentation page and check out the updated Jupyter notebook tutorial.
License
nbragg is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbragg-0.3.1.tar.gz.
File metadata
- Download URL: nbragg-0.3.1.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e485df87fc749ae092a56605e2362777f96cb0c92db50ab917fc117c9f93321
|
|
| MD5 |
fbf6021f28fb7bba2ab5566963224586
|
|
| BLAKE2b-256 |
2acbfd3563933623c9c787183cf696d9fa57986b7789a19a88648c46a04f5765
|
Provenance
The following attestation bundles were made for nbragg-0.3.1.tar.gz:
Publisher:
python-publish.yml on TsvikiHirsh/nbragg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbragg-0.3.1.tar.gz -
Subject digest:
6e485df87fc749ae092a56605e2362777f96cb0c92db50ab917fc117c9f93321 - Sigstore transparency entry: 565913264
- Sigstore integration time:
-
Permalink:
TsvikiHirsh/nbragg@79fbbcbf1a1e7eebc70a2fc41aa12cd660bc088f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/TsvikiHirsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@79fbbcbf1a1e7eebc70a2fc41aa12cd660bc088f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nbragg-0.3.1-py3-none-any.whl.
File metadata
- Download URL: nbragg-0.3.1-py3-none-any.whl
- Upload date:
- Size: 43.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67efeb0e9a36aae3f984b1de9df5e6f0851a60c464c7a1621bba7b928b73642e
|
|
| MD5 |
005b0328392ea0e51095a22f66129510
|
|
| BLAKE2b-256 |
7412184af7859bfffce145a1de67c5db60cd23ff9622acec8223199fccffe91b
|
Provenance
The following attestation bundles were made for nbragg-0.3.1-py3-none-any.whl:
Publisher:
python-publish.yml on TsvikiHirsh/nbragg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbragg-0.3.1-py3-none-any.whl -
Subject digest:
67efeb0e9a36aae3f984b1de9df5e6f0851a60c464c7a1621bba7b928b73642e - Sigstore transparency entry: 565913266
- Sigstore integration time:
-
Permalink:
TsvikiHirsh/nbragg@79fbbcbf1a1e7eebc70a2fc41aa12cd660bc088f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/TsvikiHirsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@79fbbcbf1a1e7eebc70a2fc41aa12cd660bc088f -
Trigger Event:
workflow_dispatch
-
Statement type: