Skip to content

Commit

Permalink
Refactored according to #293
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbhagatio committed Dec 4, 2023
1 parent 38d46c1 commit 967f322
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion aeon/dj_pipeline/acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd

from aeon.io import api as io_api
from aeon.schema import schemas as aeon_schema
from aeon.io.binder import schemas as aeon_schema
from aeon.io import reader as io_reader
from aeon.analysis import utils as analysis_utils

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion aeon/schema/foraging.py → aeon/io/binder/foraging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import aeon.io.device as _device
import aeon.io.reader as _reader
import aeon.schema.core as _stream
import aeon.io.binder.core as _stream


class Area(_Enum):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions aeon/schema/schemas.py → aeon/io/binder/schemas.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from dotmap import DotMap

import aeon.schema.core as stream
import aeon.io.binder.core as stream
from aeon.io.device import Device
from aeon.schema import foraging, octagon
from aeon.io.binder import foraging, octagon

exp02 = DotMap(
[
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions aeon/io/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

def compositeStream(pattern, *args):
"""Merges multiple data streams into a single composite stream."""
composite = {}
registry = {}
if args:
for stream in args:
if inspect.isclass(stream):
for method in vars(stream).values():
if isinstance(method, staticmethod):
composite.update(method.__func__(pattern))
registry.update(method.__func__(pattern))
else:
composite.update(stream(pattern))
return composite
registry.update(stream(pattern))
return registry


class Device:
Expand All @@ -31,11 +31,11 @@ class Device:

def __init__(self, name, *args, pattern=None):
self.name = name
self.stream = compositeStream(name if pattern is None else pattern, *args)
self.registry = compositeStream(name if pattern is None else pattern, *args)

def __iter__(self):
if len(self.stream) == 1:
singleton = self.stream.get(self.name, None)
if len(self.registry) == 1:
singleton = self.registry.get(self.name, None)
if singleton:
return iter((self.name, singleton))
return iter((self.name, self.stream))
return iter((self.name, self.registry))
2 changes: 1 addition & 1 deletion tests/io/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pytest import mark

import aeon
from aeon.schema.schemas import exp02
from aeon.io.binder.schemas import exp02

nonmonotonic_path = Path(__file__).parent.parent / "data" / "nonmonotonic"
monotonic_path = Path(__file__).parent.parent / "data" / "monotonic"
Expand Down

0 comments on commit 967f322

Please sign in to comment.