Giter Site home page Giter Site logo

zlatko-minev / pyepr Goto Github PK

View Code? Open in Web Editor NEW
159.0 159.0 218.0 3.91 MB

Powerful, automated analysis and design of quantum microwave chips & devices [Energy-Participation Ratio and more]

Home Page: https://pyepr-docs.readthedocs.io

License: Other

Python 99.68% TeX 0.32%
cqed hfss python quantization quantum quantum-circuit quantum-computing

pyepr's People

Contributors

alec-eickbusch avatar andersenqubitlab avatar asafdi avatar bguttel avatar clarayfontaine avatar danielcohenhillel avatar dwang429 avatar gyeonghunkim avatar hanheepaik avatar hatlabcz avatar jagandecapri avatar leghtas avatar marcolincs avatar mosandbe avatar nathanshammah avatar nikosavola avatar obrienpja avatar paniash avatar priti-ashvin-shah-ibm avatar ptruitt avatar qci-bishopvanhorn avatar qci-chou avatar qci-mundhada avatar sqclab avatar thomasgm4 avatar willsalmanj avatar wlivingston avatar wshanks avatar zachparrott avatar zlatko-minev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyepr's Issues

Add tests to the `tests` module

The tests module is pretty empty right now, we only test for very few things... Anyone who wants can add more tests, all you need is use case for the code and a way to check the results. If you want to give it a go, check out the tests folder. Good luck 🎉

If you do plan to contribute, please edit the develop branch and not master (use git to checkout to develop and do your edits there), it's not the end of the world if you commit directly to master but then it would be hard reviewing the code before uploading it for everyone to use.

Package name on PyPI does not match setup.py

In setup.py the package name is specified as "pyEPR" but the package on PyPI is named "pyEPR-quantum". This causes a problem for the conda packaging because conda uses setup.py to determine the name while pip uses the PyPI name. The result is that conda install pyepr-quantum followed by pip install pyEPR-quantum causes pip to overwrite the conda install and leaves pip freeze showing that both pyEPR and pyEPR-quantum are installed.

com_error: (-2147221005, 'Invalid class string', None, None) when connecting to Ansys Desktop

I just tried to set up pyEPR with Ansys on a new PC. Created a new environment and installed all required packages. Now, when I try to connect to Ansys with epr.ProjectInfo,
pinfo = epr.ProjectInfo(project_path = os.getcwd(),
project_name = 'TripleCats',)

it connects to Ansys and finds the correct file path, but then spits out this error

com_error                                 Traceback (most recent call last)
~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
     88                 try:
---> 89                         IDispatch = pythoncom.connect(IDispatch)
     90                 except pythoncom.ole_error:

com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

com_error                                 Traceback (most recent call last)
<ipython-input-3-f7191f53f00d> in <module>
----> 1 pinfo = epr.ProjectInfo(project_path = os.getcwd(), 
      2                          project_name = 'TripleCats',)

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in __init__(self, project_path, project_name, design_name, setup_name, do_connect)
    209 
    210         if do_connect:
--> 211             self.connect()
    212             self.dissipative['pinfo'] = self
    213 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in connect(self)
    343         """
    344 
--> 345         self.connect_project()
    346         if not self.project:
    347             logger.info('\tConnection to Ansys NOT established.  \n')

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\project_info.py in connect_project(self)
    239         logger.info('Connecting to Ansys Desktop API...')
    240 
--> 241         self.app, self.desktop, self.project = ansys.load_ansys_project(
    242             self.project_name, self.project_path)
    243 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\ansys.py in load_ansys_project(proj_name, project_path, extension)
   3092             )
   3093 
-> 3094     app = HfssApp()
   3095     logger.info("\tOpened Ansys App")
   3096 

~\anaconda3\envs\pyEPR\lib\site-packages\pyEPR\ansys.py in __init__(self, ProgID)
    379         '''
    380         super(HfssApp, self).__init__()
--> 381         self._app = Dispatch(ProgID)
    382 
    383     def get_app_desktop(self):

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\__init__.py in Dispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToString, clsctx)
     93   """
     94   assert UnicodeToString is None, "this is deprecated and will go away"
---> 95   dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
     96   return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
     97 

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
    112         else:
    113                 userName = str(userName)
