-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c4ca00
commit cca6050
Showing
3 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from collections import deque | ||
import pathlib | ||
import tempfile | ||
|
||
import multiprocessing as mp | ||
|
||
import numpy as np | ||
|
||
from dcnum import write | ||
|
||
|
||
mp_spawn = mp.get_context('spawn') | ||
|
||
|
||
def setup(): | ||
global path_out | ||
global writer_dq | ||
total_frames = 3000 | ||
batch_size = 500 | ||
num_batches = 6 | ||
assert batch_size * num_batches == total_frames | ||
|
||
writer_dq = deque() | ||
# Create 1000 events with at most two repetitions in a frame | ||
np.random.seed(42) | ||
rng = np.random.default_rng() | ||
|
||
# create a sample event | ||
for ii in range(num_batches): | ||
writer_dq.append(("mask", rng.random((batch_size, 80, 320)) > .5)) | ||
writer_dq.append(("temp", rng.normal(23, size=batch_size))) | ||
|
||
path_out = pathlib.Path( | ||
tempfile.mkdtemp(prefix=pathlib.Path(__file__).name)) / "out.rtdc" | ||
|
||
|
||
def main(): | ||
thr_drw = write.DequeWriterThread( | ||
path_out=path_out, | ||
dq=writer_dq, | ||
) | ||
thr_drw.may_stop_loop = True | ||
thr_drw.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters