Skip to content

Commit

Permalink
Docs, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sasatani committed Jun 25, 2024
1 parent 7faedb5 commit 0ca1e65
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
7 changes: 7 additions & 0 deletions docs/api/bit_operation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# bit operation

```{eval-rst}
.. automodule:: miniscope_io.bit_operation
:members:
:undoc-members:
```
2 changes: 2 additions & 0 deletions docs/api/stream_daq.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This module is a data acquisition module that captures video streams from Minisc
After [installation](../guide/installation.md) and customizing [configurations](stream-daq-config) if necessary, run the following command in this Git repository to start the data acquisition process:
```bash
>>> mio sdaq -c path/to/config.yml -o output_filename
[24-06-25T04:19:46] INFO [miniscope_io.okDev] Connected to opalkelly.py:34
XEM7310-A75
Connected to XEM7310-A75
Successfully uploaded /miniscope-io/miniscope_io/devices/selected_bitfile.bit
FrontPanel is supported
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ api/exceptions
api/plots/index
api/utils
api/stream_daq
api/bit_operation
api/vendor/index
```

Expand Down
11 changes: 0 additions & 11 deletions miniscope_io/formats/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,3 @@
timestamp=6,
pixel_count=7,
)

""" keeping for ref
StreamBufferHeader = StreamBufferHeaderFormat(
linked_list=(0, 32),
frame_num=(32, 64),
buffer_count=(64, 96),
frame_buffer_count=(96, 128),
timestamp=(192, 224),
pixel_count=(224, 256),
)
"""
19 changes: 7 additions & 12 deletions miniscope_io/stream_daq.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def capture(
p_recv = multiprocessing.Process(
target=self._fpga_recv,
args=(serial_buffer_queue, read_length, True, binary),
name="_fpga_recv"
name="_fpga_recv",
)
else:
raise ValueError(f"source can be one of uart or fpga. Got {source}")
Expand All @@ -546,20 +546,17 @@ def capture(
serial_buffer_queue,
frame_buffer_queue,
),
name="_buffer_to_frame"
name="_buffer_to_frame",
)
p_format_frame = multiprocessing.Process(
target=self._format_frame,
args=(
frame_buffer_queue,
imagearray,
),
name="_format_frame"
name="_format_frame",
)
"""
p_terminate = multiprocessing.Process(
target=check_termination_flag, args=(self.terminate,))
"""

p_recv.start()
p_buffer_to_frame.start()
p_format_frame.start()
Expand All @@ -568,7 +565,7 @@ def capture(
for image in exact_iter(imagearray.get, None):
if self.config.show_video is True:
cv2.imshow("image", image)
if cv2.waitKey(1) == 27: # get out with ESC key
if cv2.waitKey(1) == 27: # get out with ESC key
self.terminate.set()
break
if writer:
Expand All @@ -586,19 +583,17 @@ def capture(
if self.config.show_video:
cv2.destroyAllWindows()
cv2.waitKey(100)

# Give some time for processes to clean up
time.sleep(1)

# Join child processes with a timeout
for p in [p_recv, p_buffer_to_frame, p_format_frame]:
p.join(timeout=2)
if p.is_alive():
self.logger.warning(f"Process {p.name} did not terminate in time and will be terminated forcefully.")
self.logger.warning(f"Termination timeout: force terminating process {p.name}.")
p.terminate()
p.join()
self.logger.info("Child processes joined. End capture.")


def main() -> None: # noqa: D103
args = daqParser.parse_args()

Expand Down

0 comments on commit 0ca1e65

Please sign in to comment.