PeyracheLab / miniscoPy

A package to analyse calcium imaging data recorded with the Miniscope.
GNU General Public License v2.0
32 stars 9 forks source link

ValueError: Buffer dtype mismatch, expected 'DOUBLE' but got 'float' #25

Closed AmazingAng closed 3 years ago

AmazingAng commented 3 years ago

Hello, I try to run the following code and met following error when RUNNING CNMF-E: cnm.fit(procs) Basically it says the input data type is float, while the oasis needs double. Where should I change? Thanks in advance:

Log:

D:\Research\exploration in maze\code\miniscoPy-master\miniscopy\cnmf_e\deconvolution.py in constrained_foopsi(fluor, bl, c1, g, sn, p, method, bas_nonneg, noise_range, noise_method, lags, fudge_factor, verbosity, solvers, optimize_g, penalty, **kwargs) 147 # Solves the noise constrained sparse non-negative deconvolution problem 148 # min |s|_1 subject to |c-y|^2 = sn^2 T and s_t = ct-g c{t-1} >= 0 --> 149 c, sp, bl, g, lam = constrained_oasisAR1(fluor.astype(np.float32), g[0], sn, optimize_b=True, b_nonneg=bas_nonneg,optimize_g=optimizeg, penalty=penalty) 150 else: 151 c, sp, , g, lam = constrained_oasisAR1((fluor - bl).astype(np.float32), g[0], sn, optimize_b=False, penalty=penalty)

D:\Research\exploration in maze\code\miniscoPy-master\oasis\oasis_methods.pyx in oasis.oasis_methods.constrained_oasisAR1() 99 100 @cython.cdivision(True) --> 101 def constrained_oasisAR1(np.ndarray[DOUBLE, ndim=1] y, DOUBLE g, DOUBLE sn, 102 bool optimize_b=False, bool b_nonneg=True, int optimize_g=0, 103 int decimate=1, int max_iter=5, int penalty=1):

ValueError: Buffer dtype mismatch, expected 'DOUBLE' but got 'float'

gviejo commented 3 years ago

Helllo I am not sure what the error is. Unfortunately, I don't have time to maintain this package right now. I suggest you to use Caiman. If you still want to give a try, you can check the package version I use in my conda environment. I suspect it's a package version issue.

packages in environment at /home/guillaume/anaconda3/envs/miniscopy:

#

Name Version Build Channel

