jupyter-analysis-tools 1.2.1__tar.gz → 1.3.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.
Files changed (59) hide show
  1. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/.cookiecutterrc +1 -1
  2. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/CHANGELOG.md +30 -0
  3. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/PKG-INFO +33 -3
  4. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/README.rst +2 -2
  5. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/conf.py +1 -1
  6. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/__init__.py +1 -1
  7. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/readdata.py +13 -10
  8. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/utils.py +25 -1
  9. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools.egg-info/PKG-INFO +33 -3
  10. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/testdata/S2842 water.json +7 -17
  11. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/tests/readdata.py +26 -15
  12. jupyter_analysis_tools-1.3.0/tests/utils.py +80 -0
  13. jupyter_analysis_tools-1.2.1/tests/utils.py +0 -34
  14. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/.editorconfig +0 -0
  15. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/.pre-commit-config.yaml +0 -0
  16. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/AUTHORS.rst +0 -0
  17. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/CONTRIBUTING.rst +0 -0
  18. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/LICENSE +0 -0
  19. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/MANIFEST.in +0 -0
  20. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/requirements.txt +0 -0
  21. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/build.yml +0 -0
  22. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/ci-cd.yml +0 -0
  23. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/coverage.yml +0 -0
  24. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/docs.yml +0 -0
  25. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/release.yml +0 -0
  26. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/templates/.github/workflows/tests.yml +0 -0
  27. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/ci/update.py +0 -0
  28. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/_templates/class.rst +0 -0
  29. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/_templates/module.rst +0 -0
  30. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/authors.rst +0 -0
  31. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/changelog.rst +0 -0
  32. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/contributing.rst +0 -0
  33. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/index.rst +0 -0
  34. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/installation.rst +0 -0
  35. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/readme.rst +0 -0
  36. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/reference/index.rst +0 -0
  37. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/requirements.txt +0 -0
  38. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/spelling_wordlist.txt +0 -0
  39. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/docs/usage.rst +0 -0
  40. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/pyproject.toml +0 -0
  41. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/setup.cfg +0 -0
  42. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/analysis.py +0 -0
  43. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/binning.py +0 -0
  44. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/datalocations.py +0 -0
  45. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/distrib.py +0 -0
  46. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/git.py +0 -0
  47. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/plotting.py +0 -0
  48. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools/widgets.py +0 -0
  49. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools.egg-info/SOURCES.txt +0 -0
  50. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools.egg-info/dependency_links.txt +0 -0
  51. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools.egg-info/requires.txt +0 -0
  52. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/src/jupyter_analysis_tools.egg-info/top_level.txt +0 -0
  53. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/templates/CHANGELOG.md.j2 +0 -0
  54. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/testdata/2015-03-20-Silica.ssf.json +0 -0
  55. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/testdata/2015-03-20-Silica.ssfz +0 -0
  56. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/testdata/S2842 water.pdh +0 -0
  57. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/testdata/S2843[9].pdh +0 -0
  58. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/tests/requirements.txt +0 -0
  59. {jupyter_analysis_tools-1.2.1 → jupyter_analysis_tools-1.3.0}/tox.ini +0 -0
@@ -20,7 +20,7 @@ default_context:
20
20
  release_date: 'today'
21
21
  year_from: '2018'
22
22
  year_to: '2023'
23
- version: '1.2.1'
23
+ version: '1.3.0'
24
24
  pypi_host: 'pypi.org'
25
25
  license: 'MIT license'
26
26
  sphinx_theme: 'furo'
