-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vilim
committed
Jan 23, 2022
1 parent
3439e78
commit eb18b54
Showing
7 changed files
with
86 additions
and
50 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
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
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,29 @@ | ||
from multiprocessing import Event, Process | ||
from typing import Type | ||
|
||
from stytra.collectors import QueueDataAccumulator | ||
from stytra.collectors.namedtuplequeue import NamedTupleQueue | ||
from stytra.stimulation.estimators import Estimator | ||
|
||
|
||
class EstimatorProcess(Process): | ||
def __init__( | ||
self, | ||
estimator_cls: Type[Estimator], | ||
tracking_queue: NamedTupleQueue, | ||
finished_signal: Event, | ||
): | ||
super().__init__() | ||
self.tracking_queue = tracking_queue | ||
self.tracking_output_queue = NamedTupleQueue() | ||
self.estimator_queue = NamedTupleQueue() | ||
self.tracking_accumulator = QueueDataAccumulator(self.tracking_queue, self.tracking_output_queue) | ||
self.finished_signal = finished_signal | ||
self.estimator_cls = estimator_cls | ||
|
||
def run(self): | ||
estimator = self.estimator_cls(self.tracking_accumulator, self.estimator_queue) | ||
|
||
while not self.finished_signal.is_set(): | ||
self.tracking_accumulator.update_list() | ||
estimator.update() |
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