Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add read functions for PTU, FBD, and FLIF files #25

Merged
merged 3 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix frequency attribute returned by read_ptu function
  • Loading branch information
cgohlke committed Jan 5, 2024
commit ffa6129477ca28140fda62275c9b115167a7e6ee
6 changes: 3 additions & 3 deletions src/phasorpy/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def read_ptu(
>>> data.coords['H'].data
array(...)
>>> data.attrs['frequency']
2.51...
78.02

"""
import ptufile
Expand All @@ -636,9 +636,9 @@ def read_ptu(
keepdims=keepdims,
asxarray=True,
)
assert isinstance(data, DataArray)
data.attrs['frequency'] = ptu.syncrate * 1e-6 # MHz

assert isinstance(data, DataArray)
data.attrs['frequency'] *= 1e-6 # MHz
return data


Expand Down
2 changes: 1 addition & 1 deletion tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_read_ptu():
assert_almost_equal(
data.coords['H'].data[[1, -1]], [9.69696970e-11, 3.97090909e-07]
)
assert_almost_equal(data.attrs['frequency'], 2.517700195304632)
assert data.attrs['frequency'] == 78.02


@pytest.mark.skipif(SKIP_PRIVATE, reason='file is private')
Expand Down