@@ -1,5 +1,35 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.3.0 (2025-07-16)
4
+
5
+ ### Bug fixes
6
+
7
+ * utils.extract7z: informative info message ([`80d2f71`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/80d2f7134992d59f0bfd7f5e7bc27772f77cd452))
8
+
9
+ ### Continuous integration
10
+
11
+ * coverage: fix coverage artifact name for multiple matrix.os ([`f471599`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f471599b8c86e29fd20b78f7cbd9291c3a6dd98a))
12
+
13
+ * testing: test on Windows as well ([`4a83c39`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4a83c3924bcb820ef0728af40b86a0f6622dfef2))
14
+
15
+ ### Features
16
+
17
+ * utils.makeNetworkdriveAbsolute: new routines for translating a windows drive letter mount to its network location ([`823a6bf`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/823a6bfe126829381bc14d34578f342f4b9d3e8f))
18
+
19
+ ## v1.2.2 (2025-07-15)
20
+
21
+ ### Bug fixes
22
+
23
+ * readPDHmeta: use unique dict keys, the xmk *key* can occur in multiple groups in PDH ([`ef41c81`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/ef41c81d40d801b5baf86f56cf9012ca35d2ccde))
24
+
25
+ ### Documentation
26
+
27
+ * pyproject: revert specify readme+changelog document types ([`1baa762`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/1baa762d441fe0a1b7b663b9d0589de857277426))
28
+
29
+ * pyproject: specify readme+changelog document types to render overview on pypi correctly ([`6e4d1e5`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6e4d1e56640b604f971ddca8dabd8d1aff5c9bf1))
30
+
31
+ * ghpages: make sure .nojekyll exists after purging old html docs ([`4847845`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4847845cc06884b6e589b26897e83411d649ef4d))
32
+
3
33
  ## v1.2.1 (2025-07-11)
4
34
 
5
35
  ### Bug fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jupyter-analysis-tools
3
- Version: 1.2.1
3
+ Version: 1.3.0
4
4
  Summary: Yet another Python library with helpers and utilities for data analysis and processing.
5
5
  Author-email: Ingo Breßler <dev@ingobressler.net>
6
6
  License: MIT license
@@ -53,8 +53,8 @@ Yet another Python library with helpers and utilities for data analysis and proc
53
53
  :target: https://pypi.org/project/jupyter-analysis-tools
54
54
  :alt: PyPI Package latest release
55
55
 
56
- .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.2.1.svg
57
- :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.2.1...main
56
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.3.0.svg
57
+ :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.3.0...main
58
58
  :alt: Commits since latest release
59
59
 
60
60
  .. |license| image:: https://img.shields.io/pypi/l/jupyter-analysis-tools.svg
@@ -127,6 +127,36 @@ Note, to combine the coverage data from all the tox environments run:
127
127
 
128
128
  # CHANGELOG
129
129
 
130
+ ## v1.3.0 (2025-07-16)
131
+
132
+ ### Bug fixes
133
+
134
+ * utils.extract7z: informative info message ([`80d2f71`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/80d2f7134992d59f0bfd7f5e7bc27772f77cd452))
135
+
136
+ ### Continuous integration
137
+
138
+ * coverage: fix coverage artifact name for multiple matrix.os ([`f471599`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f471599b8c86e29fd20b78f7cbd9291c3a6dd98a))
139
+
140
+ * testing: test on Windows as well ([`4a83c39`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4a83c3924bcb820ef0728af40b86a0f6622dfef2))
141
+
142
+ ### Features
143
+
144
+ * utils.makeNetworkdriveAbsolute: new routines for translating a windows drive letter mount to its network location ([`823a6bf`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/823a6bfe126829381bc14d34578f342f4b9d3e8f))
145
+
146
+ ## v1.2.2 (2025-07-15)
147
+
148
+ ### Bug fixes
149
+
150
+ * readPDHmeta: use unique dict keys, the xmk *key* can occur in multiple groups in PDH ([`ef41c81`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/ef41c81d40d801b5baf86f56cf9012ca35d2ccde))
151
+
152
+ ### Documentation
153
+
154
+ * pyproject: revert specify readme+changelog document types ([`1baa762`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/1baa762d441fe0a1b7b663b9d0589de857277426))
155
+
156
+ * pyproject: specify readme+changelog document types to render overview on pypi correctly ([`6e4d1e5`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6e4d1e56640b604f971ddca8dabd8d1aff5c9bf1))
157
+
158
+ * ghpages: make sure .nojekyll exists after purging old html docs ([`4847845`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4847845cc06884b6e589b26897e83411d649ef4d))
159
+
130
160
  ## v1.2.1 (2025-07-11)
131
161
 
132
162
  ### Bug fixes
@@ -14,8 +14,8 @@ Yet another Python library with helpers and utilities for data analysis and proc
14
14
  :target: https://pypi.org/project/jupyter-analysis-tools
