Skip to content

Commit

Permalink
cleanup older impls
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Nov 16, 2024
1 parent 8333a5f commit e8aee8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 3 additions & 7 deletions miniscope_io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from miniscope_io.logging import init_logger
from miniscope_io.models.data import Frame
from miniscope_io.models.sdcard import SDBufferHeader, SDConfig, SDLayout
from miniscope_io.types import ConfigSource


class BufferedCSVWriter:
Expand Down Expand Up @@ -105,15 +106,10 @@ class SDCard:
"""

def __init__(
self, drive: Union[str, Path], layout: Union[SDLayout, str] = "wirefree-sd-layout"
self, drive: Union[str, Path], layout: Union[SDLayout, ConfigSource] = "wirefree-sd-layout"
):
self.drive = drive
if isinstance(layout, str):
self.layout = SDLayout.from_id(layout)
elif isinstance(layout, SDLayout):
self.layout = layout
else:
raise TypeError("layout must be either a layout config id or a SDLayout")
self.layout = SDLayout.from_any(layout)
self.logger = init_logger("SDCard")

# Private attributes used when the file reading context is entered
Expand Down
7 changes: 1 addition & 6 deletions miniscope_io/models/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from collections.abc import Sequence
from typing import Type, TypeVar

from miniscope_io.logging import init_logger
from miniscope_io.models import Container, MiniscopeConfig
from miniscope_io.models.mixins import ConfigYAMLMixin

Expand Down Expand Up @@ -90,11 +89,7 @@ def from_format(
header_data = dict()
for hd, header_index in format.model_dump(exclude=set(format.HEADER_FIELDS)).items():
if header_index is not None:
try:
header_data[hd] = vals[header_index]
except IndexError:
init_logger("BufferHeader").exception(f"{header_index}")
raise
header_data[hd] = vals[header_index]

if construct:
return cls.model_construct(**header_data)
Expand Down

0 comments on commit e8aee8c

Please sign in to comment.