Skip to content

Commit

Permalink
Fix docstrings formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosavola committed Feb 24, 2022
1 parent 3030b31 commit e90b2ee
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 38 deletions.
4 changes: 2 additions & 2 deletions pyEPR/ansys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,9 @@ def get_matrix(
'''
Arguments:
-----------
variation : an empty string returns nominal variation.
variation: an empty string returns nominal variation.
Otherwise need the list
frequency : in Hz
frequency: in Hz
soln_type = "C", "AC RL" and "DC RL"
solution_kind = 'LastAdaptive' # AdaptivePass
Internals:
Expand Down
10 changes: 5 additions & 5 deletions pyEPR/calcs/back_box_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def black_box_hamiltonian(fs, ljs, fzpfs, cos_trunc=5, fock_trunc=8, individual=
All in SI units. The ZPF fed in are the generalized, not reduced, flux.
Description:
Takes the linear mode frequencies, $\omega_m$, and the zero-point fluctuations, ZPFs, and
builds the Hamiltonian matrix of $H_full$, assuming cos potential.
Takes the linear mode frequencies, :math:`\omega_m`, and the zero-point fluctuations, ZPFs, and
builds the Hamiltonian matrix of :math:`H_{full}`, assuming cos potential.
"""
n_modes = len(fs)
njuncs = len(ljs)
Expand Down Expand Up @@ -145,16 +145,16 @@ def make_dispersive(H, fock_trunc, fzpfs=None, f0s=None, chi_prime=False,
Output:
Return dressed mode frequencies, chis, chi prime, phi_zpf flux (not reduced), and linear frequencies
Description:
Takes the Hamiltonian matrix `H` from bbq_hmt. It them finds the eigenvalues/eigenvectors and assigns quantum numbers to them --- i.e., mode excitations, such as, for instance, for three mode, |0,0,0> or |0,0,1>, which correspond to no excitations in any of the modes or one excitation in the 3rd mode, resp. The assignment is performed based on the maximum overlap between the eigenvectors of H_full and H_lin. If this crude explanation is confusing, let me know, I will write a more detailed one :slightly_smiling_face:
Based on the assignment of the excitations, the function returns the dressed mode frequencies $\omega_m^\prime$, and the cross-Kerr matrix (including anharmonicities) extracted from the numerical diagonalization, as well as from 1st order perturbation theory.
Takes the Hamiltonian matrix `H` from bbq_hmt. It them finds the eigenvalues/eigenvectors and assigns quantum numbers to them --- i.e., mode excitations, such as, for instance, for three mode, :math:`|0,0,0\rangle` or :math:`|0,0,1\rangle`, which correspond to no excitations in any of the modes or one excitation in the 3rd mode, resp. The assignment is performed based on the maximum overlap between the eigenvectors of H_full and H_lin. If this crude explanation is confusing, let me know, I will write a more detailed one |:slightly_smiling_face:|
Based on the assignment of the excitations, the function returns the dressed mode frequencies :math:`\omega_m^\prime`, and the cross-Kerr matrix (including anharmonicities) extracted from the numerical diagonalization, as well as from 1st order perturbation theory.
Note, the diagonal of the CHI matrix is directly the anharmonicity term.
"""
if hasattr(H, '__len__'): # is it an array / list?
[H_lin, H_nl] = H
H = H_lin + H_nl
else: # make sure its a quanutm object
assert type(
H) == qutip.qobj.Qobj, "Please pass in either a list of Qobjs or Qobj for the Hamiltonian"
H) == qutip.qobj.Qobj, "Please pass in either a list of Qobjs or Qobj for the Hamiltonian"

print("Starting the diagonalization")
evals, evecs = H.eigenstates()
Expand Down
5 changes: 2 additions & 3 deletions pyEPR/calcs/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ class CalcsBasic():
@staticmethod
def epr_to_zpf(Pmj, SJ, Ω, EJ):
r'''
INPUTS:
All as matrices (numpy arrays)
Arguments, All as matrices (numpy arrays):
:Pnj: MxJ energy-participation-ratio matrix, p_mj
:SJ: MxJ sign matrix, s_mj
:Ω: MxM diagonal matrix of frequencies (GHz, not radians, diagonal)
:EJ: JxJ diagonal matrix matrix of Josephson energies (in same units as Om)
RETURNS:
reduced zpf (in units of $\phi_0$)
reduced zpf (in units of :math:`\phi_0`)
'''
(Pmj, SJ, Ω, EJ) = map(np.array, (Pmj, SJ, Ω, EJ))

Expand Down
26 changes: 13 additions & 13 deletions pyEPR/calcs/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Convert():
Static container class for conversions of units and variables.
TEST CONVERSION:
```python
from pyEPR.toolbox.conversions import Convert
Lj_nH, Cs_fF = 11, 60
Convert.transmon_print_all_params(Lj_nH, Cs_fF);
.. code-block:: python
```
from pyEPR.toolbox.conversions import Convert
Lj_nH, Cs_fF = 11, 60
Convert.transmon_print_all_params(Lj_nH, Cs_fF);
'''
# Known SI prefixed
_prefix = {'y': -24, # yocto
Expand Down Expand Up @@ -109,7 +109,7 @@ def Ej_from_Lj(Lj, units_in='nH', units_out='MHz'):
Josephson Junction energy from Josephson inductance.
Returns in MHz
$E_j = \phi_0^2 / L_J$
:math:`E_j = \phi_0^2 / L_J`
'''
return Convert._convert_num(
# Plank to go from Joules to Hz
Expand All @@ -122,7 +122,7 @@ def Lj_from_Ej(Ej, units_in='MHz', units_out='nH'):
Josephson Junction ind from Josephson energy in MHZ.
Returns in units of nano Henries by default
$E_j = \phi_0^2 / L_J$
:math:`E_j = \phi_0^2 / L_J`
'''
return Convert._convert_num(
lambda _x: (ϕ0**2.)/(_x*Planck), # Plank to go from Joules to Hz
Expand All @@ -133,7 +133,7 @@ def Ic_from_Lj(Lj, units_in='nH', units_out='nA'):
r'''
Josephson Junction crit. curr from Josephson inductance.
$E_j = \phi_0^2 / L_J = \phi_0 I_C $
:math:`E_j = \phi_0^2 / L_J = \phi_0 I_C`
'''
return Convert._convert_num(
lambda _x: ϕ0/_x, # Plank to go from Joules to Hz
Expand All @@ -144,7 +144,7 @@ def Lj_from_Ic(Lj, units_in='nA', units_out='nH'):
r'''
Josephson Junction crit. curr from Josephson inductance.
$E_j = \phi_0^2 / L_J = \phi_0 I_C $
:math:`E_j = \phi_0^2 / L_J = \phi_0 I_C`
'''
return Convert._convert_num(
lambda _x: ϕ0/_x, # Plank to go from Joules to Hz
Expand All @@ -153,10 +153,10 @@ def Lj_from_Ic(Lj, units_in='nA', units_out='nH'):
@staticmethod
def Ec_from_Cs(Cs, units_in='fF', units_out='MHz'):
r'''
Charging energy 4Ec n^2, where n=Q/2e
Charging energy :math:`4E_c n^2`, where :math:`n=Q/2e`
Returns in MHz
$E_{C}=\frac{e^{2}}{2C}J$
:math:`E_{C}=\frac{e^{2}}{2C}J`
'''
return Convert._convert_num(
# Plank to go from Joules to Hz
Expand All @@ -166,11 +166,11 @@ def Ec_from_Cs(Cs, units_in='fF', units_out='MHz'):
@staticmethod
def Cs_from_Ec(Ec, units_in='MHz', units_out='fF'):
r'''
Charging energy 4Ec n^2, where n=Q/2e
Charging energy :math:`4E_c n^2`, where :math:`n=Q/2e`
Returns in SI units, in Farads.
$E_{C}=\frac{e^{2}}{2C}J$
:math:`E_{C}=\frac{e^{2}}{2C}J`
'''
return Convert._convert_num(
# Plank to go from Joules to Hz
Expand Down
28 changes: 13 additions & 15 deletions pyEPR/core_distributed_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def get_variable_vs_variations(self, variable: str, convert: bool = True):
"""
Get ansys variables
Return HFSS variable from self.get_ansys_variables() as a
Return HFSS variable from :py:func:`self.get_ansys_variables()` as a
pandas series vs variations.
Args:
Expand Down Expand Up @@ -727,14 +727,13 @@ def calc_current_using_line_voltage(self, variation: str, junc_line_name: str,
'''
Peak current I_max for prespecified mode calculating line voltage across junction.
Make sure that oyu have set the correct variation in hFSS before running this
Make sure that you have set the correct variation in HFSS before running this
Parameters:
------------------------------------------------
Args:
variation: variation number
junc_line_name: name of the HFSS line spanning the junction
junc_L_Henries: junction inductance in henries
Cj_Farads : junction cap in Farads
Cj_Farads: junction cap in Farads
TODO: Smooth?
'''
lv = self._get_lv(variation)
Expand Down Expand Up @@ -958,14 +957,13 @@ def calc_p_junction(self, variation, U_H, U_E, Ljs, Cjs):
variation (str): A string identifier of the variation,
such as '0', '1', ...
Note:
--------------
U_E and U_H are the total peak energy. (NOT twice as in U_ and U_H other places)
.. note::
U_E and U_H are the total peak energy. (NOT twice as in U_ and U_H other places)
Potential errors: If you dont have a line or rect by the right name you will prob
get an error of the type:
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024365), None)
.. warning::
Potential errors: If you dont have a line or rect by the right name you will prob
get an error of the type: com_error: (-2147352567, 'Exception occurred.',
(0, None, None, None, 0, -2147024365), None)
'''

# ------------------------------------------------------------
Expand Down Expand Up @@ -1115,7 +1113,7 @@ def do_EPR_analysis(self,
Args:
variation (str): A string identifier of the variation,
such as '0', '1', ...
such as '0', '1', ...
Optional Parameters:
------------------------
Expand All @@ -1127,8 +1125,8 @@ def do_EPR_analysis(self,
Modes to analyze
for example modes = [0, 2, 3]
append_analysis (bool) : When we run the ansys analysis, should we redo any variations
that we have already done?
append_analysis (bool) :
When we run the Ansys analysis, should we redo any variations that we have already done?
Ansys Notes:
------------------------
Expand Down

0 comments on commit e90b2ee

Please sign in to comment.