--> 114         return (_GetGoodDispatch(IDispatch, clsctx), userName)
    115 
    116 def _GetDescInvokeType(entry, invoke_type):

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
     89                         IDispatch = pythoncom.connect(IDispatch)
     90                 except pythoncom.ole_error:
---> 91                         IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
     92         else:
     93                 # may already be a wrapped class.

com_error: (-2147221005, 'Invalid class string', None, None)

There was the same problem for the previous setup, which could be resolved by reinstalling everything from scratch. Ideas for an easier fix?

error when calling get_Qdielectric directly

If one wants to used DistributedAnalysis.get_Qdielectric (Q_surface, etc.), there is a problem in that self.U_E is not updated and might be from a different variation. Found when I ran do_EPR_analysis on several variations and then later tried to use get_Qdielectric on the first variation. Of course, self.U_E was still on the value from the last variation and I was getting a participation ratio above 1.

EPR Paper in presentation format: make more accessible.

Suggestion by Vadiraj:

"I saw the paper on arxiv. Congratulations! this is big.
As I was perusing the paper, I wondered if you had some plans of introducing these ideas in a more presentation like format? I guess these group meetings serve this goal?
I very much would like to learn the techniques and so I would appreciate if you can organize workshop like formats to make it more accessible.
I look forward to these meetings. Thank you for organizing them."

Error for running tutorial 2

For Tutorial 2: pyEPR/_tutorial_notebooks/Tutorial 2. Field calculations - dielectric energy participation ratios (EPRs).ipynb
It should be pyEPR.ansys instead of pyEPR.core, to import Calcobject.
Class Calcobject is defined in pyEPR.ansys.

Linear lumped inductors

Hey pyEPR team,

I've recently updated my pyEPR from the 2015 version to the most recent version. I've noticed you've removed the capability to define a lumped inductor to be linear if you don't want to perform an EPR analysis on it. Is there still a way to deal with linear lumped element inductors?

Setup unit tests

Setup unit test for pyEPR that can be run

Start with just basic functionality and loading

Ability to input junctions at `ProjectInfo` initialisation

Similarly to #103, I think junctions should be possible to give in ProjectInfo initialisation as arguments.
Doing

pinfo.junctions['jAlice'] = {'Lj_variable':'Lj_alice', 'rect':'rect_alice', 'line': 'line_alice', 'Cj_variable':'Cj_alice'}
pinfo.junctions['jBob']   = {'Lj_variable':'Lj_bob', 'rect':'rect_bob',  'line': 'line_bob', 'Cj_variable':'Cj_bob'}

feels similarly hacky to #102 (though maybe not as much).

A syntax with dictionary of dictionaries could be supported

junctions = {
    'jAlice': {'Lj_variable':'Lj_alice', 'rect':'rect_alice', 'line': 'line_alice', 'Cj_variable':'Cj_alice'},
    'jBob': {'Lj_variable':'Lj_bob', 'rect':'rect_bob',  'line': 'line_bob', 'Cj_variable':'Cj_bob'}
}
pinfo = epr.ProjectInfo(..., junctions=junctions)

In this case pinfo.validate_junction_info() could be called automatically and an Exception raised

Bug: Field calculator error when no variables in design

I noticed that (at least some) field calculator operations fail when there are no variables in the design. One can get around this by just adding a variable to the design and setting it to a constant value if you don't want/need to vary it, but this isn't obvious at first. I have not found a fix for this. Sample error shown below:

com_error Traceback (most recent call last)
in
----> 1 test.get_Qdielectric('Substrate', '0', '0')

~\code\pyEPR\pyEPR\core_distributed_analysis.py in get_Qdielectric(self, dielectric, mode, variation, U_E)
840 def get_Qdielectric(self, dielectric, mode, variation, U_E = None):
841 if U_E == None:
--> 842 U_E = self.calc_energy_electric(variation)
843 Qdielectric = OrderedDict()
844 print('Calculating Qdielectric_' + dielectric + ' for mode ' +

~\code\pyEPR\pyEPR\core_distributed_analysis.py in calc_energy_electric(self, variation, volume, smooth)
595
596 lv = self._get_lv(variation)
--> 597 return A.evaluate(lv=lv)
598
599 def calc_energy_magnetic(self,

~\code\pyEPR\pyEPR\ansys.py in evaluate(self, phase, lv, print_debug)
2768 args.extend(["Freq:=", self.setup.solution_freq])
2769
-> 2770 self.calc_module.ClcEval(setup_name, args)
2771 return float(self.calc_module.GetTopEntryValue(setup_name, args)[0])
2772

~\anaconda3\envs\pyEPR\lib\site-packages\win32com\client\dynamic.py in ClcEval(self, solnName, varVals)

com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024365), None)

