jcouto / wfield

Tools to process widefield data
GNU General Public License v3.0
13 stars 14 forks source link

NameError: name 'fname_mj2' is not defined when running wfield locally and on ncaas #8

Closed acbandi closed 2 years ago

acbandi commented 2 years ago

Hello,

When running wfield preprocess on a folder with .dat files (single channel blue recordings) I am consistently getting this error:

Parsing files to access the stack size: 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Runyan1\Miniconda3\Scripts\wfield.exe__main.py", line 7, in File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 563, in main CLIParser() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 58, in init__ getattr(self, args.command)() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 179, in open_raw dat = load_stack(args.foldername, nchannels = args.nchannels) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 785, in load_stack return ImagerStack(foldername, imager_preview = imager_preview) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 541, in init ch1,ch2,info = _imager_parse_file(f,version = self.version) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 226, in _imager_parse_file idxch1,idxch2,info = _imager_split_channels(stack,analog,analogheader,version = version) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 275, in _imager_split_channels print('Could not parse {0}'.format(fname_mj2)) NameError: name 'fname_mj2' is not defined

I'm not sure why this error keeps occurring. I get a similar error when trying to run the processing of these files on NCAAS.

acbandi commented 2 years ago

after some more testing it seems that wfield is only taking .tif files and is not reading .dat files (recorded from WidefielfImager)

jcouto commented 2 years ago

Thanks for reporting this. It seems that it is because of the single channel format and only an issue for files from the WidefieldImager, let me run through some single channel data recorded with the imager and get back to you.

acbandi213 commented 2 years ago

sounds good, thanks!

jcouto commented 2 years ago

Hi, could you try on the most current version please? Let me know if you need help installing pip install wfield --upgrade should do the trick. I'll update on neurocaas once this works well here.

acbandi213 commented 2 years ago

Hi! I tried pip install wfield --upgrade and got these errors:

Collecting wfield Using cached wfield-0.3.1.tar.gz (77 kB) ERROR: Command errored out with exit status 1: command: 'C:\Users\Runyan1\Miniconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_cdf099c60c544a828b3c92404cb0576d\setup.py'"'"'; file='"'"'C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_cdf099c60c544a828b3c92404cb0576d\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Runyan1\AppData\Local\Temp\pip-pip-egg-info-0lg1dgrl' cwd: C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_cdf099c60c544a828b3c92404cb0576d\ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_cdf099c60c544a828b3c92404cb0576d\setup.py", line 32, in with open("requirements.txt","r") as f: FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'

WARNING: Discarding https://files.pythonhosted.org/packages/6f/dc/ec99beab7bed1deee538cc8344c9021aee6e849a7ad110aa58ae0b973bd4/wfield-0.3.1.tar.gz#sha256=f4ff3626b80e0d4b4cca8c6491b129a4aa8442a258057625047700152b073e19 (from https://pypi.org/simple/wfield/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached wfield-0.3.0.tar.gz (77 kB) ERROR: Command errored out with exit status 1: command: 'C:\Users\Runyan1\Miniconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_37a2aa30412145c8bd6b0c4a4be37449\setup.py'"'"'; file='"'"'C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_37a2aa30412145c8bd6b0c4a4be37449\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Runyan1\AppData\Local\Temp\pip-pip-egg-info-3dx6z0dt' cwd: C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_37a2aa30412145c8bd6b0c4a4be37449\ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "C:\Users\Runyan1\AppData\Local\Temp\pip-install-0s8b59wx\wfield_37a2aa30412145c8bd6b0c4a4be37449\setup.py", line 32, in with open("requirements.txt","r") as f: FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'

WARNING: Discarding https://files.pythonhosted.org/packages/0c/b2/90b2e1248104e12bc56071bed63cb06cd4c11af92b3853c84835db72fa20/wfield-0.3.0.tar.gz#sha256=dc1ab18ed409b877d18138de433f662a2d691f0860645f6b656f286d7637661a (from https://pypi.org/simple/wfield/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Should I try installing fresh?

jcouto commented 2 years ago

Sorry something changed in the packaging and I broke it using outdated instructions. Could you please try again? It should be version 0.3.2

acbandi213 commented 2 years ago

thanks for the update - I was able to update to version 0.3.2. Unfortunately there is still an issue when running wfield preprocess on folders with only .dat files.

Here is an example error:

Traceback (most recent call last): File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Runyan1\Miniconda3\Scripts\wfield.exe__main.py", line 7, in File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 563, in main CLIParser() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 58, in init getattr(self, args.command)() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 375, in preprocess _motion(datadisk,outdisk = localdisk, File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 471, in _motion dat = load_stack(localdisk, nchannels = nchannels) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 812, in load_stack return ImagerStack(foldername, imager_preview = imager_preview) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 539, in init__ raise('Could not find files.') TypeError: exceptions must derive from BaseException

jcouto commented 2 years ago

I see, sorry for that. I don't have access to a dataset I can try with this from here and used one with mj2. Can you try upgrading to 0.3.3 one last time.

If it does not work this time: would you send me an example of the files, please? You could send the link to couto at ucla.edu

Thanks, I appreciate the help getting to the bottom of this.

acbandi213 commented 2 years ago

Updated to 0.3.3 and the files were parsed (and loaded?) this time but still had this error:

Parsing files to access the stack size: 0%| | 0/2 [00:00<?, ?it/s]Using imager version 1 (something strange with the wiring?) 0 2982.5 Parsing files to access the stack size: 50%|██████████████████████ | 1/2 [00:00<00:00, 5.60it/s]Using imager version 1 (something strange with the wiring?) 0 2982.5 Parsing files to access the stack size: 100%|████████████████████████████████████████████| 2/2 [00:00<00:00, 5.46it/s] Traceback (most recent call last): File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Runyan1\Miniconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Runyan1\Miniconda3\Scripts\wfield.exe__main.py", line 7, in File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 563, in main CLIParser() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 58, in init getattr(self, args.command)() File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 375, in preprocess _motion(datadisk,outdisk = localdisk, File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\cli.py", line 471, in _motion dat = load_stack(localdisk, nchannels = nchannels) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 812, in load_stack return ImagerStack(foldername, imager_preview = imager_preview) File "C:\Users\Runyan1\Miniconda3\lib\site-packages\wfield\io.py", line 572, in init__ self.dims[0] = self.nchannels TypeError: 'tuple' object does not support item assignment

The test files I collected are quite large (>4GB) so I send one via google drive to your email. Thanks for your help!

jcouto commented 2 years ago

Many thanks for your help. I updated on pip and github. Commit 5f1e107e3cc3f1b28ef21c5094132ef071c67a1e solves it. We'll update the version on neurocaas to handle single channel data recorded with the WidefieldImager soon.