-
Notifications
You must be signed in to change notification settings - Fork 3
Issue#32 #41
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
Open
Orange99
wants to merge
17
commits into
DC-analysis:main
Choose a base branch
from
Orange99:Issue#32
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue#32 #41
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2fc8881
Fix Issue #32
625575f
Fix Issue #32
4e098e2
Fix Issue #32
62242a6
Fix Issue #32
f4de679
Fix Issue #32
a076a3e
Fix Issue #32
3b5a871
Fix Issue #32
6240d26
reg: don't join worker right after initialization
paulmueller 62d407d
Fix Issue #32
a7bd5f9
Fix Issue #32
3c600ab
Fix Issue #32
6ee42b9
Fix Issue #32
a34a174
Fix Issue #32
3a71f37
Fix Issue #32
23b7308
Fix Issue #32
f1afa3e
reg: don't join worker right after initialization
paulmueller 7a6ac86
Merge remote-tracking branch 'origin/Issue#32' into Issue#32
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
from collections import deque | ||
import multiprocessing as mp | ||
|
||
import numpy as np | ||
|
||
from dcnum import write | ||
|
||
|
||
mp_spawn = mp.get_context('spawn') | ||
|
||
|
||
def setup(): | ||
global event_queue | ||
global writer_dq | ||
global feat_nevents | ||
batch_size = 1000 | ||
num_batches = 3 | ||
num_events = batch_size * num_batches | ||
event_queue = mp.Queue() | ||
writer_dq = deque() | ||
feat_nevents = mp_spawn.Array("i", num_events) | ||
|
||
# Create 1000 events with at most two repetitions in a frame | ||
np.random.seed(42) | ||
rng = np.random.default_rng() | ||
number_order = rng.choice(batch_size, size=batch_size, replace=False) | ||
|
||
# create a sample event | ||
event = { | ||
"temp": np.atleast_1d(rng.normal(23)), | ||
"mask": rng.random((1, 80, 320)) > .5, | ||
} | ||
for ii in range(num_batches): | ||
for idx in number_order: | ||
event_queue.put((ii*batch_size + idx, event)) | ||
|
||
|
||
def main(): | ||
collector_process = write.QueueCollectorProcess( | ||
event_queue=event_queue, | ||
writer_dq=writer_dq, | ||
feat_nevents=feat_nevents, | ||
write_threshold=500, | ||
) | ||
collector_process.start() | ||
collector_process.join() |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# flake8: noqa: F401 | ||
from .deque_writer_thread import DequeWriterThread | ||
from .queue_collector_thread import EventStash, QueueCollectorThread | ||
from .queue_collector_base import EventStash, QueueCollectorThread, QueueCollectorProcess | ||
from .writer import ( | ||
HDF5Writer, copy_basins, copy_features, copy_metadata, create_with_basins, | ||
set_default_filter_kwargs) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing here? @Orange99