Create a development branch

I have not been using this repository for that long but in the time I have, I encountered problems several times where a code written just a few weeks ago didn't work correctly because of changes made to the repository. I suggest creating a "stable" branch (the master) and a development branch to solve this issue.

This way you can still develop easily and when it's time to update the stable branch you can make sure that someone using an "old" method of doing things it would work but he would bet a "deprecated" warning or something.

Add pyEPR to the Anaconda cloud

Right now to install the pyEPR package you need to clone it and add it to the environment variables. I think it would be much simpler if we add pyEPR to the Anaconda cloud, this way to download the package all you need is to run something like conda install -c minev pyEPR and you're done. The upload process isn't that long and all you need is a free anaconda account. Here is the documentation on how to do so

Error in description string of analyze_variation

In core_quantum_analysis.py line 624 it is written If numerical diagonalization is run, then we return the numerically diagonalized ...
however, line 695 it seems that it is always f1s that is returned. Irrespective of numerical diagonlization, f1 always contains the 1st order perturbation theory of the 4th order term in the cosine.

Plot Hamiltonian results with with swp_variable is not 'variation'

with multiple sweep variables, using a swp_variable which is not the default 'variation' in plot_hamiltonian_results method, not all variations are displayed.
When trying to perform the same analysis while sending variation a list of variations (to plot different cuts of the parameter space), the plot_hamiltonian_results method only works with the default 'variation' as the swp_variable.

analyze_all_variations not working with restricted number of modes

Here is the description of the issue:

I have a simulation with 10 modes, and I would like to work only with 2 of them:

eprd.do_EPR_analysis(modes=[0, 8])

But, when I go to quantum analysis, by doing:

epra = epr.QuantumAnalysis(eprd.data_filename)
epra.analyze_all_variations(cos_trunc = 8, fock_trunc = 15)

I get:

AssertionError Traceback (most recent call last)
in
6
7 # Analyze
----> 8 epra.analyze_all_variations(cos_trunc = 8, fock_trunc = 15)

G:\Git\pyEPR\pyEPR\core_quantum_analysis.py in analyze_all_variations(self, variations, analyze_previous, **kwargs)
459 result[variation] = self.results[variation]
460 else:
--> 461 result[variation] = self.analyze_variation(variation, **kwargs)
462
463 self.results.save()

G:\Git\pyEPR\pyEPR\core_quantum_analysis.py in analyze_variation(self, variation, cos_trunc, fock_trunc, print_result, junctions, modes)
681 PHI_zpf,
682 cos_trunc=cos_trunc,
--> 683 fock_trunc=fock_trunc)
684 else:
685 f1_ND, CHI_ND = None, None

G:\Git\pyEPR\pyEPR\calcs\back_box_numeric.py in epr_numerical_diagonalization(freqs, Ljs, φzpf, cos_trunc, fock_trunc, use_1st_order, return_H)
64
65 Hs = black_box_hamiltonian(freqs * 1E9, Ljs.astype(np.float), fluxQ*ϕzpf,
---> 66 cos_trunc, fock_trunc, individual=use_1st_order)
67 f_ND, χ_ND, _, _ = make_dispersive(
68 Hs, fock_trunc, ϕzpf, freqs, use_1st_order=use_1st_order)

G:\Git\pyEPR\pyEPR\calcs\back_box_numeric.py in black_box_hamiltonian(fs, ljs, fzpfs, cos_trunc, fock_trunc, individual)
102 fs).any() == False, "freqs has NAN, this is NOT allowed! Fix me."
103 assert fzpfs.shape == (njuncs, n_modes), "incorrect shape for zpf array, {} not {}".format(
--> 104 fzpfs.shape, (njuncs, n_modes))
105 assert fs.shape == (n_modes,), "incorrect number of mode frequencies"
106 assert ejs.shape == (njuncs,), "incorrect number of qubit frequencies"

