Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Misc. enhancements, fixes, and cleanups
Browse files Browse the repository at this point in the history
- Added `libertem_dectris.headers` submodule that exports header classes
- Added constructors for `libertem_dectris.Frame` and `libertem_dectris.FrameStack`
  objects from Python, mostly useful for testing
- Added binding to random port for the simulator
- Properly parametrize with zmq endpoint URI
- Fix many clippy complaints
  • Loading branch information
sk1p committed Aug 16, 2022
1 parent 6646e24 commit bbe220d
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 138 deletions.
64 changes: 64 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pyo3-log = "0.6.0"
serde = { version = "1.0.143", features = ["derive"] }
serde_json = "1.0.83"
spin_sleep = "1.1.1"
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
zmq = { version = "0.9.2", features = ["vendored"] }

[profile.release]
Expand Down
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ec.setDetectorConfig('ntrigger', nimages)
result = ec.sendDetectorCommand('arm')
sequence_id = result['sequence id']

frames = libertem_dectris.FrameChunkedIterator()
frames = libertem_dectris.FrameChunkedIterator(uri="tcp://localhost:9999")
# start to receive data for the given series
# (can be called multiple times on the same `FrameChunkedIterator` instance)
frames.start(series=sequence_id)
Expand All @@ -48,3 +48,38 @@ try:
finally:
frames.close() # clean up background thread etc.
```

## Changelog

### v0.2.0 (unreleased)

- Added `libertem_dectris.headers` submodule that exports header classes
- Added ways to create `libertem_dectris.Frame` and `libertem_dectris.FrameStack`
objects from Python, mostly useful for testing
- Added binding to random port for the simulator
- Properly parametrize with zmq endpoint URI
- Fix many clippy complaints

### v0.1.0

Initial release!

## Development

This package is using [pyo3](https://pyo3.rs/) with
[maturin](https://maturin.rs/) to create the Python bindings. First, make sure
`maturin` is installed in your Python environment:

```bash
(venv) $ pip install maturin
```

Then, after each change to the rust code, run `maturin develop -r` to build and
install a new version of the wheel.

## Release

- update changelog above
- bump version in Cargo.toml if not already bumped, and push
- create a release from the GitHub UI, creating a new tag vX.Y.Z
- done!
2 changes: 1 addition & 1 deletion examples/testchunked.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@click.command()
@click.argument('nimages', type=int)
def main(nimages: int):
frames = libertem_dectris.FrameChunkedIterator()
frames = libertem_dectris.FrameChunkedIterator(uri="tcp://127.0.0.1:9999")

ec = DEigerClient('localhost', 8910)

Expand Down
2 changes: 1 addition & 1 deletion examples/testflame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if __name__ == "__main__":
ec = DEigerClient("localhost", 8910)
frames = libertem_dectris.FrameChunkedIterator()
frames = libertem_dectris.FrameChunkedIterator(uri="tcp://127.0.0.1:9999")

frames.start()

Expand Down
2 changes: 1 addition & 1 deletion examples/testserialize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import libertem_dectris

if __name__ == "__main__":
frames = libertem_dectris.FrameChunkedIterator()
frames = libertem_dectris.FrameChunkedIterator(uri="tcp://127.0.0.1:9999")
frames.start()

frame_stack = frames.get_next_stack(max_size=32)
Expand Down
2 changes: 1 addition & 1 deletion examples/testtooslow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import libertem_dectris

if __name__ == "__main__":
frames = libertem_dectris.FrameIterator()
frames = libertem_dectris.FrameIterator(uri="tcp://127.0.0.1:9999")

frames.start(series=14)

Expand Down
2 changes: 1 addition & 1 deletion examples/testuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@click.command()
@click.argument('nimages', type=int)
def main(nimages: int):
frames = libertem_dectris.FrameIterator()
frames = libertem_dectris.FrameIterator(uri="tcp://127.0.0.1:9999")

ec = DEigerClient('localhost', 8910)

Expand Down
Loading

0 comments on commit bbe220d

Please sign in to comment.