xraydc 0.0.0__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.
@@ -0,0 +1,9 @@
1
+ *~
2
+ \#*
3
+ .\#*
4
+ __pycache__
5
+ dist/
6
+ *.egg-info
7
+ _version.py
8
+ .ipynb_checkpoints
9
+ *.orig
@@ -0,0 +1,106 @@
1
+ default:
2
+ image:
3
+ name: python:latest
4
+
5
+ variables:
6
+ PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
7
+ PYPI_RELEASE_URL: https://test.pypi.org/legacy/
8
+
9
+ cache:
10
+ paths:
11
+ - .cache/pip
12
+ - venv/
13
+
14
+ stages:
15
+ - test
16
+ - build
17
+ - release
18
+
19
+ testing:
20
+ stage: test
21
+ script:
22
+ - python --version
23
+ - pip install virtualenv
24
+ - virtualenv venv
25
+ - source venv/bin/activate
26
+ - pip install -e ".[test]"
27
+ - coverage run -m --source nx5d pytest
28
+ - coverage report
29
+ - coverage xml
30
+ coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
31
+ artifacts:
32
+ reports:
33
+ coverage_report:
34
+ coverage_format: cobertura
35
+ path: coverage.xml
36
+
37
+ packaging:
38
+ stage: build
39
+ script:
40
+ - python --version
41
+ - pip install virtualenv
42
+ - virtualenv venv
43
+ - source venv/bin/activate
44
+ - export PACK_VERSION=`echo $CI_COMMIT_TAG | sed -n /v[0-9].*/p | cut -b 2-`
45
+ - echo "Packaging Version $PACK_VERSION"
46
+ - pip install --upgrade build
47
+ - python3 -m build
48
+ - pip install --upgrade twine
49
+ - twine check dist/*
50
+ - pip install dist/*.whl
51
+ artifacts:
52
+ paths:
53
+ - dist/*
54
+
55
+ analysis:
56
+ stage: test
57
+ allow_failure: true
58
+ script:
59
+ - python --version
60
+ - pip install virtualenv
61
+ - virtualenv venv
62
+ - source venv/bin/activate
63
+ - pip install --upgrade pylint-gitlab
64
+ - pip install --upgrade anybadge
65
+ - mkdir -p public/badges public/lint
66
+ - echo undefined > public/badges/"$CI_JOB_NAME".score
67
+ - pylint --exit-zero --output-format=text $(find -type f -name "*.py" ! -path "**/venv/**") | tee /tmp/pylint.txt
68
+ - sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/"$CI_JOB_NAME".score
69
+ - pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $(find -type f -name "*.py" ! -path "**/venv/**") > codeclimate.json
70
+ - pylint --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $(find -type f -name "*.py" ! -path "**/venv/**") > public/lint/index.html
71
+ after_script:
72
+ - anybadge --overwrite --label "$CI_JOB_NAME" --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange 8=yellow 10=green
73
+ - |
74
+ echo "Your score is: $(cat public/badges/$CI_JOB_NAME.score)"
75
+ artifacts:
76
+ paths:
77
+ - public
78
+ reports:
79
+ codequality: codeclimate.json
80
+ when: always
81
+
82
+ pypi upload:
83
+ stage: release
84
+ rules:
85
+ - if: $CI_COMMIT_TAG =~ "/^v[0-9].*/"
86
+ script:
87
+ - python --version
88
+ - pip install virtualenv
89
+ - virtualenv venv
90
+ - source venv/bin/activate
91
+ - pip install --upgrade twine
92
+ - export TWINE_USERNAME=__token__
93
+ - export TWINE_PASSWORD="$PYPI_RELEASE_TOKEN"
94
+ - python -m twine upload --repository-url "${PYPI_RELEASE_URL}" dist/*
95
+
96
+ gitlab release:
97
+ stage: release
98
+ image: registry.gitlab.com/gitlab-org/release-cli:latest
99
+ rules:
100
+ - if: $CI_COMMIT_TAG =~ "/^v[0-9].*/"
101
+ script:
102
+ - echo "Releasing:"
103
+ - ls dist/*
104
+ release:
105
+ tag_name: $CI_COMMIT_TAG
106
+ description: $CI_COMMIT_TAG
xraydc-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: xraydc
3
+ Version: 0.0.0
4
+ Summary: X-Ray Diffraction Cooking -- nx5d data processing recipes
5
+ Author-email: Matthias Rössle <matthias.roessle@helmholtz-berlin.de>, Florin Boariu <florin.pt@rootshell.ro>
6
+ Project-URL: Source Code, https://gitlab.com/kmc3-xpp/xraydc/
7
+ Project-URL: Bug Tracker, https://gitlab.com/kmc3-xpp/xraydc/
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: nx5d
18
+ Requires-Dist: xarray
19
+ Requires-Dist: scipy
20
+ Requires-Dist: dask
21
+ Requires-Dist: xrayutilities
22
+ Provides-Extra: all
23
+ Requires-Dist: xraydc[doc,test]; extra == "all"
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest; extra == "test"
26
+ Requires-Dist: pytest-cov; extra == "test"
27
+ Requires-Dist: tqdm; extra == "test"
28
+ Provides-Extra: doc
29
+ Requires-Dist: mkdocs; extra == "doc"
30
+ Requires-Dist: mkdocstrings[python]; extra == "doc"
xraydc-0.0.0/README.md ADDED
File without changes
@@ -0,0 +1,29 @@
1
+ docs_dir: mkdocs
2
+ site_name: nx5d
3
+ site_url: https://nx5d.readthedocs.io/
4
+
5
+ nav:
6
+ - Home: index.md
7
+ - A First Example: spice-example.ipynb
8
+ - Core Concepts: concepts.md
9
+ - User Guide: user-guide/index.md
10
+ - API Reference: api.md
11
+ - License: license.md
12
+
13
+ theme:
14
+ name: readthedocs
15
+ features:
16
+ - content.code.copy
17
+
18
+ plugins:
19
+ - mkdocstrings
20
+ - mkdocs-jupyter
21
+
22
+ markdown_extensions:
23
+ - pymdownx.highlight:
24
+ anchor_linenums: true
25
+ line_spans: __span
26
+ pygments_lang_class: true
27
+ - pymdownx.inlinehilite
28
+ - pymdownx.snippets
29
+ - pymdownx.superfences
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64.0", "setuptools_scm[toml]>=6.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xraydc"
7
+ authors = [
8
+ { name = "Matthias Rössle", email = "matthias.roessle@helmholtz-berlin.de" },
9
+ { name = "Florin Boariu", email = "florin.pt@rootshell.ro" },
10
+ ]
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
14
+ "Operating System :: POSIX :: Linux",
15
+ "Development Status :: 2 - Pre-Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Science/Research",
18
+ "Topic :: Scientific/Engineering"
19
+ ]
20
+ dependencies = [
21
+ "nx5d",
22
+ "xarray",
23
+ "scipy",
24
+ "dask",
25
+ "xrayutilities"
26
+ ]
27
+ dynamic = ["version"]
28
+ description = "X-Ray Diffraction Cooking -- nx5d data processing recipes"
29
+ readme = "README.md"
30
+ requires-python = ">=3.8"
31
+ keywords = []
32
+
33
+ [project.urls]
34
+ "Source Code" = "https://gitlab.com/kmc3-xpp/xraydc/"
35
+ "Bug Tracker" = "https://gitlab.com/kmc3-xpp/xraydc/"
36
+ #"Documentation" = "https://xraydc.readthedocs.io/"
37
+
38
+ [project.optional-dependencies]
39
+ all = [
40
+ "xraydc[test,doc]"
41
+ ]
42
+
43
+ test = [
44
+ "pytest",
45
+ "pytest-cov",
46
+ "tqdm",
47
+ ]
48
+
49
+ doc = [
50
+ "mkdocs",
51
+ "mkdocstrings[python]",
52
+ ]
53
+
54
+ [tool.pytest.ini_options]
55
+ minversion = "6.0"
56
+ addopts = "-ra -m 'not xfel'"
57
+ log_cli = true
58
+ testpaths = [
59
+ "tests",
60
+ ]
61
+ markers = [ ]
62
+
63
+ [tool.setuptools_scm]
64
+ write_to = "src/xraydc/_version.py"
65
+
66
+ [project.scripts]
xraydc-0.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.1.dev0+d20250925'
32
+ __version_tuple__ = version_tuple = (0, 1, 'dev0', 'd20250925')
33
+
34
+ __commit_id__ = commit_id = None
@@ -0,0 +1,89 @@
1
+ from kmc3recipe.signal import QMapper
2
+
3
+ all = [
4
+ "sRSM",
5
+ "TRSM",
6
+ "rocking",
7
+
8
+ #"xRSS",
9
+ #"tRSS",
10
+ ]
11
+
12
+ # Recipe map to use for easy seeding of all herein supported types.
13
+ RecipeMap = {
14
+ # static RSM
15
+ sRSM="pymod:///kmc3recipes.cooking#sRSM",
16
+
17
+ # temperature-dependent RSM
18
+ tRSM="pymod:///kmc3recipes.cooking#TRSM",
19
+
20
+ # omega-2theta-scan (treat like RSM?)
21
+ rocking="pymod:///kmc3recipes.cooking#sRSM",
22
+
23
+ # some kind (?) of RSS
24
+ xRSS=None,
25
+
26
+ # time-dependent (?) RSS
27
+ tRSS=None,
28
+ }
29
+
30
+ def _kmc3_recipe_helper_datamangle(data, **spice):
31
+ # Helper for KMC3 recipes: changes data (mostly by applying offsets)
32
+ # returns new dataset
33
+
34
+ data2 = data.copy()
35
+
36
+ if 'offsets' in spice:
37
+ for k, v in spice['offsets'].items():
38
+ data2[k] = data[k] + spice['offsets'][k]
39
+
40
+ return data2
41
+
42
+
43
+ def _kmc3_recipe_helper_expimangle(expi, **spice):
44
+ # Helper for KMC3 recipes: changes experimental info
45
+ # using spice info from 'image', 'energy', and possibly others.
46
+ # Returns new experimental info, and a qmap parameters dict.
47
+ expi2 = expi.copy()
48
+
49
+ #if 'energy' in spice:
50
+ # expi2['beamEnergy'] = spice['energy']['energy']
51
+
52
+ if 'image' in spice:
53
+ expi2['imageCenter'] = spice['image']['imageCenter']
54
+ expi2['imageDistance'] = spice['image']['imageDistance']
55
+
56
+ return expi2, {}
57
+
58
+
59
+ def sRSM(data, **spice):
60
+ '''
61
+ Generating static reciprocal space maps (RSMs).
62
+
63
+ Requires `exp_info` spice. Also performs basic data mangling
64
+ if appropriate spice types (`offsets`) available, and
65
+ modifies exp_info if exp_info modifiers (`image`) also available.
66
+
67
+ "Static" RSMs don't depend on any external parameters.
68
+ '''
69
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
70
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
71
+ return QMapper(**expi2).qmap(data2, **qpar)
72
+
73
+
74
+ def TRSM(data, **spice):
75
+ '''
76
+ Generating temperature (T) dependent RSMs, uses 'temp' dataset
77
+ '''
78
+ from nx5d.xrd.signal import QMapper
79
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
80
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
81
+
82
+ data2['temp'] = data2.temp.round()
83
+
84
+ return data2.groupby('temp').map(QMapper(**expi2).qmap, **qpar)
85
+
86
+
87
+ def rocking(data, **spice):
88
+ raise RuntimeError('recipe for rocking data not implemented')
89
+
@@ -0,0 +1,66 @@
1
+ from kmc3recipe.signal import QMapper
2
+
3
+ all = [
4
+ "sRSM",
5
+ "TRSM",
6
+ "rocking"
7
+ ]
8
+
9
+ def _kmc3_recipe_helper_datamangle(data, **spice):
10
+ # Helper for KMC3 recipes: changes data (mostly by applying offsets)
11
+ # returns new dataset
12
+
13
+ data2 = data.copy()
14
+
15
+ if 'offsets' in spice:
16
+ for k, v in spice['offsets'].items():
17
+ data2[k] = data[k] + spice['offsets'][k]
18
+
19
+ return data2
20
+
21
+
22
+ def _kmc3_recipe_helper_expimangle(expi, **spice):
23
+ # Helper for KMC3 recipes: changes experimental info
24
+ # using spice info from 'image', 'energy', and possibly others.
25
+ # Returns new experimental info, and a qmap parameters dict.
26
+ expi2 = expi.copy()
27
+
28
+ #if 'energy' in spice:
29
+ # expi2['beamEnergy'] = spice['energy']['energy']
30
+
31
+ if 'image' in spice:
32
+ expi2['imageCenter'] = spice['image']['imageCenter']
33
+ expi2['imageDistance'] = spice['image']['imageDistance']
34
+
35
+ return expi2, {}
36
+
37
+
38
+ def sRSM(data, **spice):
39
+ '''
40
+ Generating static RSMs.
41
+
42
+ Requires `exp_info` spice. Also performs basic data mangling
43
+ if appropriate spice types (`offsets`) available, and
44
+ modifies exp_info if exp_info modifiers (`image`) also available.
45
+ '''
46
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
47
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
48
+ return QMapper(**expi2).qmap(data2, **qpar)
49
+
50
+
51
+ def TRSM(data, **spice):
52
+ '''
53
+ Generating temperature (T) dependent RSMs, uses 'temp' dataset
54
+ '''
55
+ from nx5d.xrd.signal import QMapper
56
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
57
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
58
+
59
+ data2['temp'] = data2.temp.round()
60
+
61
+ return data2.groupby('temp').map(QMapper(**expi2).qmap, **qpar)
62
+
63
+
64
+ def rocking(data, **spice):
65
+ raise RuntimeError('recipe for rocking data not implemented')
66
+
File without changes
@@ -0,0 +1,89 @@
1
+ from kmc3recipe.signal import QMapper
2
+
3
+ all = [
4
+ "sRSM",
5
+ "TRSM",
6
+ "rocking",
7
+
8
+ #"xRSS",
9
+ #"tRSS",
10
+ ]
11
+
12
+ # Recipe map to use for easy seeding of all herein supported types.
13
+ RecipeMap = {
14
+ # static RSM
15
+ sRSM="pymod:///kmc3recipes.cooking#sRSM",
16
+
17
+ # temperature-dependent RSM
18
+ tRSM="pymod:///kmc3recipes.cooking#TRSM",
19
+
20
+ # omega-2theta-scan (treat like RSM?)
21
+ rocking="pymod:///kmc3recipes.cooking#sRSM",
22
+
23
+ # some kind (?) of RSS
24
+ xRSS=None,
25
+
26
+ # time-dependent (?) RSS
27
+ tRSS=None,
28
+ }
29
+
30
+ def _kmc3_recipe_helper_datamangle(data, **spice):
31
+ # Helper for KMC3 recipes: changes data (mostly by applying offsets)
32
+ # returns new dataset
33
+
34
+ data2 = data.copy()
35
+
36
+ if 'offsets' in spice:
37
+ for k, v in spice['offsets'].items():
38
+ data2[k] = data[k] + spice['offsets'][k]
39
+
40
+ return data2
41
+
42
+
43
+ def _kmc3_recipe_helper_expimangle(expi, **spice):
44
+ # Helper for KMC3 recipes: changes experimental info
45
+ # using spice info from 'image', 'energy', and possibly others.
46
+ # Returns new experimental info, and a qmap parameters dict.
47
+ expi2 = expi.copy()
48
+
49
+ #if 'energy' in spice:
50
+ # expi2['beamEnergy'] = spice['energy']['energy']
51
+
52
+ if 'image' in spice:
53
+ expi2['imageCenter'] = spice['image']['imageCenter']
54
+ expi2['imageDistance'] = spice['image']['imageDistance']
55
+
56
+ return expi2, {}
57
+
58
+
59
+ def sRSM(data, **spice):
60
+ '''
61
+ Generating static reciprocal space maps (RSMs).
62
+
63
+ Requires `exp_info` spice. Also performs basic data mangling
64
+ if appropriate spice types (`offsets`) available, and
65
+ modifies exp_info if exp_info modifiers (`image`) also available.
66
+
67
+ "Static" RSMs don't depend on any external parameters.
68
+ '''
69
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
70
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
71
+ return QMapper(**expi2).qmap(data2, **qpar)
72
+
73
+
74
+ def TRSM(data, **spice):
75
+ '''
76
+ Generating temperature (T) dependent RSMs, uses 'temp' dataset
77
+ '''
78
+ from nx5d.xrd.signal import QMapper
79
+ data2 = _kmc3_recipe_helper_datamangle(data, **spice)
80
+ expi2, qpar = _kmc3_recipe_helper_expimangle(spice['exp_info'], **spice)
81
+
82
+ data2['temp'] = data2.temp.round()
83
+
84
+ return data2.groupby('temp').map(QMapper(**expi2).qmap, **qpar)
85
+
86
+
87
+ def rocking(data, **spice):
88
+ raise RuntimeError('recipe for rocking data not implemented')
89
+
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.0.0'
32
+ __version_tuple__ = version_tuple = (0, 0, 0)
33
+
34
+ __commit_id__ = commit_id = 'gf46a0458e'