Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with running the example spike inference code #219

Open
vjlbym opened this issue Jul 28, 2016 · 2 comments
Open

Issue with running the example spike inference code #219

vjlbym opened this issue Jul 28, 2016 · 2 comments

Comments

@vjlbym
Copy link
Contributor

vjlbym commented Jul 28, 2016

Hey guys,

I was trying to get the spike inference example working and it was giving me a bunch of errors. The version as is gave me a TypeError: object of type 'numpy.float64' has no len(). This seemed to be because the code was expecting a 2d array here. I tried putting the argument inside a list and that error went away but then a bunch of other errors popped up. I didn't want to post all the errors here since it is easily reproducible. I tried to work through them all but the final output I got made no sense as I just got no spikes detected. Could you please help me with it?

Thanks a lot!
Vijay

@pkaifosh
Copy link
Member

pkaifosh commented Aug 7, 2016

Do these changes work for you?

 # Jointly estimate gamma on traces concatenated together
 [joint_gamma_est, joint_sigma_est] = spikes.estimate_parameters(
-    FLUORS.reshape(FLUORS.size), mode="correct")
+    FLUORS, mode="correct")

 for x in range(NTRACE):

     # Estimate noise and decay parameters
     [gamma_est, sigma_est] = spikes.estimate_parameters(
-        FLUORS[x, ], mode="correct", gamma=joint_gamma_est)
+        [FLUORS[x]], mode="correct", gamma=joint_gamma_est)
     print("tau = {tau},  sigma = {sigma}".format(
         tau=DELTAT / (1 - gamma_est), sigma=sigma_est))

@vjlbym
Copy link
Contributor Author

vjlbym commented Aug 8, 2016

Thanks @pkaifosh

That did solve the issue I raised. However, I now have a different problem, associated with MOSEK. I had installed it after I had the previous issues. So I don't know if this is a new issue; it likely is.

Line 67 now gives the following error that looks like some missing setting for MOSEK based on their error codes. Do you know how I can fix it? Thanks again!

---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
<ipython-input-1-6ea570844390> in <module>()
     69     # Run spike inference
     70     INFERENCE[:, x], FITS[:, x], params = spikes.spike_inference(
---> 71         FLUORS[x, ], sigma=sigma_est, gamma=joint_gamma_est, verbose=True)
     72 
     73 #########

/home/stuberlab/anaconda/lib/python2.7/site-packages/sima/spikes.pyc in spike_inference(fluor, sigma, gamma, mode, ar_order, psd_opts, verbose)
    263     start_time = time.time()
    264     try:
--> 265         prob.solve(solver='mosek', verbose=False)
    266     except ImportError:
    267         warn('MOSEK is not installed. Spike inference may be VERY slow!')

/home/stuberlab/anaconda/lib/python2.7/site-packages/picos/problem.pyc in solve(self, **options)
   4566                         or self.options['solver'] == 'mosek6'):
   4567 
-> 4568                     primals, duals, obj, sol = self._mosek_solve()
   4569 
   4570                 # for scip

/home/stuberlab/anaconda/lib/python2.7/site-packages/picos/problem.pyc in _mosek_solve(self)
   5938 
   5939         if version7:
-> 5940             solsta = task.getsolsta(soltype)
   5941         else:
   5942             [prosta, solsta] = task.getsolutionstatus(soltype)

/home/stuberlab/anaconda/lib/python2.7/site-packages/mosek/__init__.pyc in accept(*args)
    205                 raise TypeError('Expected %d argument(s) (%d given)' % (len(argtlst), len(args)))
    206             try:
--> 207                 return fun(*[ t(a) for (t,a) in zip(argtlst,args) ])
    208             except TypeAcceptError, e:
    209                 raise TypeError(e)

/home/stuberlab/anaconda/lib/python2.7/site-packages/mosek/__init__.pyc in getsolsta(self, whichsol_)
   5415     if res != 0:
   5416       _,msg = self.__getlasterror(res)
-> 5417       raise Error(rescode(res),msg)
   5418     _solsta_return_value = solsta(solsta_.value)
   5419     return (_solsta_return_value)

Error: (1265) The solution with code 0 is not defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants