Problems loading mcsolve data with qload()

40 views
Skip to first unread message

charli...@gmail.com

unread,
Nov 30, 2016, 12:57:47 AM11/30/16
to QuTiP: Quantum Toolbox in Python
Hi,

For a project I am doing I need to do a lot of post processing to some Monte-Carlo solver data so I would like to effectively use the qsave and qload functions to save time. Unfortunately, whenever I try to load some mcsolve data I get an error message of this flavour:

Traceback (most recent call last):

  File "<ipython-input-10-cecd0b87f144>", line 1, in <module>
    traj00 = qload('C:\\Users\\Charlie\\Documents\\Level4\\statesExp00')

  File "C:\Users\Charlie\Anaconda2\lib\site-packages\qutip\fileio.py", line 292, in qload
    print(out)

  File "C:\Users\Charlie\Anaconda2\lib\site-packages\qutip\solver.py", line 254, in __str__
    if self.states is not None and len(self.states) > 0:

TypeError: len() of unsized object 

I think this is to do with the fact that I have expectation operators defined for the trajectory as it seems to be having trouble with the fact that the .states list isn't there.

Is there a way of avoiding this error? I would much like to be able to work with this solver data without having to regenerate it every time I want to.

Thanks,

Charlie

ta95....@gmail.com

unread,
Jan 4, 2017, 2:54:51 PM1/4/17
to QuTiP: Quantum Toolbox in Python, charli...@gmail.com
Hi, I'm a beginner in qutip but I think I can help you if I have your qutip code.

Alex Pitchford

unread,
Jan 4, 2017, 9:06:01 PM1/4/17
to qu...@googlegroups.com, Charlie Derby
It seems a strange error. 
If you could post something that would reproduce the issue, as simple as possible, then we can try and investigate / fix.

On 5 January 2017 at 04:54, <ta95....@gmail.com> wrote:
Hi, I'm a beginner in qutip but I think I can help you if I have your qutip code.

--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mathieu.la...@gmail.com

unread,
Jul 17, 2017, 4:47:09 PM7/17/17
to QuTiP: Quantum Toolbox in Python, charli...@gmail.com
Hi,

Did you fix the problem by now? The same thing happens to me when I use qsave and qload with the output of mcsolve. Also, trying to print the output gives a similar error. Here's a small code reproducing the error,

In [1]: import qutip as qt

   ...: import numpy as np

   ...: 

   ...: a = qt.destroy(5)

   ...: ad = a.dag()

   ...: H = ad*a

   ...: psi0 = qt.basis(5,0)

   ...: 

   ...: res0 = qt.mcsolve(H,psi0, np.linspace(0,0.1,1000),[a],[a])

   ...: 


10.0%. Run time:   1.09s. Est. time left: 00:00:00:09

20.0%. Run time:   2.13s. Est. time left: 00:00:00:08

30.0%. Run time:   3.15s. Est. time left: 00:00:00:07

40.0%. Run time:   4.59s. Est. time left: 00:00:00:06

50.0%. Run time:   5.77s. Est. time left: 00:00:00:05

60.0%. Run time:   6.84s. Est. time left: 00:00:00:04

70.0%. Run time:   7.94s. Est. time left: 00:00:00:03

80.0%. Run time:   9.10s. Est. time left: 00:00:00:02

90.0%. Run time:  10.19s. Est. time left: 00:00:00:01

100.0%. Run time:  11.27s. Est. time left: 00:00:00:00

Total run time:  11.37s


In [3]: print(res0)

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-3-9ad991018175> in <module>()

----> 1 print(res0)


/Users/lacm2126/git/qutip/qutip/solver.py in __str__(self)

    272             s += "missing solver information.\n"

    273         s += "-" * (len(s) - 1) + "\n"

--> 274         if self.states is not None and len(self.states) > 0:

    275             s += "states = True\n"

    276         elif self.expect is not None and len(self.expect) > 0:

Reply all
Reply to author
Forward
0 new messages