metamorph-mda-parser 0.3.0__tar.gz → 0.4.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 (30) hide show
  1. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/.github/workflows/publish.yml +1 -1
  2. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/.github/workflows/test.yml +1 -1
  3. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/PKG-INFO +1 -1
  4. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/src/metamorph_mda_parser/nd.py +10 -2
  5. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/test_nd.py +6 -0
  6. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/.gitattributes +0 -0
  7. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/.github/dependabot.yml +0 -0
  8. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/.gitignore +0 -0
  9. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/LICENSE.txt +0 -0
  10. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/README.md +0 -0
  11. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/hk.pkl +0 -0
  12. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/pixi.lock +0 -0
  13. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/pyproject.toml +0 -0
  14. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/src/metamorph_mda_parser/__init__.py +0 -0
  15. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/src/metamorph_mda_parser/lark.py +0 -0
  16. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/src/metamorph_mda_parser/nd_grammar.lark +0 -0
  17. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/src/metamorph_mda_parser/xarray.py +0 -0
  18. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z.nd +0 -0
  19. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w1Conf640_s1.tif +0 -0
  20. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w1Conf640_s2.tif +0 -0
  21. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w2Conf561_s1.stk +0 -0
  22. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w2Conf561_s2.stk +0 -0
  23. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w3Conf488_s1.stk +0 -0
  24. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/data/sample_3ch_2pos_mixed-z_w3Conf488_s2.stk +0 -0
  25. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/decimal_comma_zstepsize.nd +0 -0
  26. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/sample_2ch_75pos_361t.nd +0 -0
  27. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/sample_4ch_1pos_1z.nd +0 -0
  28. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/resources/sample_4ch_4pos.nd +0 -0
  29. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/test_xarray.py +0 -0
  30. {metamorph_mda_parser-0.3.0 → metamorph_mda_parser-0.4.0}/tests/test_xarray_conditional.py +0 -0
@@ -72,4 +72,4 @@ jobs:
72
72
  with:
73
73
  files: dist/*
74
74
  - name: Publish package distributions to PyPI
75
- uses: pypa/gh-action-pypi-publish@v1.14.2
75
+ uses: pypa/gh-action-pypi-publish@v1.14.3
@@ -35,7 +35,7 @@ jobs:
35
35
  - uses: actions/checkout@v7
36
36
 
37
37
  - name: Set up Pixi
38
- uses: prefix-dev/setup-pixi@v0.10.2
38
+ uses: prefix-dev/setup-pixi@v0.11.2
39
39
  with:
40
40
  cache: true
41
41
  environments: ${{ matrix.pixi-environment }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: metamorph-mda-parser
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Light-weight parsing of Metamorph/VisiView .nd files.
5
5
  Project-URL: Documentation, https://github.com/fmi-faim/metamorph-mda-parser#readme
6
6
  Project-URL: Issues, https://github.com/fmi-faim/metamorph-mda-parser/issues
@@ -44,12 +44,20 @@ class NdInfo(BaseModel):
44
44
  wave_in_file_name: bool
45
45
 
46
46
  @staticmethod
47
- def from_path(path: Path, fix_decimal_comma: bool = False):
47
+ def from_path(
48
+ path: Path,
49
+ fix_decimal_comma: bool = False,
50
+ remove_suffix: str | None = None,
51
+ ):
48
52
  with open(path) as f:
49
53
  content = f.read()
50
54
  result = parse(content, fix_decimal_comma=fix_decimal_comma)
51
55
  result["Path"] = path
52
- result["Name"] = path.stem
56
+ result["Name"] = (
57
+ path.stem
58
+ if remove_suffix is None
59
+ else path.name.removesuffix(remove_suffix)
60
+ )
53
61
  result["Version"] = "1.0" # HACK
54
62
  return NdInfo(**result)
55
63
 
@@ -134,3 +134,9 @@ def test_fix_decimal_comma(nd_with_decimal_comma_zstepsize):
134
134
  assert nd_info.do_z_series
135
135
  assert nd_info.n_z_steps == 25
136
136
  assert nd_info.z_step_size == 2.0
137
+
138
+
139
+ def test_remove_suffix(sample_4ch_4pos):
140
+ nd_info = NdInfo.from_path(sample_4ch_4pos, remove_suffix=".nd")
141
+
142
+ assert nd_info.name == sample_4ch_4pos.stem