nxs-analysis-tools 0.0.33__tar.gz → 0.0.35__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nxs-analysis-tools might be problematic. Click here for more details.
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/LICENSE +21 -21
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/MANIFEST.in +3 -3
- {nxs_analysis_tools-0.0.33/src/nxs_analysis_tools.egg-info → nxs_analysis_tools-0.0.35}/PKG-INFO +1 -1
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/README.md +19 -19
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/pyproject.toml +66 -66
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/setup.py +4 -4
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/_meta/__init__.py +10 -10
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/__init__.py +12 -12
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/chess.py +5 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35/src/nxs_analysis_tools.egg-info}/PKG-INFO +1 -1
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_chess.py +15 -15
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_chess_fitting.py +20 -20
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_datareduction.py +19 -19
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_fitting.py +27 -27
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_lmfit.py +94 -94
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/tests/test_pairdistribution.py +39 -39
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/setup.cfg +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/datareduction.py +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/fitting.py +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/pairdistribution.py +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/SOURCES.txt +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/dependency_links.txt +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/requires.txt +0 -0
- {nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Steven J. Gomez Alvarado
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Steven J. Gomez Alvarado
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Exclude generated files
|
|
2
|
-
prune */__pycache__
|
|
3
|
-
global-exclude *.pyc *.pyo *.pyd *.swp *.bak *~ */magentropy.egg-info/*
|
|
1
|
+
# Exclude generated files
|
|
2
|
+
prune */__pycache__
|
|
3
|
+
global-exclude *.pyc *.pyo *.pyd *.swp *.bak *~ */magentropy.egg-info/*
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# nxs-analysis-tools
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
nxs-analysis-tools provides a suite of tools for slicing (2D), cutting (1D), and transforming (e.g., symmetrizing, interpolating, deltaPDF) nexus format (.nxs) scattering data.
|
|
6
|
-
|
|
7
|
-
View the documentation [here](https://nxs-analysis-tools.readthedocs.io/en/stable/).
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
Install nxs-analysis-tools with ``pip``:
|
|
12
|
-
|
|
13
|
-
```{code-block} console
|
|
14
|
-
pip install nxs-analysis-tools
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## License
|
|
18
|
-
|
|
19
|
-
This project is licensed under the MIT License.
|
|
1
|
+
# nxs-analysis-tools
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
nxs-analysis-tools provides a suite of tools for slicing (2D), cutting (1D), and transforming (e.g., symmetrizing, interpolating, deltaPDF) nexus format (.nxs) scattering data.
|
|
6
|
+
|
|
7
|
+
View the documentation [here](https://nxs-analysis-tools.readthedocs.io/en/stable/).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Install nxs-analysis-tools with ``pip``:
|
|
12
|
+
|
|
13
|
+
```{code-block} console
|
|
14
|
+
pip install nxs-analysis-tools
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
|
|
19
|
+
This project is licensed under the MIT License.
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
# keep consistent with _meta/__init__.py
|
|
2
|
-
|
|
3
|
-
[build-system]
|
|
4
|
-
requires = ['setuptools>=61.2.0', 'wheel']
|
|
5
|
-
build-backend = 'setuptools.build_meta'
|
|
6
|
-
|
|
7
|
-
[project]
|
|
8
|
-
name = 'nxs-analysis-tools'
|
|
9
|
-
version = '0.0.
|
|
10
|
-
description = 'Reduce and transform nexus format (.nxs) scattering data.'
|
|
11
|
-
readme = 'README.md'
|
|
12
|
-
requires-python = '>=3.7'
|
|
13
|
-
license = { file = 'LICENSE' }
|
|
14
|
-
authors = [{ name = 'Steven J. Gomez Alvarado', email = 'stevenjgomez@ucsb.edu' }]
|
|
15
|
-
|
|
16
|
-
keywords = [
|
|
17
|
-
'diffraction',
|
|
18
|
-
'xrd',
|
|
19
|
-
'nexusformat',
|
|
20
|
-
'nexus',
|
|
21
|
-
'nxs',
|
|
22
|
-
'scattering',
|
|
23
|
-
]
|
|
24
|
-
classifiers = [
|
|
25
|
-
'Development Status :: 1 - Planning',
|
|
26
|
-
'Intended Audience :: Science/Research',
|
|
27
|
-
'License :: OSI Approved :: MIT License',
|
|
28
|
-
'Programming Language :: Python',
|
|
29
|
-
'Programming Language :: Python :: 3',
|
|
30
|
-
'Programming Language :: Python :: 3.9',
|
|
31
|
-
'Programming Language :: Python :: 3.10',
|
|
32
|
-
'Topic :: Scientific/Engineering :: Image Processing',
|
|
33
|
-
'Topic :: Scientific/Engineering',
|
|
34
|
-
]
|
|
35
|
-
dependencies = [
|
|
36
|
-
'matplotlib>=3.7.1',
|
|
37
|
-
'numpy>=1.24.3',
|
|
38
|
-
'ipython>=1.0.0',
|
|
39
|
-
'pandas>=2.0.2',
|
|
40
|
-
'nexusformat>=1.0.1',
|
|
41
|
-
'lmfit>=1.2.1',
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
[project.optional-dependencies]
|
|
45
|
-
dev = [
|
|
46
|
-
'build >= 0.8.0',
|
|
47
|
-
'furo >= 2022.6.21',
|
|
48
|
-
'ipykernel >= 6.9.1',
|
|
49
|
-
'myst-nb >= 0.16.0',
|
|
50
|
-
'myst-parser >= 0.18.0',
|
|
51
|
-
'numpydoc >= 1.4.0',
|
|
52
|
-
'pandoc >= 2.2',
|
|
53
|
-
'pylint >= 2.12.2',
|
|
54
|
-
'pytest >= 7.1.2',
|
|
55
|
-
'sphinx >= 5.0.2',
|
|
56
|
-
'sphinx-autobuild >= 2021.3.14',
|
|
57
|
-
'sphinx-copybutton >= 0.5.0',
|
|
58
|
-
'sphinxext-opengraph >= 0.6.3',
|
|
59
|
-
'twine >= 4.0.1',
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
[project.urls]
|
|
63
|
-
'Download' = 'https://pypi.org/project/nxs-analysis-tools/'
|
|
64
|
-
'Bug Tracker' = 'https://github.com/stevenjgomez/nxs_analysis_tools/issues'
|
|
65
|
-
'Documentation' = 'https://nxs-analysis-tools.readthedocs.io/en/stable/'
|
|
66
|
-
'Source Code' = 'https://github.com/stevenjgomez/nxs_analysis_tools'
|
|
1
|
+
# keep consistent with _meta/__init__.py
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ['setuptools>=61.2.0', 'wheel']
|
|
5
|
+
build-backend = 'setuptools.build_meta'
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = 'nxs-analysis-tools'
|
|
9
|
+
version = '0.0.35'
|
|
10
|
+
description = 'Reduce and transform nexus format (.nxs) scattering data.'
|
|
11
|
+
readme = 'README.md'
|
|
12
|
+
requires-python = '>=3.7'
|
|
13
|
+
license = { file = 'LICENSE' }
|
|
14
|
+
authors = [{ name = 'Steven J. Gomez Alvarado', email = 'stevenjgomez@ucsb.edu' }]
|
|
15
|
+
|
|
16
|
+
keywords = [
|
|
17
|
+
'diffraction',
|
|
18
|
+
'xrd',
|
|
19
|
+
'nexusformat',
|
|
20
|
+
'nexus',
|
|
21
|
+
'nxs',
|
|
22
|
+
'scattering',
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
'Development Status :: 1 - Planning',
|
|
26
|
+
'Intended Audience :: Science/Research',
|
|
27
|
+
'License :: OSI Approved :: MIT License',
|
|
28
|
+
'Programming Language :: Python',
|
|
29
|
+
'Programming Language :: Python :: 3',
|
|
30
|
+
'Programming Language :: Python :: 3.9',
|
|
31
|
+
'Programming Language :: Python :: 3.10',
|
|
32
|
+
'Topic :: Scientific/Engineering :: Image Processing',
|
|
33
|
+
'Topic :: Scientific/Engineering',
|
|
34
|
+
]
|
|
35
|
+
dependencies = [
|
|
36
|
+
'matplotlib>=3.7.1',
|
|
37
|
+
'numpy>=1.24.3',
|
|
38
|
+
'ipython>=1.0.0',
|
|
39
|
+
'pandas>=2.0.2',
|
|
40
|
+
'nexusformat>=1.0.1',
|
|
41
|
+
'lmfit>=1.2.1',
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
dev = [
|
|
46
|
+
'build >= 0.8.0',
|
|
47
|
+
'furo >= 2022.6.21',
|
|
48
|
+
'ipykernel >= 6.9.1',
|
|
49
|
+
'myst-nb >= 0.16.0',
|
|
50
|
+
'myst-parser >= 0.18.0',
|
|
51
|
+
'numpydoc >= 1.4.0',
|
|
52
|
+
'pandoc >= 2.2',
|
|
53
|
+
'pylint >= 2.12.2',
|
|
54
|
+
'pytest >= 7.1.2',
|
|
55
|
+
'sphinx >= 5.0.2',
|
|
56
|
+
'sphinx-autobuild >= 2021.3.14',
|
|
57
|
+
'sphinx-copybutton >= 0.5.0',
|
|
58
|
+
'sphinxext-opengraph >= 0.6.3',
|
|
59
|
+
'twine >= 4.0.1',
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[project.urls]
|
|
63
|
+
'Download' = 'https://pypi.org/project/nxs-analysis-tools/'
|
|
64
|
+
'Bug Tracker' = 'https://github.com/stevenjgomez/nxs_analysis_tools/issues'
|
|
65
|
+
'Documentation' = 'https://nxs-analysis-tools.readthedocs.io/en/stable/'
|
|
66
|
+
'Source Code' = 'https://github.com/stevenjgomez/nxs_analysis_tools'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'''This file is included as a workaround for a limitation in Setuptools support for PEP 660.'''
|
|
2
|
-
|
|
3
|
-
from setuptools import setup
|
|
4
|
-
|
|
1
|
+
'''This file is included as a workaround for a limitation in Setuptools support for PEP 660.'''
|
|
2
|
+
|
|
3
|
+
from setuptools import setup
|
|
4
|
+
|
|
5
5
|
setup()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'''nxs-analysis-tools package metadata.'''
|
|
2
|
-
|
|
3
|
-
# keep consistent with pyproject.toml
|
|
4
|
-
__project__ = 'nxs-analysis-tools'
|
|
5
|
-
__author__ = 'Steven J. Gomez Alvarado'
|
|
6
|
-
__email__ = 'stevenjgomez@ucsb.edu'
|
|
7
|
-
__copyright__ = f"2023, {__author__}"
|
|
8
|
-
__license__ = 'MIT'
|
|
9
|
-
__version__= '0.0.
|
|
10
|
-
__repo_url__ = 'https://github.com/stevenjgomez/nxs_analysis_tools'
|
|
1
|
+
'''nxs-analysis-tools package metadata.'''
|
|
2
|
+
|
|
3
|
+
# keep consistent with pyproject.toml
|
|
4
|
+
__project__ = 'nxs-analysis-tools'
|
|
5
|
+
__author__ = 'Steven J. Gomez Alvarado'
|
|
6
|
+
__email__ = 'stevenjgomez@ucsb.edu'
|
|
7
|
+
__copyright__ = f"2023, {__author__}"
|
|
8
|
+
__license__ = 'MIT'
|
|
9
|
+
__version__= '0.0.35'
|
|
10
|
+
__repo_url__ = 'https://github.com/stevenjgomez/nxs_analysis_tools'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
'''
|
|
2
|
-
Reduce and transform nexus format (.nxs) scattering data.
|
|
3
|
-
'''
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
from _meta import __author__, __copyright__, __license__, __version__
|
|
7
|
-
from .datareduction import load_data, load_transform, plot_slice, reciprocal_lattice_params, Scissors, rotate_data
|
|
8
|
-
from .chess import TempDependence
|
|
9
|
-
|
|
10
|
-
# What to import when running "from nxs_analysis_tools import *"
|
|
11
|
-
__all__ = ['load_data', 'load_transform', 'plot_slice', 'Scissors', 'TempDependence',
|
|
12
|
-
'reciprocal_lattice_params', 'rotate_data']
|
|
1
|
+
'''
|
|
2
|
+
Reduce and transform nexus format (.nxs) scattering data.
|
|
3
|
+
'''
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from _meta import __author__, __copyright__, __license__, __version__
|
|
7
|
+
from .datareduction import load_data, load_transform, plot_slice, reciprocal_lattice_params, Scissors, rotate_data
|
|
8
|
+
from .chess import TempDependence
|
|
9
|
+
|
|
10
|
+
# What to import when running "from nxs_analysis_tools import *"
|
|
11
|
+
__all__ = ['load_data', 'load_transform', 'plot_slice', 'Scissors', 'TempDependence',
|
|
12
|
+
'reciprocal_lattice_params', 'rotate_data']
|
|
@@ -75,6 +75,11 @@ class TempDependence:
|
|
|
75
75
|
# Initialize linecutmodel object at each temperature
|
|
76
76
|
self.linecutmodels[temperature] = LinecutModel()
|
|
77
77
|
|
|
78
|
+
# Convert to int temporarily to sort temperatures list
|
|
79
|
+
self.temperatures = [int(t) for t in self.temperatures]
|
|
80
|
+
self.temperatures.sort()
|
|
81
|
+
self.temperatures = [str(t) for t in self.temperatures]
|
|
82
|
+
|
|
78
83
|
def load_datasets(self, file_ending='hkli.nxs', temperatures_list=None):
|
|
79
84
|
"""
|
|
80
85
|
Load scattering datasets from the specified folder.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import matplotlib.pyplot as plt
|
|
2
|
-
from nxs_analysis_tools import TempDependence
|
|
3
|
-
|
|
4
|
-
sample = TempDependence()
|
|
5
|
-
|
|
6
|
-
sample.load_datasets(folder='../docs/source/examples/example_data/sample_name')
|
|
7
|
-
|
|
8
|
-
print(sample.datasets)
|
|
9
|
-
|
|
10
|
-
print(sample.datasets['15'])
|
|
11
|
-
|
|
12
|
-
sample.datasets['15'][:,:,0.0].plot()
|
|
13
|
-
|
|
14
|
-
sample.cut_data(center=(0,0,0), window=(0.1,1,0.1))
|
|
15
|
-
|
|
1
|
+
import matplotlib.pyplot as plt
|
|
2
|
+
from nxs_analysis_tools import TempDependence
|
|
3
|
+
|
|
4
|
+
sample = TempDependence()
|
|
5
|
+
|
|
6
|
+
sample.load_datasets(folder='../docs/source/examples/example_data/sample_name')
|
|
7
|
+
|
|
8
|
+
print(sample.datasets)
|
|
9
|
+
|
|
10
|
+
print(sample.datasets['15'])
|
|
11
|
+
|
|
12
|
+
sample.datasets['15'][:,:,0.0].plot()
|
|
13
|
+
|
|
14
|
+
sample.cut_data(center=(0,0,0), window=(0.1,1,0.1))
|
|
15
|
+
|
|
16
16
|
sample.plot_linecuts()
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
-
from datareduction import load_data, Scissors
|
|
4
|
-
from chess import *
|
|
5
|
-
from fitting import *
|
|
6
|
-
|
|
7
|
-
from lmfit.models import GaussianModel, LinearModel, LorentzianModel
|
|
8
|
-
|
|
9
|
-
sample = TempDependence()
|
|
10
|
-
sample.load_datasets(folder=r'K:\pokharel-3470-a\PrCd3P3\BRO7')
|
|
11
|
-
sample.cut_data(center=(0.5,-3,0), window=(0.1,0.3,0.1))
|
|
12
|
-
|
|
13
|
-
sample.set_model_components([GaussianModel(prefix='peak'), LorentzianModel(prefix='diffuse'), LinearModel(prefix='background')])
|
|
14
|
-
sample.set_param_hint('peakcenter', min=-0.1, max=0.1)
|
|
15
|
-
sample.make_params()
|
|
16
|
-
sample.guess()
|
|
17
|
-
sample.print_initial_params()
|
|
18
|
-
sample.plot_initial_guess()
|
|
19
|
-
sample.fit()
|
|
20
|
-
sample.plot_fit()
|
|
1
|
+
import sys
|
|
2
|
+
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
+
from datareduction import load_data, Scissors
|
|
4
|
+
from chess import *
|
|
5
|
+
from fitting import *
|
|
6
|
+
|
|
7
|
+
from lmfit.models import GaussianModel, LinearModel, LorentzianModel
|
|
8
|
+
|
|
9
|
+
sample = TempDependence()
|
|
10
|
+
sample.load_datasets(folder=r'K:\pokharel-3470-a\PrCd3P3\BRO7')
|
|
11
|
+
sample.cut_data(center=(0.5,-3,0), window=(0.1,0.3,0.1))
|
|
12
|
+
|
|
13
|
+
sample.set_model_components([GaussianModel(prefix='peak'), LorentzianModel(prefix='diffuse'), LinearModel(prefix='background')])
|
|
14
|
+
sample.set_param_hint('peakcenter', min=-0.1, max=0.1)
|
|
15
|
+
sample.make_params()
|
|
16
|
+
sample.guess()
|
|
17
|
+
sample.print_initial_params()
|
|
18
|
+
sample.plot_initial_guess()
|
|
19
|
+
sample.fit()
|
|
20
|
+
sample.plot_fit()
|
|
21
21
|
sample.print_fit_report()
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
-
from datareduction import load_data, Scissors, rotate_data, plot_slice
|
|
4
|
-
|
|
5
|
-
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
6
|
-
# scissors = Scissors(data, center=(0,0,0), window=(0.1,2,0.3))
|
|
7
|
-
# scissors.cut_data()
|
|
8
|
-
# print(scissors.integration_window)
|
|
9
|
-
# scissors.plot_integration_window()
|
|
10
|
-
# scissors.linecut.plot()
|
|
11
|
-
# scissors.highlight_integration_window()
|
|
12
|
-
|
|
13
|
-
import matplotlib.pyplot as plt
|
|
14
|
-
|
|
15
|
-
plot_slice(data[:, :, 0.0])
|
|
16
|
-
plt.show()
|
|
17
|
-
rotated_data = rotate_data(data=data, lattice_angle=90, rotation_angle=45, rotation_axis=2, printout=True)
|
|
18
|
-
plot_slice(rotated_data[:, :, 0.0])
|
|
19
|
-
plt.show()
|
|
1
|
+
import sys
|
|
2
|
+
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
+
from datareduction import load_data, Scissors, rotate_data, plot_slice
|
|
4
|
+
|
|
5
|
+
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
6
|
+
# scissors = Scissors(data, center=(0,0,0), window=(0.1,2,0.3))
|
|
7
|
+
# scissors.cut_data()
|
|
8
|
+
# print(scissors.integration_window)
|
|
9
|
+
# scissors.plot_integration_window()
|
|
10
|
+
# scissors.linecut.plot()
|
|
11
|
+
# scissors.highlight_integration_window()
|
|
12
|
+
|
|
13
|
+
import matplotlib.pyplot as plt
|
|
14
|
+
|
|
15
|
+
plot_slice(data[:, :, 0.0])
|
|
16
|
+
plt.show()
|
|
17
|
+
rotated_data = rotate_data(data=data, lattice_angle=90, rotation_angle=45, rotation_axis=2, printout=True)
|
|
18
|
+
plot_slice(rotated_data[:, :, 0.0])
|
|
19
|
+
plt.show()
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
-
from fitting import LinecutModel
|
|
4
|
-
|
|
5
|
-
from nxs_analysis_tools.datareduction import load_data, Scissors
|
|
6
|
-
from lmfit.models import GaussianModel, LinearModel
|
|
7
|
-
|
|
8
|
-
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
9
|
-
|
|
10
|
-
s = Scissors(data=data)
|
|
11
|
-
|
|
12
|
-
linecut = s.cut_data(center=(0,0,0), window=(0.1,0.5,0.1))
|
|
13
|
-
|
|
14
|
-
lm = LinecutModel(data=linecut)
|
|
15
|
-
|
|
16
|
-
lm.set_model_components([GaussianModel(prefix='peak'), LinearModel(prefix='background')])
|
|
17
|
-
|
|
18
|
-
lm.set_param_hint('peakcenter', min=-0.1, max=0.1)
|
|
19
|
-
|
|
20
|
-
lm.make_params()
|
|
21
|
-
|
|
22
|
-
lm.guess()
|
|
23
|
-
|
|
24
|
-
lm.print_initial_params()
|
|
25
|
-
|
|
26
|
-
lm.params
|
|
27
|
-
|
|
1
|
+
import sys
|
|
2
|
+
sys.path.append('../src/nxs_analysis_tools/')
|
|
3
|
+
from fitting import LinecutModel
|
|
4
|
+
|
|
5
|
+
from nxs_analysis_tools.datareduction import load_data, Scissors
|
|
6
|
+
from lmfit.models import GaussianModel, LinearModel
|
|
7
|
+
|
|
8
|
+
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
9
|
+
|
|
10
|
+
s = Scissors(data=data)
|
|
11
|
+
|
|
12
|
+
linecut = s.cut_data(center=(0,0,0), window=(0.1,0.5,0.1))
|
|
13
|
+
|
|
14
|
+
lm = LinecutModel(data=linecut)
|
|
15
|
+
|
|
16
|
+
lm.set_model_components([GaussianModel(prefix='peak'), LinearModel(prefix='background')])
|
|
17
|
+
|
|
18
|
+
lm.set_param_hint('peakcenter', min=-0.1, max=0.1)
|
|
19
|
+
|
|
20
|
+
lm.make_params()
|
|
21
|
+
|
|
22
|
+
lm.guess()
|
|
23
|
+
|
|
24
|
+
lm.print_initial_params()
|
|
25
|
+
|
|
26
|
+
lm.params
|
|
27
|
+
|
|
28
28
|
lm.plot_initial_guess()
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
sys.path.append('../src/nxs_analysis_tools/')
|
|
4
|
-
from datareduction import load_data, Scissors
|
|
5
|
-
# from fitting import *
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
from test_lmfit.models import GaussianModel
|
|
9
|
-
from test_lmfit.models import PseudoVoigtModel
|
|
10
|
-
from test_lmfit.models import LorentzianModel
|
|
11
|
-
from test_lmfit.models import LinearModel
|
|
12
|
-
from test_lmfit.model import CompositeModel
|
|
13
|
-
import operator
|
|
14
|
-
import matplotlib.pyplot as plt
|
|
15
|
-
import numpy as np
|
|
16
|
-
|
|
17
|
-
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
18
|
-
s = Scissors(data=data, center=(0, 0, 0), window=(0.1, 0.1, 0.5))
|
|
19
|
-
s.cut_data()
|
|
20
|
-
|
|
21
|
-
x = s.linecut[s.linecut.axes[0]].nxdata
|
|
22
|
-
y = s.linecut[s.linecut.signal].nxdata
|
|
23
|
-
|
|
24
|
-
# Create model components
|
|
25
|
-
model_components = [
|
|
26
|
-
GaussianModel(prefix='peak'),
|
|
27
|
-
LinearModel(prefix='background')
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
# Create composite model (in function)
|
|
31
|
-
model = CompositeModel(*model_components, operator.add)
|
|
32
|
-
|
|
33
|
-
# Intialize empty parameters (in function)
|
|
34
|
-
params = model.make_params()
|
|
35
|
-
fwhm_params = {key:value for key,value in params.items() if 'fwhm' in key}
|
|
36
|
-
for key,value in fwhm_params.items():
|
|
37
|
-
pi_str = str(np.pi)
|
|
38
|
-
params.add(key.replace('fwhm','corrlength'), expr='(2 * ' + pi_str + ') / ' + key)
|
|
39
|
-
|
|
40
|
-
# Perform initial guesses for each model component (in function)
|
|
41
|
-
for model_component in model_components:
|
|
42
|
-
params.update(model_component.guess(y, x=x))
|
|
43
|
-
|
|
44
|
-
# Show initial guesses (in function)
|
|
45
|
-
for param, hint in model.param_hints.items():
|
|
46
|
-
print(f'{param}')
|
|
47
|
-
for key, value in hint.items():
|
|
48
|
-
print(f'\t{key}: {value}')
|
|
49
|
-
|
|
50
|
-
# Plot initial guess (in function)
|
|
51
|
-
y_init_fit = model.eval(params=params, x=x)
|
|
52
|
-
plt.plot(x, y_init_fit, '--', label='guess')
|
|
53
|
-
plt.plot(x, y, 'o', label='data')
|
|
54
|
-
plt.legend()
|
|
55
|
-
plt.show()
|
|
56
|
-
|
|
57
|
-
# Perform fit (in function)
|
|
58
|
-
model_result = model.fit(y, params, x=x)
|
|
59
|
-
# # Determine correlation lengths after fitting
|
|
60
|
-
# fwhm_params = {key:value for key,value in model_result.params.items() if 'fwhm' in key}
|
|
61
|
-
# for key,value in fwhm_params.items():
|
|
62
|
-
# corrlength = correlation_length = (2 * np.pi) / value
|
|
63
|
-
# new_key = key.replace('fwhm','corrlength')
|
|
64
|
-
# model_result.params.add(new_key, value=corrlength)
|
|
65
|
-
|
|
66
|
-
x_fit = x
|
|
67
|
-
# x_fit = np.linspace(x.min(), x.max(), num_points)
|
|
68
|
-
y_fit = model_result.eval(x=x_fit)
|
|
69
|
-
y_fit_components = model_result.eval_components(x=x_fit)
|
|
70
|
-
|
|
71
|
-
# Plot fit with **kwargs (in function)
|
|
72
|
-
model_result.plot(show_init=True)
|
|
73
|
-
plt.show()
|
|
74
|
-
|
|
75
|
-
# Show fit report
|
|
76
|
-
print(model_result.fit_report())
|
|
77
|
-
|
|
78
|
-
# # Calculate correlation length (can be done from expr in lmfit)
|
|
79
|
-
# fwhm_entries = {key: value for key, value in model_result.values.items() if 'fwhm' in key}
|
|
80
|
-
# correlation_lengths = {}
|
|
81
|
-
# for key, fwhm in fwhm_entries.items():
|
|
82
|
-
# correlation_length = (2 * np.pi) / fwhm
|
|
83
|
-
# new_key = key.replace('fwhm', 'correlationlength')
|
|
84
|
-
# correlation_lengths[new_key] = correlation_length
|
|
85
|
-
#
|
|
86
|
-
# fwhm_errors = {key: param.stderr for key, param in model_result.params.items() if 'fwhm' in key}
|
|
87
|
-
# correlation_length_errors = {}
|
|
88
|
-
# for key, error in fwhm_errors.items():
|
|
89
|
-
# new_key = key.replace('fwhm', 'correlationlength')
|
|
90
|
-
# correlation_length_errors[new_key] = ((2 * np.pi) / fwhm_entries[key] ** 2) * error if error is not None else None
|
|
91
|
-
#
|
|
92
|
-
# print('[[Correlation Lengths]]')
|
|
93
|
-
# for key in correlation_lengths.keys():
|
|
94
|
-
# print(f'\t{key}: {correlation_lengths[key]} +/- {correlation_length_errors[key]} ' +
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
sys.path.append('../src/nxs_analysis_tools/')
|
|
4
|
+
from datareduction import load_data, Scissors
|
|
5
|
+
# from fitting import *
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from test_lmfit.models import GaussianModel
|
|
9
|
+
from test_lmfit.models import PseudoVoigtModel
|
|
10
|
+
from test_lmfit.models import LorentzianModel
|
|
11
|
+
from test_lmfit.models import LinearModel
|
|
12
|
+
from test_lmfit.model import CompositeModel
|
|
13
|
+
import operator
|
|
14
|
+
import matplotlib.pyplot as plt
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
17
|
+
data = load_data('../docs/source/examples/example_data/sample_name/15/example_hkli.nxs')
|
|
18
|
+
s = Scissors(data=data, center=(0, 0, 0), window=(0.1, 0.1, 0.5))
|
|
19
|
+
s.cut_data()
|
|
20
|
+
|
|
21
|
+
x = s.linecut[s.linecut.axes[0]].nxdata
|
|
22
|
+
y = s.linecut[s.linecut.signal].nxdata
|
|
23
|
+
|
|
24
|
+
# Create model components
|
|
25
|
+
model_components = [
|
|
26
|
+
GaussianModel(prefix='peak'),
|
|
27
|
+
LinearModel(prefix='background')
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
# Create composite model (in function)
|
|
31
|
+
model = CompositeModel(*model_components, operator.add)
|
|
32
|
+
|
|
33
|
+
# Intialize empty parameters (in function)
|
|
34
|
+
params = model.make_params()
|
|
35
|
+
fwhm_params = {key:value for key,value in params.items() if 'fwhm' in key}
|
|
36
|
+
for key,value in fwhm_params.items():
|
|
37
|
+
pi_str = str(np.pi)
|
|
38
|
+
params.add(key.replace('fwhm','corrlength'), expr='(2 * ' + pi_str + ') / ' + key)
|
|
39
|
+
|
|
40
|
+
# Perform initial guesses for each model component (in function)
|
|
41
|
+
for model_component in model_components:
|
|
42
|
+
params.update(model_component.guess(y, x=x))
|
|
43
|
+
|
|
44
|
+
# Show initial guesses (in function)
|
|
45
|
+
for param, hint in model.param_hints.items():
|
|
46
|
+
print(f'{param}')
|
|
47
|
+
for key, value in hint.items():
|
|
48
|
+
print(f'\t{key}: {value}')
|
|
49
|
+
|
|
50
|
+
# Plot initial guess (in function)
|
|
51
|
+
y_init_fit = model.eval(params=params, x=x)
|
|
52
|
+
plt.plot(x, y_init_fit, '--', label='guess')
|
|
53
|
+
plt.plot(x, y, 'o', label='data')
|
|
54
|
+
plt.legend()
|
|
55
|
+
plt.show()
|
|
56
|
+
|
|
57
|
+
# Perform fit (in function)
|
|
58
|
+
model_result = model.fit(y, params, x=x)
|
|
59
|
+
# # Determine correlation lengths after fitting
|
|
60
|
+
# fwhm_params = {key:value for key,value in model_result.params.items() if 'fwhm' in key}
|
|
61
|
+
# for key,value in fwhm_params.items():
|
|
62
|
+
# corrlength = correlation_length = (2 * np.pi) / value
|
|
63
|
+
# new_key = key.replace('fwhm','corrlength')
|
|
64
|
+
# model_result.params.add(new_key, value=corrlength)
|
|
65
|
+
|
|
66
|
+
x_fit = x
|
|
67
|
+
# x_fit = np.linspace(x.min(), x.max(), num_points)
|
|
68
|
+
y_fit = model_result.eval(x=x_fit)
|
|
69
|
+
y_fit_components = model_result.eval_components(x=x_fit)
|
|
70
|
+
|
|
71
|
+
# Plot fit with **kwargs (in function)
|
|
72
|
+
model_result.plot(show_init=True)
|
|
73
|
+
plt.show()
|
|
74
|
+
|
|
75
|
+
# Show fit report
|
|
76
|
+
print(model_result.fit_report())
|
|
77
|
+
|
|
78
|
+
# # Calculate correlation length (can be done from expr in lmfit)
|
|
79
|
+
# fwhm_entries = {key: value for key, value in model_result.values.items() if 'fwhm' in key}
|
|
80
|
+
# correlation_lengths = {}
|
|
81
|
+
# for key, fwhm in fwhm_entries.items():
|
|
82
|
+
# correlation_length = (2 * np.pi) / fwhm
|
|
83
|
+
# new_key = key.replace('fwhm', 'correlationlength')
|
|
84
|
+
# correlation_lengths[new_key] = correlation_length
|
|
85
|
+
#
|
|
86
|
+
# fwhm_errors = {key: param.stderr for key, param in model_result.params.items() if 'fwhm' in key}
|
|
87
|
+
# correlation_length_errors = {}
|
|
88
|
+
# for key, error in fwhm_errors.items():
|
|
89
|
+
# new_key = key.replace('fwhm', 'correlationlength')
|
|
90
|
+
# correlation_length_errors[new_key] = ((2 * np.pi) / fwhm_entries[key] ** 2) * error if error is not None else None
|
|
91
|
+
#
|
|
92
|
+
# print('[[Correlation Lengths]]')
|
|
93
|
+
# for key in correlation_lengths.keys():
|
|
94
|
+
# print(f'\t{key}: {correlation_lengths[key]} +/- {correlation_length_errors[key]} ' +
|
|
95
95
|
# f'({correlation_length_errors[key] / correlation_lengths[key] * 100:.2f}%)')
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
from nxs_analysis_tools.datareduction import load_data
|
|
2
|
-
from nxs_analysis_tools.pairdistribution import *
|
|
3
|
-
import matplotlib.pyplot as plt
|
|
4
|
-
|
|
5
|
-
data = load_data('../docs/source/examples/example_data/pairdistribution_data/test_hkli.nxs')
|
|
6
|
-
# s = Symmetrizer3D(data)
|
|
7
|
-
|
|
8
|
-
# s.plane1symmetrizer.set_parameters(theta_min=0, theta_max=90, mirror=True)
|
|
9
|
-
# s.plane1symmetrizer.test(data[:,:,len(data.L)//2])
|
|
10
|
-
#
|
|
11
|
-
# s.plane2symmetrizer.set_parameters(theta_min=45, theta_max=90, mirror=True)
|
|
12
|
-
# s.plane2symmetrizer.test(data[:,len(data.K)//2,:])
|
|
13
|
-
#
|
|
14
|
-
# s.plane3symmetrizer.set_parameters(theta_min=0, theta_max=90, mirror=False)
|
|
15
|
-
# s.plane3symmetrizer.test(data[len(data.H)//2,:,:])
|
|
16
|
-
#
|
|
17
|
-
# s.symmetrize()
|
|
18
|
-
|
|
19
|
-
p = Puncher()
|
|
20
|
-
p.set_data(data)
|
|
21
|
-
p.set_lattice_params((1,1,1,90,90,90))
|
|
22
|
-
bm = p.generate_bragg_mask(punch_radius=0.25)
|
|
23
|
-
p.add_mask(bm)
|
|
24
|
-
p.punch()
|
|
25
|
-
plot_slice(p.punched[:,:,0.0])
|
|
26
|
-
plt.show()
|
|
27
|
-
|
|
28
|
-
m = p.generate_mask_at_coord(coordinate=(0.33, 0.33, 0.0), punch_radius=0.25)
|
|
29
|
-
p.add_mask(m)
|
|
30
|
-
p.punch()
|
|
31
|
-
plot_slice(p.punched[:,:,0.0])
|
|
32
|
-
plt.show()
|
|
33
|
-
|
|
34
|
-
m = p.generate_mask_at_coord(coordinate=(-0.1, -0.1, 0.0), punch_radius=0.2)
|
|
35
|
-
p.subtract_mask(m)
|
|
36
|
-
p.punch()
|
|
37
|
-
plot_slice(p.punched[:,:,0.0])
|
|
38
|
-
plt.show()
|
|
39
|
-
|
|
1
|
+
from nxs_analysis_tools.datareduction import load_data
|
|
2
|
+
from nxs_analysis_tools.pairdistribution import *
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
|
|
5
|
+
data = load_data('../docs/source/examples/example_data/pairdistribution_data/test_hkli.nxs')
|
|
6
|
+
# s = Symmetrizer3D(data)
|
|
7
|
+
|
|
8
|
+
# s.plane1symmetrizer.set_parameters(theta_min=0, theta_max=90, mirror=True)
|
|
9
|
+
# s.plane1symmetrizer.test(data[:,:,len(data.L)//2])
|
|
10
|
+
#
|
|
11
|
+
# s.plane2symmetrizer.set_parameters(theta_min=45, theta_max=90, mirror=True)
|
|
12
|
+
# s.plane2symmetrizer.test(data[:,len(data.K)//2,:])
|
|
13
|
+
#
|
|
14
|
+
# s.plane3symmetrizer.set_parameters(theta_min=0, theta_max=90, mirror=False)
|
|
15
|
+
# s.plane3symmetrizer.test(data[len(data.H)//2,:,:])
|
|
16
|
+
#
|
|
17
|
+
# s.symmetrize()
|
|
18
|
+
|
|
19
|
+
p = Puncher()
|
|
20
|
+
p.set_data(data)
|
|
21
|
+
p.set_lattice_params((1,1,1,90,90,90))
|
|
22
|
+
bm = p.generate_bragg_mask(punch_radius=0.25)
|
|
23
|
+
p.add_mask(bm)
|
|
24
|
+
p.punch()
|
|
25
|
+
plot_slice(p.punched[:,:,0.0])
|
|
26
|
+
plt.show()
|
|
27
|
+
|
|
28
|
+
m = p.generate_mask_at_coord(coordinate=(0.33, 0.33, 0.0), punch_radius=0.25)
|
|
29
|
+
p.add_mask(m)
|
|
30
|
+
p.punch()
|
|
31
|
+
plot_slice(p.punched[:,:,0.0])
|
|
32
|
+
plt.show()
|
|
33
|
+
|
|
34
|
+
m = p.generate_mask_at_coord(coordinate=(-0.1, -0.1, 0.0), punch_radius=0.2)
|
|
35
|
+
p.subtract_mask(m)
|
|
36
|
+
p.punch()
|
|
37
|
+
plot_slice(p.punched[:,:,0.0])
|
|
38
|
+
plt.show()
|
|
39
|
+
|
|
40
40
|
# SUCCESS
|
|
File without changes
|
{nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/datareduction.py
RENAMED
|
File without changes
|
|
File without changes
|
{nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools/pairdistribution.py
RENAMED
|
File without changes
|
{nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{nxs_analysis_tools-0.0.33 → nxs_analysis_tools-0.0.35}/src/nxs_analysis_tools.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|