AssertionError: incorrect shape for zpf array, (1, 2) not (1, 10)

I there a work around ?

push new 0.8.4 version

pip install setuptools wheel twine if you don't have them
python setup.py sdist bdist_wheel
Set up an API token for PyPI as described in the link above
twine upload dist/*

add instructions to site

Errors in the function get_Qseam from core_distributed_analysis

The function get_Qseam is currently bugged, but here is a fixe that works for me:

One must add the following lines at the beggining of the function:

freqs_bare_dict, freqs_bare_vals = self.get_freqs_bare(variation)
self.omega = 2*np.pi*freqs_bare_vals[mode]

And since yseam hase been removed from config.dissipation, I think line 792 becomes:

str(config.dissipation.gseam/yseam))

(it is currently: str(config.dissipation.gseam/config.dissipation.yseam)))

Get variable value from HFSS model

The names of the variables could be obtained from pinfo.get_all_variables_names() as set of strings. It would be nice to see a function like pinfo.getValue('var name') to return the value(s) of the variable name(s) of the HFSS model obtained from the previous command. This could be something like functions get() and put() used in C++ sort of classes.

pyEPR: Working group meeting -- Getting Together: First meeting NOTES

** For notes from meeting see comment below**

‼️ ‼️ MEETING SIGNUP -- Click link HERE ‼️ ‼️

Let's get together for a pyEPR working group meeting.

As pyEPR is growing a lot and being used by many labs and companies globally, it would be great to meet and chat about the future of pyEPR.

Also, had a great chat with Unitary Fund (unitary.fund) about pyEPR for quantum design, so some folks from there may join us as well.

I can't seem to tag too many people, so may have to help spread the word.

DATES (will send doodle poll):
Planning on: October 1-3 or October 8-10.
Once you sign up in the link above and we set the time, I will send out email to set time and date.

Will try to pick time for US and Europe timezones (any others I am missing?)?

You can also e-mail me here zlatko-minev.com

Remove qutip package

Qutip is a great package and it provides many, very useful functionalities for quantum mechanics. One of the main things it can do is represent a quantum system with the qobj class. A qobj object is not much more than a numpy ndarray but it has some problems. Doing operations on qobjs is much slower than simply working with a numpy array (I would say around ~15 times slower on average, obviously depending on what you're doing and how much), also it manages memory worse and uses system resources less effectively. To be fair, numpy is one of the most used python packages in the world so obviously it's super optimized.

Anyway, for pyEPR, qutip is used on around ~10 lines and everything it is used for can be done with a numpy array without really changing the code much. I got this idea when I tried analyzing 10 modes and qutip returned and overflow error, and I think switching to numpy might help solve this problem. And as a bonus there won't be a dependency on the qutip package :)

All of the uses of qutip are one of these:

  • qutip.qeye ---> np.qeye
  • qutip.tensor ---> np.kron
  • qutip.destroy/create/num/basis ---> can be done in 3 lines with numpy, we can add this as a function in toolbox
  • Replacing matrix multiplication * in qutip with @ in numpy

I might do it myself later today, tell me what you think.

Running pyEPR with python 3.10

While running pyepr with python 3.10, importing ImportError occurred related to attrdict while importing pyepr.

My code was just "import pyEPR as epr" and I attached an error message below.

This problem is mainly about the syntax
from collections import Mapping
is deprecated in python 3.10 and replaced to
from collections.abc import Mapping.

While searching in Google, I found some news about attrdict is no more maintained, and I think this means we cannot expect whether they would fix this issue with python 3.10. Is there any plan to replace the attrdict library with another library or solve this issue differently?

Thanks.


ImportError Traceback (most recent call last)
File ~\Anaconda3\envs\pyepr_attrdict_test\lib\site-packages\pyEPR_init_.py:78, in
77 try:
---> 78 from attrdict import AttrDict as Dict
79 except (ImportError, ModuleNotFoundError):

File ~\Anaconda3\envs\pyepr_attrdict_test\lib\site-packages\attrdict_init_.py:5, in
1 """
2 attrdict contains several mapping objects that allow access to their
3 keys as attributes.
4 """
----> 5 from attrdict.mapping import AttrMap
6 from attrdict.dictionary import AttrDict

File ~\Anaconda3\envs\pyepr_attrdict_test\lib\site-packages\attrdict\mapping.py:4, in
1 """
2 An implementation of MutableAttr.
3 """
----> 4 from collections import Mapping
6 import six

ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\aass98998\Anaconda3\envs\pyepr_attrdict_test\lib\collections_init_.py)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 import pyEPR as epr

File ~\Anaconda3\envs\pyepr_attrdict_test\lib\site-packages\pyEPR_init_.py:80, in
78 from attrdict import AttrDict as Dict
79 except (ImportError, ModuleNotFoundError):
---> 80 raise ImportError("""Please install python package AttrDict.
81 AttrDict is in PyPI, so it can be installed directly
82 (https://github.com/bcj/AttrDict) using:
83 $ pip install attrdict""")
85 ##############################################################################
86 # Python header
88 author = "Zlatko Minev, Zaki Leghas, and the pyEPR team"

ImportError: Please install python package AttrDict.
AttrDict is in PyPI, so it can be installed directly
(https://github.com/bcj/AttrDict) using:
$ pip install attrdict

Adding linear resistance

  • Cap is experimental feature now (to be tested). Cj is set to a fixed value right now
  • Adding in resistance calculation in a more unified way

Nick Materise

Analyzis of a subset of modes

If I run the analysis on a number of modes which is smaller than the number of analyzed modes, I get an error:

  File "D:\Users\Zaki\github\pyEPR\pyEPR\core.py", line 1005, in analyze_variation
    CHI_O1= 0.25* Om * PJ * EJ.I * PJ.T * Om * 1000.             # MHz

  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\matrixlib\defmatrix.py", line 343, in __mul__
    return N.dot(self, asmatrix(other))

ValueError: shapes (2,2) and (1,1) not aligned: 2 (dim 1) != 1 (dim 0)

I see this is due to the fact that Om comes from all the computed frequencies, and not only the analyzed ones.

Has this been solved in another fork / branch? if not I will fix it.

Import of CalcObject over ansys.py instead of core.py

In the tutorial "Tutorial 2. Field calculations - dielectric energy participation ratios (EPRs).ipynb", it is described how to use the Fields Calculator. The example code tries to include the corresponding class by
from pyEPR.core import CalcObject
When trying to execute that, I get the error ImportError: cannot import name 'CalcObject' from 'pyEPR.core'.
This is because CalcObject is defined in ansys.py, not in core.py. Indeed, with
from pyEPR.ansys import CalcObject
the import works again.

So I think it would be good to either adjust the template to this or to update core.py so that CalcObject is really imported.

Request to update calculation of Github Linguist to better reflect source language

Hi!

Thanks for the wonderful package! This is just me being pedantic but it would be nice if the Github linguist would display python to be the source language of the package. Currently, it shows the majority of the codebase to be jupyter-notebooks, which is not the case.

If one agrees, I'd be more than willing to open a PR to fix this issue.

Thanks!

Update information on installation via conda

The information on installation via the Anaconda cloud needs to be updated, now that #38 has been closed. I will add information on that installation procedure in the documentation in a related PR. This issue can be used for general discussion on it.

Problem when analyzing specific modes in QuantumAnalysis.analyze_variation

Hello,

I'm trying to do the EPR analysis for a multi-mode system, and it seems that analyzing more than 4 modes at once will take a very long time on my computer. So I tried to analyze fewer modes each time, say only mode 0 and mode 4, by passing [0, 4] to the 'modes' argument of QuantumAnalysis.analyze_variation. However, it seems that this will only analyze mode 0 and 1, not 0 and 4 as I wanted.

I checked the source code and I think the problem is below:

freqs_hfss = freqs_hfss[range(len(self.modes[variation])), ]
This line should be removed since we've already picked the mode frequencies in line 657

PJ = PJ[range(len(modes)), :]
here (and below) the matrix index should just be [modes, :], since we want to analyze the modes specified in the argument, not the first len(modes) number of modes.

I can submit a pull request later that fixes this issue if these sounds correct to you.

Thanks.

Add automatic surface energy calculation

If you want to calculate the electric energy of a volume you can simply use DistributedAnalysis.calc_energy_electric(), but if you want to calculate the energy of a surface you need to write the code manually. The two codes are nearly identical with the only difference being that you need to replace the line A = A.integrate_vol(name=volume) with A = A.integrate_surf(name=surf). Now, I could've simply added a boolean surface or something and it would work just fine but I think it would be best if the function would automatically check if the name given is a volume or a surface (or an edge). I don't think it would be that difficult but I didn't found where in the code you can get a list of names + their corresponding type (i.e. solid\sheet\edge). If there is no such option I could add it myself but I'm posting this because there might be such option that I didn't found, or maybe someone wants to give it a go before I get to it 😉

Optimizing quantum analysis

TL;DR: This program should've been written on a quantum computer... My PC really starting to straggle:\

After converting the code from using qutip to using numpy (see remove_qutip branch) I started playing around with it. One thing I noticed is takes an extremely long time to run for many modes. Just as an example, on the computer in our lab, running epra.analyze_all_variations(cos_trunc=8, fock_trunc=15) takes:

  • for 2 modes: 3 seconds
  • for 3 modes: 15 seconds
  • for 4 modes: Literally so long I never saw it finish (more than 20 mins, after that I stopped it). Moreover, qutip crushed due to memory problems.

This could make the code impractical for some complex applications (I don't really know if such applications exist, so it might be a non issue). This is when I got into the optimization rabbit hole. I'm posting here some of what I found so other people can look into it and try to optimize it, I think I'll do so in a few days. I believe that in a couple hours work a 10x-20x improvement is very possible (maybe even much more).

First thing, where that time is distributed (for 3 modes).

  • Basically all (99.5%) of the time is spent in the function epr_numerical_diagonalization in back_box_numeric.py, of which:
    • 30% of the time in the function black_box_hamiltonian of which:
      • Almost 100% of the time is spent on a single line! nonlinear_part = dot(-fjs, map(cos, cos_interiors))
    • 70% of the time in the function make_disspersive, I have not looked further into that function because for 4 modes, black_box_hamiltonian takes so long I never got past it.

A single line takes tens of minutes to complete and it's almost half of the total time , so I'll explain it a bit here.
The dot() is referring to MatrixOps.dot which is an implementation of the dot product that uses no external libraries. My guess is that it was done this way instead of with np.dot or something is that it was a way of dealing with the weird shapes (list of qobj etc...).

fjs is just a number defined few lines up. cos is a function defined a few lines up, it uses MatrixOps.cos_approx to approximate the cosine of cos_interiors. This line is equivalent to nonlinear_part = -fjs * cos( cos_interiors ) where cos is not np.cos but a cosine tylor approximation.

If anyone wants to give it a go, I'd start by replacing every list with a ndarray. Right now there are many lists of numpy matrices, where all matrices have the same shape, so it is pretty inefficient to store them as a list instead of a 3d ndarray. This would also make it easy since it would allow to use numpy functions instead of loops, so you can just write cos( cos_interiors ) for example and that would work as expected (cos should be defined a bit differently though).

Note: I was writing this with hopes that after some optimization we could achieve the ability to do analysis on 5,6 even 7 modes. But as I was writing this I did some checks and found that because of memory constraints, 4 modes is probably the limit we can do. The memory usage is proportional to fock_levels^2*num_modes, for 4 modes and 15 fock levels that's around 19GB! I do believe 4 modes is possible in reasonable time with the right optimization.

Dissipation not shown in tutorials and should be a method

If I understand correctly, currently modelling any dissipation requires setting something like

project_info.dissipative['dielectric_surfaces'] = # supply names here

This feels kind of hacky, and is not even shown in the tutorial notebooks. Instead, this is currently seen only in startup_example_script.py and some example scripts

Should there instead be a method in ProjectInfo for selecting dissipative objects? Alternatively, make it an argument for initialisation, something like:

pinfo = epr.ProjectInfo(project_path = path_to_project, 
    project_name = 'pyEPR_tutorial1',
    design_name  = '1. single_transmon',
    dielectric_surfaces = ['si_substrate']
)

EPR on linux

  • There is a need to run on Linux and HPC cluster

Nick Materise will add notes here on what he has tried.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.