Skip to content

Commit

Permalink
rm sdcard formats
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Nov 12, 2024
1 parent 4792285 commit 3a62e2a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 67 deletions.
4 changes: 0 additions & 4 deletions miniscope_io/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
that describe fixed per-device configurations for the generic config
models in :mod:`~.miniscope_io.models.stream` et al.
"""

from miniscope_io.formats.sdcard import WireFreeSDLayout, WireFreeSDLayout_Battery

__all__ = ["WireFreeSDLayout", "WireFreeSDLayout_Battery"]
51 changes: 0 additions & 51 deletions miniscope_io/formats/sdcard.py

This file was deleted.

12 changes: 6 additions & 6 deletions notebooks/Wire-Free-DAQ.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@
"ename": "ValueError",
"evalue": "read length must be non-negative or -1",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-12-6f1c87781fe0>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m5000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[0mdataHeader\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfromstring\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0muint32\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[0mdataHeader\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataHeader\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfromstring\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataHeader\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mBUFFER_HEADER_HEADER_LENGTH_POS\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m-\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m*\u001b[0m \u001b[1;36m4\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0muint32\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 10\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdataHeader\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mValueError\u001b[0m: read length must be non-negative or -1"
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mValueError\u001B[0m Traceback (most recent call last)",
"\u001B[1;32m<ipython-input-12-6f1c87781fe0>\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[0;32m 7\u001B[0m \u001B[1;32mfor\u001B[0m \u001B[0mi\u001B[0m \u001B[1;32min\u001B[0m \u001B[0mrange\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;36m5000\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 8\u001B[0m \u001B[0mdataHeader\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mnp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mfromstring\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mf\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mread\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;36m4\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mdtype\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mnp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0muint32\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m----> 9\u001B[1;33m \u001B[0mdataHeader\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mnp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mappend\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mdataHeader\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mnp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mfromstring\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mf\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mread\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mdataHeader\u001B[0m\u001B[1;33m[\u001B[0m\u001B[0mBUFFER_HEADER_HEADER_LENGTH_POS\u001B[0m\u001B[1;33m]\u001B[0m \u001B[1;33m-\u001B[0m \u001B[1;36m1\u001B[0m\u001B[1;33m)\u001B[0m \u001B[1;33m*\u001B[0m \u001B[1;36m4\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mdtype\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mnp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0muint32\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 10\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 11\u001B[0m \u001B[0mprint\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mdataHeader\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n",
"\u001B[1;31mValueError\u001B[0m: read length must be non-negative or -1"
]
}
],
Expand Down Expand Up @@ -239,7 +239,7 @@
"outputs": [],
"source": [
"# Delete data from SD Card\n",
"f.seek(ataStartSector * sectorSize, 0)\n",
"f.seek(dataStartSector * sectorSize, 0)\n",
"\n",
"zeros = []\n",
"for i in range(512):\n",
Expand All @@ -249,4 +249,4 @@
]
}
]
}
}
6 changes: 2 additions & 4 deletions notebooks/grab_frames.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"from miniscope_io.io import SDCard\n",
"from miniscope_io.formats import WireFreeSDLayout"
"from miniscope_io.models.sdcard import SDLayout"
]
},
{
Expand Down Expand Up @@ -100,9 +100,7 @@
]
}
],
"source": [
"pprint(WireFreeSDLayout.dict(), sort_dicts=False)"
]
"source": "pprint(SDLayout.from_id('wirefree-sd-layout'), sort_dicts=False)"
},
{
"cell_type": "markdown",
Expand Down
3 changes: 1 addition & 2 deletions tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import json
import importlib

from miniscope_io.formats import WireFreeSDLayout
from miniscope_io.models.sdcard import SDLayout


# More formats can be added here as needed.
@pytest.mark.parametrize("format", [WireFreeSDLayout])
@pytest.mark.parametrize("format", [SDLayout.from_id("wirefree-sd-layout")])
def test_to_from_json(format):
"""
A format can be exported and re-imported from JSON and remain equivalent
Expand Down

0 comments on commit 3a62e2a

Please sign in to comment.