15
15
  :alt: PyPI Package latest release
16
16
 
17
- .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.2.1.svg
18
- :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.2.1...main
17
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.3.0.svg
18
+ :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.3.0...main
19
19
  :alt: Commits since latest release
20
20
 
21
21
  .. |license| image:: https://img.shields.io/pypi/l/jupyter-analysis-tools.svg
@@ -29,7 +29,7 @@ project = "Jupyter Analysis Tools"
29
29
  year = "2018-2023"
30
30
  author = "Ingo Breßler"
31
31
  copyright = "{0}, {1}".format(year, author)
32
- version = "1.2.1"
32
+ version = "1.3.0"
33
33
  release = version
34
34
  commit_id = None
35
35
  try:
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # __init__.py
3
3
 
4
- __version__ = "1.2.1"
4
+ __version__ = "1.3.0"
5
5
 
6
6
  from .binning import reBin
7
7
  from .git import checkRepo, isNBstripoutActivated, isNBstripoutInstalled, isRepo
@@ -68,14 +68,18 @@ def xmlPDHToDict(root):
68
68
  while stack:
69
69
  elem, parentCont = stack.pop()
70
70
  elemCont = {}
71
- key = elem.attrib.pop("key", None)
72
71
  idx = -1
73
- if (
74
- not len(list(elem)) and
75
- not len(elem.attrib) and
76
- not (elem.text and len(elem.text.strip()))
72
+ key = elem.attrib.pop("key", None)
73
+ if ( # get a unique key, the key can occur in multiple groups in PDH
74
+ key is not None and elem.tag == "group" and elem.attrib.get("id", None) is not None
75
+ ):
76
+ key = elem.attrib.pop("id")
77
+ if ( # skip empty elements with a key only early
78
+ not len(list(elem))
79
+ and not len(elem.attrib)
80
+ and not (elem.text and len(elem.text.strip()))
77
81
  ):
78
- continue # skip empty elements with a key only early
82
+ continue
79
83
  if elem.tag == "list":
80
84
  elemCont = []
81
85
  else: # add attributes & values to dict
@@ -115,9 +119,8 @@ def xmlPDHToDict(root):
115
119
  else: # have a key
116
120
  parentCont[parentKey] = {key: elemCont}
117
121
  else: # parentKey exists already
118
- if (
119
- not isinstance(parentCont[parentKey], list) and
120
- not isinstance(parentCont[parentKey], dict)
122
+ if not isinstance(parentCont[parentKey], list) and not isinstance(
123
+ parentCont[parentKey], dict
121
124
  ):
122
125
  # if its a plain value before, make a list out of it and append in next step
123
126
  parentCont[parentKey] = [parentCont[parentKey]]
@@ -135,7 +138,7 @@ def xmlPDHToDict(root):
135
138
  try:
136
139
  oldts = result["fileinfo"]["parameter"]["DateTime"]["value"]
137
140
  # timestamp seems to be based on around 2009-01-01 (a day give or take)
138
- delta = ((39 * 365 + 10) * 24 * 3600)
141
+ delta = (39 * 365 + 10) * 24 * 3600
139
142
  # make it compatible to datetime.datetime routines
140
143
  result["fileinfo"]["parameter"]["DateTime"]["value"] = oldts + delta
141
144
  except KeyError:
@@ -105,6 +105,30 @@ def addEnvScriptsToPATH():
105
105
  os.environ["PATH"] = sep.join(environPATH)
106
106
 
107
107
 
108
+ def networkdriveMapping(cmdOutput: str = None):
109
+ """Returns a dict of mapping drive letters to network paths (on Windows)."""
110
+ if isWindows():
111
+ if cmdOutput is None:
112
+ proc = subprocess.run(["net", "use"], capture_output=True, text=True, encoding="cp850")
113
+ cmdOutput = proc.stdout
114
+ rows = [line.split() for line in cmdOutput.splitlines() if "Windows Network" in line]
115
+ rows = dict(
116
+ [row[1:3] for row in rows if row[1].endswith(":") and row[2].startswith("\\\\")]
117
+ )
118
+ return rows
119
+ return {}
120
+
121
+
122
+ def makeNetworkdriveAbsolute(filepath, cmdOutput: str = None):
123
+ """Replaces the drive letter of the given path by the respective network path, if possible."""
124
+ if isWindows() and not filepath.drive.startswith(r"\\"):
125
+ drivemap = networkdriveMapping(cmdOutput=cmdOutput)
126
+ prefix = drivemap.get(filepath.drive, None)
127
+ if prefix is not None:
128
+ filepath = Path(prefix).joinpath(*filepath.parts[1:])
129
+ return filepath
130
+
131
+
108
132
  def checkWinFor7z():
109
133
  """Extend the PATH environment variable for access to the 7-zip executable."""
110
134
  if not isWindows():
@@ -127,7 +151,7 @@ def extract7z(fn, workdir=None):
127
151
  assert os.path.isfile(os.path.join(workdir, fn)), "Provided 7z archive '{}' not found!".format(
128
152
  fn
129
153
  )
130
- print("Extracting archived McDLS results:")
154
+ print(f"Extracting '{fn}':")
131
155
  proc = subprocess.run(
132
156
  ["7z", "x", fn],
133
157
  cwd=workdir,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jupyter-analysis-tools
3
- Version: 1.2.1
3
+ Version: 1.3.0
4
4
  Summary: Yet another Python library with helpers and utilities for data analysis and processing.
5
5
  Author-email: Ingo Breßler <dev@ingobressler.net>
6
6
  License: MIT license
@@ -53,8 +53,8 @@ Yet another Python library with helpers and utilities for data analysis and proc
53
53
  :target: https://pypi.org/project/jupyter-analysis-tools
54
54
  :alt: PyPI Package latest release
55
55
 
56
- .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.2.1.svg
57
- :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.2.1...main
56
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/BAMresearch/jupyter-analysis-tools/v1.3.0.svg
57
+ :target: https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.3.0...main
58
58
  :alt: Commits since latest release
59
59
 
60
60
  .. |license| image:: https://img.shields.io/pypi/l/jupyter-analysis-tools.svg
@@ -127,6 +127,36 @@ Note, to combine the coverage data from all the tox environments run:
127
127
 
128
128
  # CHANGELOG
129
129
 
130
+ ## v1.3.0 (2025-07-16)
131
+
132
+ ### Bug fixes
133
+
134
+ * utils.extract7z: informative info message ([`80d2f71`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/80d2f7134992d59f0bfd7f5e7bc27772f77cd452))
135
+
136
+ ### Continuous integration
137
+
138
+ * coverage: fix coverage artifact name for multiple matrix.os ([`f471599`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f471599b8c86e29fd20b78f7cbd9291c3a6dd98a))
139
+
140
+ * testing: test on Windows as well ([`4a83c39`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4a83c3924bcb820ef0728af40b86a0f6622dfef2))
141
+
142
+ ### Features
143
+
144
+ * utils.makeNetworkdriveAbsolute: new routines for translating a windows drive letter mount to its network location ([`823a6bf`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/823a6bfe126829381bc14d34578f342f4b9d3e8f))
145
+
146
+ ## v1.2.2 (2025-07-15)
147
+
148
+ ### Bug fixes
149
+
150
+ * readPDHmeta: use unique dict keys, the xmk *key* can occur in multiple groups in PDH ([`ef41c81`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/ef41c81d40d801b5baf86f56cf9012ca35d2ccde))
151
+
152
+ ### Documentation
153
+
154
+ * pyproject: revert specify readme+changelog document types ([`1baa762`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/1baa762d441fe0a1b7b663b9d0589de857277426))
155
+
156
+ * pyproject: specify readme+changelog document types to render overview on pypi correctly ([`6e4d1e5`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6e4d1e56640b604f971ddca8dabd8d1aff5c9bf1))
157
+
158
+ * ghpages: make sure .nojekyll exists after purging old html docs ([`4847845`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/4847845cc06884b6e589b26897e83411d649ef4d))
159
+
130
160
  ## v1.2.1 (2025-07-11)
131
161
 
132
162
  ### Bug fixes
@@ -165,7 +165,6 @@
165
165
  "isdevice": "false",
166
166
  "category": "exp",
167
167
  "sub": "sample",
168
- "id": "exp:sample:Default",
169
168
  "ParameterCount": {
170
169
  "value": 0,
171
170
  "counts": "ParameterKey|ParameterName|ParameterValue",
@@ -208,7 +207,6 @@
208
207
  "isdevice": "false",
209
208
  "category": "exp",
210
209
  "sub": "file",
211
- "id": "exp:file:Default",
212
210
  "Filename": {
213
211
  "value": "S2842",
214
212
  "type": "String",
@@ -261,7 +259,6 @@
261
259
  "isdevice": "false",
262
260
  "category": "exp",
263
261
  "sub": "vari",
264
- "id": "exp:vari:Default",
265
262
  "VariationCount": {
266
263
  "value": 0,
267
264
  "counts": "Parameter|Count|Start|Increment|Positions|Prefix|Digits|NamingOption",
@@ -316,10 +313,9 @@
316
313
  "db": "D"
317
314
  }
318
315
  },
319
- "custom_generator": {
316
+ "generator::custom_generator#0": {
320
317
  "isdevice": "true",
321
318
  "category": "generator",
322
- "id": "generator::custom_generator#0",
323
319
  "isactive": "true",
324
320
  "Name": {
325
321
  "value": "PW1830",
@@ -453,10 +449,9 @@
453
449
  "type": "String"
454
450
  }
455
451
  },
456
- "AP_SAXSess": {
452
+ "camera::AP_SAXSess#0": {
457
453
  "isdevice": "true",
458
454
  "category": "camera",
459
- "id": "camera::AP_SAXSess#0",
460
455
  "Name": {
461
456
  "value": "SAXSess",
462
457
  "type": "String",
@@ -573,11 +568,10 @@
573
568
  "type": "String"
574
569
  }
575
570
  },
576
- "PI_SCX4300": {
571
+ "detector:ccd:PI_SCX4300#0": {
577
572
  "isdevice": "true",
578
573
  "category": "detector",
579
574
  "sub": "ccd",
580
- "id": "detector:ccd:PI_SCX4300#0",
581
575
  "Name": {
582
576
  "value": "CCD",
583
577
  "type": "String",
@@ -897,10 +891,9 @@
897
891
  "Y": 1
898
892
  }
899
893
  },
900
- "AP_TCS120": {
894
+ "holder::AP_TCS120#0": {
901
895
  "isdevice": "true",
902
896
  "category": "holder",
903
- "id": "holder::AP_TCS120#0",
904
897
  "Name": {
905
898
  "value": "TCS 120",
906
899
  "type": "String",
@@ -957,11 +950,10 @@
957
950
  "type": "String"
958
951
  }
959
952
  },
960
- "AP_TCU50": {
953
+ "secu:temp:AP_TCU50#0": {
961
954
  "isdevice": "true",
962
955
  "category": "secu",
963
956
  "sub": "temp",
964
- "id": "secu:temp:AP_TCU50#0",
965
957
  "Name": {
966
958
  "value": "TCU 50",
967
959
  "type": "String",
@@ -1158,11 +1150,10 @@
1158
1150
  "type": "String"
1159
1151
  }
1160
1152
  },
1161
- "Dectris_Mythen1K": {
1153
+ "detector:ccd:Dectris_Mythen1K#0": {
1162
1154
  "isdevice": "true",
1163
1155
  "category": "detector",
1164
1156
  "sub": "ccd",
1165
- "id": "detector:ccd:Dectris_Mythen1K#0",
1166
1157
  "Name": {
1167
1158
  "value": "1D diode array",
1168
1159
  "type": "String",
@@ -1506,11 +1497,10 @@
1506
1497
  "Y": 1
1507
1498
  }
1508
1499
  },
1509
- "Spark_ASXc": {
1500
+ "sampler:auto:Spark_ASXc#0": {
1510
1501
  "isdevice": "true",
1511
1502
  "category": "sampler",
1512
1503
  "sub": "auto",
1513
- "id": "sampler:auto:Spark_ASXc#0",
1514
1504
  "Name": {
1515
1505
  "value": "ASX-c",
1516
1506
  "type": "String",
@@ -26,17 +26,28 @@ def test_readdata1(capsys):
26
26
  assert df.columns.tolist() == ["q", "I", "e"]
27
27
  assert df.dtypes.tolist() == [numpy.float64, numpy.float64, numpy.float64]
28
28
  # checking the first data values
29
- assert numpy.all(df.loc[:2].values == numpy.array(
30
- [[-1.005583e00, 5.555556e-08, 2.754402e-08],
31
- [-9.989474e-01, 3.611111e-07, 6.568830e-08],
32
- [-9.923112e-01, 3.055556e-07, 6.120415e-08]]))
29
+ assert numpy.all(
30
+ df.loc[:2].values
31
+ == numpy.array(
32
+ [
33
+ [-1.005583e00, 5.555556e-08, 2.754402e-08],
34
+ [-9.989474e-01, 3.611111e-07, 6.568830e-08],
35
+ [-9.923112e-01, 3.055556e-07, 6.120415e-08],
36
+ ]
37
+ )
38
+ )
33
39
  # and checking the last data values
34
- assert numpy.all(df.loc[df.shape[0] - 3 :].values == numpy.array(
35
- [[7.381979e00, 2.972222e-06, 1.792166e-07],
36
- [7.388376e00, 2.944444e-06, 1.436040e-07],
37
- [7.394774e00, 2.388889e-06, 1.548690e-07]]))
38
- assert numpy.all(df.median().values == numpy.array(
39
- [3.233221e00, 5.826389e-05, 8.835466e-07]))
40
+ assert numpy.all(
41
+ df.loc[df.shape[0] - 3 :].values
42
+ == numpy.array(
43
+ [
44
+ [7.381979e00, 2.972222e-06, 1.792166e-07],
45
+ [7.388376e00, 2.944444e-06, 1.436040e-07],
46
+ [7.394774e00, 2.388889e-06, 1.548690e-07],
47
+ ]
48
+ )
49
+ )
50
+ assert numpy.all(df.median().values == numpy.array([3.233221e00, 5.826389e-05, 8.835466e-07]))
40
51
 
41
52
 
42
53
  def test_readdata2(capsys):
@@ -48,8 +59,7 @@ def test_readdata2(capsys):
48
59
  assert fn == "S2843"
49
60
  assert df.shape == (427, 3)
50
61
  assert df.columns.tolist() == ["q", "I", "e"]
51
- assert numpy.all(df.median().values == numpy.array(
52
- [1.470428, 0.01907878, 0.01353293]))
62
+ assert numpy.all(df.median().values == numpy.array([1.470428, 0.01907878, 0.01353293]))
53
63
 
54
64
 
55
65
  def test_readPDHmeta1():
@@ -62,7 +72,7 @@ def test_readPDHmeta1():
62
72
 
63
73
  # writing the test JSON for comparisons on updates
64
74
  # with open(pathPDH1.with_suffix(".json"), "w") as fd:
65
- # json.dump(data, fd, indent=4)
75
+ # json.dump(data, fd, indent=4)
66
76
 
67
77
  # write the JSON formatted metadata to disk, read it back in and compare
68
78
  # it with the expected reference from testdata dir
@@ -97,8 +107,9 @@ def test_readSSF():
97
107
  # json.dump(data, fd, indent=4)
98
108
  # write the JSON formatted session data to disk
99
109
  # and compare it with the expected JSON file from testdata dir
100
- with open(pathSSFZ.with_suffix(".ssf.json")) as fdRef, \
101
- tempfile.TemporaryFile("w+") as fdNew:
110
+ with open(pathSSFZ.with_suffix(".ssf.json")) as fdRef, tempfile.TemporaryFile(
111
+ "w+"
112
+ ) as fdNew:
102
113
  json.dump(data, fdNew, indent=4)
103
114
  fdNew.seek(0)
104
115
  assert fdRef.read() == fdNew.read()
@@ -0,0 +1,80 @@
1
+ # -*- coding: utf-8 -*-
2
+ # tests/utils.py
3
+
4
+
5
+ import os
6
+ from pathlib import Path
7
+
8
+ from jupyter_analysis_tools.utils import (
9
+ appendToPATH,
10
+ isWindows,
11
+ makeNetworkdriveAbsolute,
12
+ networkdriveMapping,
13
+ )
14
+
15
+ # output of 'net use' command on Windows
16
+ outNetUse = r"""Neue Verbindungen werden gespeichert.
17
+
18
+
19
+ Status Lokal Remote Netzwerk
20
+
21
+ -------------------------------------------------------------------------------
22
+ OK G: \\ALPHA\BETA Microsoft Windows Network
23
+ OK K: \\GAM\MMA Microsoft Windows Network
24
+ OK M: \\user\drive\uname Microsoft Windows Network
25
+ OK T: \\test\foldername Microsoft Windows Network
26
+ OK \\psi\folder Microsoft Windows Network
27
+ Der Befehl wurde erfolgreich ausgeführt.
28
+ """
29
+
30
+
31
+ def test_appendToPATH(capsys):
32
+ # Setting up a PATH for testing first (platform dependent).
33
+ testpath = "/usr/local/sbin:/usr/local/bin:/sbin:/usr/games:/usr/local/games:/snap/bin"
34
+ if isWindows():
35
+ testpath = "something else"
36
+ os.environ["PATH"] = testpath
37
+ assert os.environ["PATH"] == testpath
38
+
39
+ if not isWindows(): # Linux edition
40
+ appendToPATH("/tmp", ("one", "two"), verbose=True)
41
+ captured = capsys.readouterr()
42
+ assert (
43
+ captured.out
44
+ == """\
45
+ /tmp/one [exists: False]
46
+ /tmp/two [exists: False]
47
+ """
48
+ )
49
+ assert os.environ["PATH"] == testpath + ":/tmp/one:/tmp/two"
50
+
51
+ else: # Windows edition
52
+ appendToPATH(r"C:\Windows", ("one", "two"), verbose=True)
53
+ captured = capsys.readouterr()
54
+ assert (
55
+ captured.out
56
+ == """\
57
+ C:\\Windows\\one [exists: False]
58
+ C:\\Windows\\two [exists: False]
59
+ """
60
+ )
61
+ assert os.environ["PATH"] == testpath + r";C:\Windows\one;C:\Windows\two"
62
+
63
+
64
+ def test_networkdriveMapping():
65
+ if isWindows():
66
+ map = networkdriveMapping(cmdOutput=outNetUse)
67
+ assert map == {
68
+ "G:": "\\\\ALPHA\\BETA",
69
+ "K:": "\\\\GAM\\MMA",
70
+ "M:": "\\\\user\\drive\\uname",
71
+ "T:": "\\\\test\\foldername",
72
+ }
73
+
74
+
75
+ def test_makeNetworkdriveAbsolute():
76
+ if isWindows():
77
+ filepath = Path(r"M:\some\folders\a file name.ext")
78
+ newpath = makeNetworkdriveAbsolute(filepath, cmdOutput=outNetUse)
79
+ assert filepath != newpath
80
+ assert newpath == Path(r"\\user\drive\uname\some\folders\a file name.ext")
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # tests/utils.py
3
-
4
-
5
- import os
6
-
7
- from jupyter_analysis_tools.utils import appendToPATH, isWindows
8
-
9
-
10
- def test_appendToPATH(capsys):
11
- # Setting up a PATH for testing first (platform dependent).
12
- testpath = "/usr/local/sbin:/usr/local/bin:/sbin:/usr/games:/usr/local/games:/snap/bin"
13
- if isWindows():
14
- testpath = "something else"
15
- os.environ["PATH"] = testpath
16
- assert os.environ["PATH"] == testpath
17
-
18
- if not isWindows(): # Linux edition
19
- appendToPATH("/tmp", ("one", "two"), verbose=True)
20
- captured = capsys.readouterr()
21
- assert captured.out == """\
22
- /tmp/one [exists: False]
23
- /tmp/two [exists: False]
24
- """
25
- assert os.environ["PATH"] == testpath+":/tmp/one:/tmp/two"
26
-
27
- else: # Windows edition
28
- appendToPATH(r"C:\Windows", ("one", "two"), verbose=True)
29
- captured = capsys.readouterr()
30
- assert captured.out == """\
31
- C:\\Windows\\one [exists: False]
32
- C:\\Windows\\two [exists: False]
33
- """
34
- assert os.environ["PATH"] == testpath+r";C:\Windows\one;C:\Windows\two"