Skip to content

Commit

Permalink
Merge pull request #113 from utkarshp1161/main
Browse files Browse the repository at this point in the history
gwyfile in setup_requires
  • Loading branch information
ramav87 committed Jan 19, 2024
2 parents a499259 + 8c62c53 commit b8ace8b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
- name: Generate coverage report
run: |
pip install pytest pytest-cov pywget
pytest --cov=./ --cov-report=xml
pip install -r extras_require.txt
pytest --cov=./ --cov-report=xml
Expand Down
33 changes: 33 additions & 0 deletions tests/readers/microscopy/spm/afm/test_gwy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pytest
import sidpy
import SciFiReaders as sr
from pywget import wget
import os
try:
import gwyfile
except ImportError:
import pip
pip.main(['install', 'gwyfile'])
root_path = "https://github.com/pycroscopy/SciFiDatasets/blob/main/data/microscopy/spm/afm/"

@pytest.fixture
def gwy_file():
file_path = 'PTO_110_Virgin0001.gwy'
wget.download(root_path + "/PTO_110_Virgin0001.gwy?raw=true", out=file_path)
yield file_path
os.remove(file_path)

def test_load_test_gwy_file(gwy_file):
data_translator = sr.GwyddionReader(gwy_file)
datasets = data_translator.read(verbose=False)
assert len(datasets) == 4, f"Length of dataset should be 2 but is instead {len(datasets)}"
channel_names = ['HeightRetrace', 'AmplitudeRetrace', 'DeflectionRetrace', 'PhaseRetrace']
channel_units = ['m', 'm', 'm', 'deg']
channel_labels = [['x (m)', 'y (m)'], ['x (m)', 'y (m)'], ['x (m)', 'y (m)'], ['x (m)', 'y (m)']]
for ind, dataset in enumerate(datasets):
assert isinstance(dataset, sidpy.sid.dataset.Dataset), f"Dataset No. {ind} not read in as sidpy dataset but was instead read in as {type(dataset)}"
assert dataset.shape[0] == 256, f"Dataset[{ind}] is of size 512 but was read in as {dataset.shape[0]}"
assert isinstance(dataset._axes[0], sidpy.sid.dimension.Dimension), "Dataset should have dimension type of sidpy Dimension, but is instead {}".format(type(dataset._axes))
assert dataset.quantity == channel_names[ind], "Dataset having inconsistent channel names"
assert dataset.units == channel_units[ind], "Dataset having inconsistent unit names"
assert dataset.labels == channel_labels[ind], "Dataset having inconsistent channel labels"

0 comments on commit b8ace8b

Please sign in to comment.