Is there a way to save all the intermediate control fields in an optimization?

16 views
Skip to first unread message

mathiasca...@gmail.com

unread,
Jul 7, 2017, 11:03:32 AM7/7/17
to QuTiP: Quantum Toolbox in Python
Hi there!

say im using optimize.pulse.unitary from the control.pulseoptim package. The function only delivers the final optimized control amplitudes (apart from the initial seed). I'd like to get the full path of the optimization, thats to say, each iteration's control field amplitudes. Any ideas? 

thanks!

Martin

Alex Pitchford

unread,
Jul 7, 2017, 1:34:27 PM7/7/17
to qu...@googlegroups.com
Hi Martin,
Yes, you can dump and awful lot of stuff out during the optimisation. I don't think we have a notebook example, but I do have an example:
I think this will do what you want. Probably too much, but you should be able to work out how to turn off what you don't want.

Have a look under the Optimizer and Dynamics classes in:

Note the 'dump_to_file' option write to the filesystem during the optimisation, which will slow things down. So if only want to review after, then writeout afterwards. There are a lot of configuration options. Let me know if you need more explanation.

All the best with it.

Alex

--
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.

Martin Larocca

unread,
Jul 11, 2017, 2:50:06 PM7/11/17
to QuTiP: Quantum Toolbox in Python
Alex,

Thank you so much for your quick reply. Im really sorry to bother you again... with the dyn.dump.writeout and dyn.dump.writeout im getting beautiful text files with lots of information, fidelities and the gradients for each call...but not the control amplitudes. I am not being able to find out how to ask for them.
Also, in the Control optimisation stats, i get the "Number of control amplitude updates", the "Mean number of updates per iteration" and other stats, but again i cant figure out where to get the full information about those updates (Im studying the control landscape and i want to "measure" the lenght of the control path up the landscape)

Thanks again for your help

Martin

Alex Pitchford

unread,
Jul 13, 2017, 10:55:11 AM7/13/17
to qu...@googlegroups.com
Martin,
Sorry for the delay. 

If in the example I pointed you to you set:
dyn_params={'dumping':'FULL'

(that is changing from 'SUMMARY')
then you will get a LOT more files.

If you are wishing to do some calculation calculation using the amp values, then you would be better to access the dumped objects directly. You will find that the dyn.dump object has an attrib evo_dumps that is a list of EvoCompDumpItem. One is add each time the time evolution is calculated. There may be more than one per iteration. In the optim dump summary there is attrib for the iteration item fid_func_call_num that points to the time evolution calculation in that iteration. The EvoCompDumpItem has a property ctrl_amps, which is the array of amps used in that  time evolution calculation. Looking through the code in qutip/control/dump.py may help.

I have put up another example to illustrate this:

I hope this is what you are looking.

Alex


--

Alex Pitchford

unread,
Jul 13, 2017, 11:11:02 AM7/13/17
to qu...@googlegroups.com
PS just in case it was not clear. You do not have to write out all the files to use the data. It will be more efficient if you don't write out the files.

Martin Larocca

unread,
Jul 17, 2017, 2:49:19 PM7/17/17
to qu...@googlegroups.com
Alex, thank you so much. Thats exactly what i was looking for!! This is of great importance for my graduate thesis work, i am really thankful! 

You received this message because you are subscribed to a topic in the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qutip/_7KsSbvBmFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qutip+unsubscribe@googlegroups.com.

Alex Pitchford

unread,
Jul 21, 2017, 8:42:49 AM7/21/17
to qu...@googlegroups.com
Great. I am very pleased that the work I put into the data dumping has proved useful for someone else. You might be the only person to use yet except me :)

Don't forget to give us a mention in your bibliography

All the best with your thesis


Martin Larocca

unread,
Jul 21, 2017, 10:46:29 AM7/21/17
to qu...@googlegroups.com
Of course not. And if this work is ever published, i will acknlwledge your help!

Thanks!
Reply all
Reply to author
Forward
0 new messages