Aharoni-Lab / miniscope-io

Data formatting, reading, and writing from miniscopes
https://miniscope-io.readthedocs.io
GNU Affero General Public License v3.0
6 stars 2 forks source link

running stream_daq in miniscope-io #22

Closed MarcelMB closed 2 months ago

MarcelMB commented 2 months ago

I have done all the poetry environment setup and trying to run the stream_daq but always running into an error that looks like this.

(miniscope-io-py3.11) mbrosch@RELMNGYFAC31424 miniscope_io % python stream_daq.py --config data/configs/WLMS_v02_200px.yml

Traceback (most recent call last): File "/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/stream_daq.py", line 1, in import argparse File "/Users/mbrosch/anaconda3/lib/python3.11/argparse.py", line 89, in import re as _re File "/Users/mbrosch/anaconda3/lib/python3.11/re/init.py", line 124, in import enum File "/Users/mbrosch/anaconda3/lib/python3.11/enum.py", line 3, in from types import MappingProxyType, DynamicClassAttribute File "/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/types.py", line 5, in from typing import Tuple, Union File "/Users/mbrosch/anaconda3/lib/python3.11/typing.py", line 26, in import contextlib File "/Users/mbrosch/anaconda3/lib/python3.11/contextlib.py", line 7, in from functools import wraps File "/Users/mbrosch/anaconda3/lib/python3.11/functools.py", line 22, in from types import GenericAlias ImportError: cannot import name 'GenericAlias' from partially initialized module 'types' (most likely due to a circular import) (/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/types.py)

sneakers-the-rat commented 2 months ago

Fascinating. Circular import in the builtins... not sure what thats about but ill try and diagnose

sneakers-the-rat commented 2 months ago

Oh yeah - you cant just run it as a file, this is a python package not a script. Use the entrypoint streamDaq or run as module python -m miniscope_io.stream_daq

sneakers-the-rat commented 2 months ago

Sry may have closed prematurely. Reopen if still problem

MarcelMB commented 2 months ago

Thank you. I am running it as a module now and fixed a path in my virtual environment that was wrong. But getting this and not sure why?

(miniscope-io-py3.11) (base) mbrosch@RELMNGYFAC31424 miniscope-io % python -m miniscope_io.stream_daq --config miniscope_io/data/config/WLMS_v02_200px.yml

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/stream_daq.py", line 589, in main() File "/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/stream_daq.py", line 585, in main daq_inst.capture(source="fpga", config = daqConfig) File "/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/stream_daq.py", line 475, in capture imagearray.put(np.zeros(int(self.frame_width * self.frame_height), np.uint8)) ^^^^^^^^^^^^^^^^ AttributeError: 'StreamDaq' object has no attribute 'frame_width'

MarcelMB commented 2 months ago

the help seems to work fine

(miniscope-io-py3.11) (base) mbrosch@RELMNGYFAC31424 miniscope-io % python -m miniscope_io.stream_daq --help
usage: stream_image_capture [-h] [-c CONFIG]

options: -h, --help show this help message and exit -c CONFIG, --config CONFIG YAML config file path: string

MarcelMB commented 2 months ago

reopened it @sneakers-the-rat

MarcelMB commented 2 months ago

but I think I am close (miniscope-io-py3.11) (base) mbrosch@RELMNGYFAC31424 miniscope-io % python -m miniscope_io.stream_daq --config miniscope_io/data/config/example.yml

Configuration loaded: device='OK' bitstream=PosixPath('/Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/devices/USBInterface-6mhz-3v3-INVERSE.bit') port=None baudrate=None frame_width=304 frame_height=304 preamble=b'\x124Vx' header_len=12 pix_depth=8 buffer_block_length=40 block_size=512 num_buffers=8 LSB=True
Connected to XEM7310-A75
Succesfully uploaded /Users/mbrosch/Documents/GitKraken_mac/miniscope-io/miniscope_io/devices/USBInterface-6mhz-3v3-INVERSE.bit
FrontPanel is supported
Process Process-2:

AttributeError: 'BitStore' object has no attribute 'modified' just having an issue with bitstring for some reason

sneakers-the-rat commented 2 months ago

AttributeError: 'StreamDaq' object has no attribute 'frame_width'

See the discussion in the PR, replaced all those implicit attr assignments with calls to self.config.frame_height etc. Must have missed some. This is why we made that change, so static analysis tools can detect when we are trying to access attributes that dont exist.

AttributeError: 'BitStore' object has no attribute 'modified'

Plz include the full traceback bc I dont know where that is being accessed