Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
harripj committed Apr 13, 2024
2 parents 5d840ce + e77da55 commit 9c1a008
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To open a file:
```python
import FourDimensionalData

data = FourDimensionalData("my_data.blo")
data = FourDimensionalData.from_file("my_data.blo")
```

### Issues
Expand Down
5 changes: 5 additions & 0 deletions data4d/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from pathlib import Path

from .TVIPS import TVIPS
from .base import FourDimensionalData
from .blockfile import BLO

__version__ = open(Path(__file__).parent.joinpath("VERSION")).read().strip()
__all__ = ["FourDimensionalData", "BLO", "TVIPS"]
4 changes: 2 additions & 2 deletions data4d/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ def from_file(fname: Union[str, Path]) -> FourDimensionalData:
handler = {"blo": BLO, "tvips": TVIPS}

fname = Path(fname)
ext = fname.suffix.strip(os.extsep)
ext = fname.suffix.strip(os.extsep).lower()

if ext not in handler:
raise TypeError(
raise ValueError(
f"File format not supported. Supported formats are: {handler.keys()}."
)
return handler[ext](fname)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers =
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
description = Parsers for Four Dimensional Electron Microscopy Data
description = Parsers, Classes, and Functions for Four Dimensional Electron Microscopy Data
long_description = file: README.md
keywords = electron microcopy, diffraction, multi-dimensional data
license_files =
Expand Down
5 changes: 5 additions & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_version():
from data4d import __version__
from packaging.version import parse

assert parse(__version__) >= parse("0.1.0")

0 comments on commit 9c1a008

Please sign in to comment.