Update to VC generator in pulse design tool - #89
Conversation
…e into streamlining
…e into streamlining
|
Need to add or modify example notebook to provide example on how to use it. |
…n, rather than dictionary, to match more closely syntax in calculate_VC
…le using VCGenerator
…th user provided dict. Defaults to zero drives
|
PR looks good so far - I've currently only tested the 'generate_fixed_schedule' in the Example11 notebook. Couple of things I changed to streamline:
Will check other parts later... |
…khonov regularisation feature
…oss/freegsnke into 86-update-vc-generator
|
The Tikhonov regularisation for the VC calculations looks great! I made a few adjustments in virtual_circuits.py:
|
|
Things that still need checking:
|
|
In response to the comments above,
I've added an example notebook to demonstrate this and the simulation looks to be successful. |
Choice of coils/targets for calculation are now specified when initialising the VCGenerator Update associated variable names update VirtualCircuitProvider base class update example 11b notebook to show new api
|
…ctrl that were set when initialising the class
|
Ok so after some more streamlining of the inputs to the VC generators, we can successfully call them during an FPDT simulation to update VCs on-the-fly (i.e. calculate new VCs every now and again using FreeGSNKE's in-built methods). Last thing to check will be to see if this all works when we replace the VC generator with one built from the emulated VCs. Maybe @alasdairross you can check this on your end? Hopefully should be smooth but let me know if not... |
|
I've run the notebook with a VC generator with the neural net emulators to recompute VC's during a simulation, and that runs successfully now as well. |
|
Great, I've also checked and the emulated VCs runs on my side too! Barring any other comments, I'm happy to run the tests and merge. |
This PR contains updates to Virtual Circuit generation for use in the pulse design tool. It fixes code in the vc_provider.py module in the control_loop, as highlighted in #86.
There are two main updates contained in this PR :
Tikhonov inversion
By default the Moore-Penrose is used as previously, and there is an optional argument to provide an array or diagonal matrix to define the Lambda regularisation terms (see https://en.wikipedia.org/wiki/Ridge_regression for example)
The main change is in the VirtualcCircuitHandlng in virtual_circuits.py where the new matrix inversion is done.
The following methods now have an optional tikhonov_lambda argument
VC provider
The vc_provider.py module contains a class
VCGeneratorwhich can interface with the PCS class (PCS(...,vc_generator = ,..))PCS(...,circuits_data = , ...))The example notebook
example11 - pulse_design_tool.ipynbhas been updated to demonstrate these new functionalities.