Skip to content

Commit

Permalink
Merge branch 'gui' into liz_gui
Browse files Browse the repository at this point in the history
  • Loading branch information
toni-neurosc authored Sep 22, 2024
2 parents e523c4a + 50e3527 commit 1a4e4d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 4 additions & 5 deletions py_neuromodulation/gui/backend/app_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ def __init__(

def push_features_to_frontend(self, feature_queue: Queue) -> None:
while True:
time.sleep(
0.002
) # NOTE: This should be adapted depending on the feature sampling rate
time.sleep(0.002) # NOTE: should be adapted depending on feature sampling rate
if feature_queue.empty() is False:
self.logger.info("data in feature queue")

features = feature_queue.get()

self.logger.info(f"Sending features: {features}")
Expand Down Expand Up @@ -125,7 +122,7 @@ async def handle_stream_control(data: dict):
experiment_name=data["experiment_name"],
websocket_manager_features=self.websocket_manager_features,
)

# this also fails due to pickling error
# self.push_features_process = Process(
# target=self.push_features_to_frontend,
Expand Down Expand Up @@ -391,3 +388,5 @@ async def websocket_endpoint(websocket: WebSocket):
# # Serve the index.html for any path that doesn't match an API route
# print(Path.cwd())
# return FileResponse("frontend/index.html")


3 changes: 3 additions & 0 deletions py_neuromodulation/gui/backend/app_pynm.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ async def start_run_function(
else "",
websocket_featues=websocket_manager_features,
)

# self.logger.info("initialized run process")

# self.run_process.start()
Expand All @@ -68,6 +69,7 @@ async def start_run_function(
# time.sleep(2)
# self.logger.info(f"Stream running: {self.stream.is_running}")


def setup_lsl_stream(
self,
lsl_stream_name: str | None = None,
Expand Down Expand Up @@ -152,3 +154,4 @@ def setup_offline_stream(
line_noise=line_noise,
sampling_rate_features_hz=sampling_rate_features,
)

1 change: 1 addition & 0 deletions py_neuromodulation/stream/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ async def run(

# if self.feature_queue is not None:
# self.feature_queue.put(feature_dict)

if websocket_featues is not None:
await websocket_featues.send_message(feature_dict)
self.batch_count += 1
Expand Down

0 comments on commit 1a4e4d6

Please sign in to comment.