_libgcc_mutex 0.1 main
av 8.0.2 py38h497d03b_4 conda-forge backcall 0.2.0 py_0
blas 1.0 mkl
bzip2 1.0.8 h516909a_3 conda-forge ca-certificates 2021.1.19 h06a4308_1
cairo 1.16.0 h9f066cc_1006 conda-forge certifi 2020.12.5 py38h06a4308_0
cloudpickle 1.6.0 py_0
cudatoolkit 10.1.243 h6bb024c_0
cudnn 7.6.5 cuda10.1_0
cupy 8.3.0 py38hcaf9a05_0
cycler 0.10.0 py38_0
cython 0.29.21 py38h2531618_0
cytoolz 0.11.0 py38h7b6447c_0
dask-core 2.30.0 py_0
dbus 1.13.18 hb2f20db_0
decorator 4.4.2 py_0
expat 2.2.10 he6710b0_2
fastrlock 0.5 py38he6710b0_0
ffmpeg 4.3.1 h3215721_1 conda-forge fontconfig 2.13.1 h7e3eb15_1002 conda-forge freetype 2.10.4 h5ab3b9f_0
future 0.18.2 py38_1
gettext 0.19.8.1 hf34092f_1004 conda-forge glib 2.66.2 h58526e2_0 conda-forge gmp 6.2.0 h58526e2_4 conda-forge gnutls 3.6.13 h85f3911_1 conda-forge graphite2 1.3.13 h58526e2_1001 conda-forge gst-plugins-base 1.14.5 h0935bb2_2 conda-forge gstreamer 1.14.5 h36ae1b5_2 conda-forge h5py 2.10.0 py38hd6299e0_1
harfbuzz 2.7.2 ha5b49bf_1 conda-forge hdf5 1.10.6 hb1b8bf9_0
icu 67.1 he1b5a44_0 conda-forge imageio 2.9.0 py_0
intel-openmp 2020.2 254
ipython 7.19.0 py38hb070fc8_0
ipython_genutils 0.2.0 py38_0
jasper 1.900.1 h07fcdf6_1006 conda-forge jedi 0.17.2 py38_0
joblib 0.17.0 py_0
jpeg 9d h36c2ea0_0 conda-forge kiwisolver 1.3.0 py38h2531618_0
krb5 1.17.2 h926e7f8_0 conda-forge lame 3.100 h14c3975_1001 conda-forge lcms2 2.11 h396b838_0
ld_impl_linux-64 2.33.1 h53a641e_7
libblas 3.8.0 21_mkl conda-forge libcblas 3.8.0 21_mkl conda-forge libclang 10.0.1 default_hde54327_1 conda-forge libedit 3.1.20191231 h14c3975_1
libevent 2.1.10 hcdb4288_3 conda-forge libffi 3.2.1 he1b5a44_1007 conda-forge libgcc-ng 9.1.0 hdf63c60_0
libgfortran-ng 7.3.0 hdf63c60_0
libglib 2.66.2 hbe7bbb4_0 conda-forge libiconv 1.16 h516909a_0 conda-forge liblapack 3.8.0 21_mkl conda-forge liblapacke 3.8.0 21_mkl conda-forge libllvm10 10.0.1 he513fc3_3 conda-forge libopencv 4.5.0 py38_3 conda-forge libpng 1.6.37 hbc83047_0
libpq 12.3 h5513abc_2 conda-forge libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.1.0 h2733197_1
libuuid 2.32.1 h14c3975_1000 conda-forge libwebp-base 1.1.0 h36c2ea0_3 conda-forge libxcb 1.14 h7b6447c_0
libxkbcommon 0.10.0 he1b5a44_0 conda-forge libxml2 2.9.10 h68273f3_2 conda-forge llvmlite 0.35.0 py38h612dafd_4
lz4-c 1.9.2 heb0550a_3
matplotlib 3.3.2 0
matplotlib-base 3.3.2 py38h817c723_0
mkl 2020.2 256
mkl-service 2.3.0 py38he904b0f_0
mkl_fft 1.2.0 py38h23d657b_0
mkl_random 1.1.1 py38h0573a6f_0
mysql-common 8.0.21 2 conda-forge mysql-libs 8.0.21 hf3661c5_2 conda-forge nccl 2.8.3.1 hcaf9a05_0
ncurses 6.2 he6710b0_1
nettle 3.6 he412f7d_0 conda-forge networkx 2.5 py_0
nose 1.3.7 py38_2
nspr 4.29 he1b5a44_1 conda-forge nss 3.59 h2c00c37_0 conda-forge numba 0.52.0 py38ha9443f7_0
numpy 1.19.2 py38h54aff64_0
numpy-base 1.19.2 py38hfa32c7d_0
olefile 0.46 py_0
opencv 4.5.0 py38_3 conda-forge openh264 2.1.1 h8b12597_0 conda-forge openssl 1.1.1j h27cfd23_0
pandas 1.1.3 py38he6710b0_0
parso 0.7.0 py_0
pcre 8.44 he6710b0_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 py38_1000
pillow 8.0.1 py38he98fc37_0
pip 20.2.4 py38h06a4308_0
pixman 0.40.0 h36c2ea0_0 conda-forge prompt-toolkit 3.0.8 py_0
psutil 5.7.2 py38h7b6447c_0
ptyprocess 0.6.0 pyhd3eb1b0_2
py-opencv 4.5.0 py38h81c977d_3 conda-forge pycircstat 0.0.2 pypi_0 pypi pygments 2.7.2 pyhd3eb1b0_0
pyparsing 2.4.7 py_0
pyqt 5.12.3 py38ha8c2ead_4 conda-forge pyqt5-sip 4.19.18 pypi_0 pypi pyqtchart 5.12 pypi_0 pypi pyqtwebengine 5.12.1 pypi_0 pypi python 3.8.3 cpython_he5300dc_0 conda-forge python-dateutil 2.8.1 py_0
python_abi 3.8 1_cp38 conda-forge pytz 2020.1 py_0
pywavelets 1.1.1 py38h7b6447c_2
pyyaml 5.3.1 pypi_0 pypi qt 5.12.9 h1f2b2cb_0 conda-forge readline 8.0 h7b6447c_0
scikit-image 0.17.2 py38hdf5156a_0
scikit-learn 0.23.2 py38h0573a6f_0
scipy 1.5.2 py38h0b6359f_0
setuptools 50.3.1 py38h06a4308_1
sip 4.19.13 py38he6710b0_0
six 1.15.0 py38h06a4308_0
sqlite 3.33.0 h62c20be_0
tbb 2020.3 hfd86e86_0
threadpoolctl 2.1.0 pyh5ca1d4c_0
tifffile 2020.10.1 py38hdd07704_2
tk 8.6.10 hbc83047_0
toolz 0.11.1 py_0
tornado 6.0.4 py38h7b6447c_1
tqdm 4.51.0 pyhd3eb1b0_0
traitlets 5.0.5 py_0
wcwidth 0.2.5 py_0
wheel 0.35.1 pyhd3eb1b0_0
x264 1!152.20180806 h14c3975_0 conda-forge xorg-kbproto 1.0.7 h14c3975_1002 conda-forge xorg-libice 1.0.10 h516909a_0 conda-forge xorg-libsm 1.2.3 h84519dc_1000 conda-forge xorg-libx11 1.6.12 h516909a_0 conda-forge xorg-libxext 1.3.4 h516909a_0 conda-forge xorg-libxrender 0.9.10 h516909a_1002 conda-forge xorg-renderproto 0.11.1 h14c3975_1002 conda-forge xorg-xextproto 7.3.0 h14c3975_1002 conda-forge xorg-xproto 7.0.31 h14c3975_1007 conda-forge xz 5.2.5 h7b6447c_0
yaml 0.2.5 h7b6447c_0
zlib 1.2.11 h7b6447c_3
zstd 1.4.5 h9ceee32_0