pyEPR.core_quantum_analysis module

Main interface module to use pyEPR.

Contains code that works on the analysis after hfss, ansys, etc. These can now be closed.

Copyright Zlatko Minev, Zaki Leghtas, and the pyEPR team 2015, 2016, 2017, 2018, 2019, 2020

class pyEPR.core_quantum_analysis.HamiltonianResultsContainer(dict_file=None, data_dir=None)[source]

Bases: collections.OrderedDict

The user should only use the QuantumAnalysis class interface.

This class is largely for internal use.

It is a dictionary based class to contain the results stored.

clear() → None. Remove all items from od.
copy() → a shallow copy of od
file_name_extra = ' HamiltonianResultsContainer.npz'
fromkeys()

Create a new ordered dictionary with keys from iterable and values set to value.

get()

Return the value for key if key is in the dictionary, else default.

get_chi_ND(variations: list = None, vs='variation')[source]
get_chi_O1(variations: list = None, vs='variation')[source]
get_frequencies_HFSS(variations: list = None, vs='variation')[source]

See help for vs_variations

get_frequencies_ND(variations: list = None, vs='variation')[source]

See help for vs_variations

get_frequencies_O1(variations: list = None, vs='variation')[source]

See help for vs_variations

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
load(filename=None)[source]

Uses numpy npz file.

move_to_end()

Move an existing element to the end (or beginning if last is false).

Raise KeyError if the element does not exist.

pop(k[, d]) → v, remove specified key and return the corresponding

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

Remove and return a (key, value) pair from the dictionary.

Pairs are returned in LIFO order if last is true or FIFO order if false.

save(filename: str = None)[source]

Uses numpy npz file.

setdefault()

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D's values
vs_variations(quantity: str, variations: list = None, vs='variation', to_dataframe=False)[source]
QUANTITIES:
f_0 : HFSS Frequencies f_1 : Analytical first order PT on the p=4 term of the cosine f_ND : Numerically diagonalized chi_O1: chi matrix from 1st order PT
Parameters:

{[type]} -- [description] (quantity) –

Keyword Arguments:
 
  • {list of strings} -- Variations (default (variations) – {None} – means all)
  • {str} -- Swept against (default (vs) – {‘variation’})
  • {bool} -- convert or not the result to dataframe. (to_dataframe) – Make sure to call only if it can be converted to a DataFrame or can be concatenated into a multi-index DataFrame
Returns:

[type] – [description]

class pyEPR.core_quantum_analysis.QuantumAnalysis(data_filename, variations: list = None, do_print_info=True, Res_hamil_filename=None)[source]

Bases: object

Defines an analysis object which loads and plots data from a h5 file This data is obtained using DistributedAnalysis

analyze_all_variations(variations: List[str] = None, analyze_previous=False, **kwargs)[source]

See analyze_variation for full documentation

Parameters:
  • variations – None returns all_variations otherwise this is a list with number as strings [‘0’, ‘1’]
  • analyze_previous – set to true if you wish to overwrite previous analysis
  • **kwargs – Keyword arguments passed to analyze_variation().
analyze_variation(variation: str, cos_trunc: int = None, fock_trunc: int = None, print_result: bool = True, junctions: List[T] = None, modes: List[T] = None)[source]

Core analysis function to call!

Parameters:
  • junctions – list or slice of junctions to include in the analysis. None defaults to analysing all junctions
  • modes – list or slice of modes to include in the analysis. None defaults to analysing all modes
Returns:

Dictionary containing at least the following:
  • f_0 [MHz]: Eigenmode frequencies computed by HFSS; i.e., linear freq returned in GHz
  • f_1 [MHz]: Dressed mode frequencies (by the non-linearity; e.g., Lamb shift, etc. ). Result based on 1st order perturbation theory on the 4th order expansion of the cosine.
  • f_ND [MHz]: Numerical diagonalization result of dressed mode frequencies. only available if cos_trunc and fock_trunc are set (non None).
  • chi_O1 [MHz]: Analytic expression for the chis based on a cos trunc to 4th order, and using 1st order perturbation theory. Diag is anharmonicity, off diag is full cross-Kerr.
  • chi_ND [MHz]: Numerically diagonalized chi matrix. Diag is anharmonicity, off diag is full cross-Kerr.

Return type:

dict

full_report_variations(var_list: list = None)[source]

see full_variation_report

full_variation_report(variation)[source]

prints the results and parameters of a specific variation

Parameters:variation (int or str) – the variation to be printed .
Returns:
Return type:None.
get_Ecs(variation)[source]

ECs in GHz Returns as pandas series

get_Ejs(variation)[source]

EJs in GHz See calcs.convert

get_ansys_energies(swp_var='variation')[source]

Return a multi-index dataframe of ansys energies vs swep_variable

Parameters:swp_var (str) –
get_chis(swp_variable='variation', numeric=True, variations: list = None, m=None, n=None)[source]

return as multiindex data table

If you provide m and n as integers or mode labels, then the chi between these modes will be returned as a pandas Series.

get_convergences_max_delta_freq_vs_pass(as_dataframe=True)[source]

Index([u’Pass Number’, u’Solved Elements’, u’Max Delta Freq. %’ ])

get_convergences_max_tets()[source]

Index([u’Pass Number’, u’Solved Elements’, u’Max Delta Freq. %’ ])

get_convergences_tets_vs_pass(as_dataframe=True)[source]

Index([u’Pass Number’, u’Solved Elements’, u’Max Delta Freq. %’ ])

get_epr_base_matrices(variation, _renorm_pj=None, print_=False)[source]

Return the key matrices used in the EPR method for analytic calculations.

All as matrices
PJ:Participation matrix, p_mj
SJ:Sign matrix, s_mj
Om:Omega_mm matrix (in GHz) (hbar = 1) Not radians.
EJ:E_jj matrix of Josephson energies (in same units as hbar omega matrix)
PHI_zpf:ZPFs in units of phi_0 reduced flux quantum
PJ_cap:capacitive participation matrix
Return all as np.array
PM, SIGN, Om, EJ, Phi_ZPF
get_frequencies(swp_variable='variation', numeric=True, variations: list = None)[source]

return as multiindex data table index: eigenmode label columns: variation label

get_mesh_tot()[source]
get_participations(swp_variable='variation', variations: list = None, inductive=True, _normed=True)[source]
inductive (bool): EPR for junction inductance when True, else for capacitors
Returns a multiindex dataframe:
index 0: sweep variable index 1: mode number column: junction number

Plot the participation ratio of all junctions for a given mode vs a sweep of Lj.

get_quality_factors(swp_variable='variation', variations: list = None)[source]

return as pd.Series index: eigenmode label columns: variation label

get_variable_value(swpvar, lv=None)[source]
get_variable_vs(swpvar, lv=None)[source]

lv is list of variations (example [‘0’, ‘1’]), if None it takes all variations swpvar is the variable by which to organize

return: ordered dictionary of key which is the variation number and the magnitude of swaver as the item

get_variation_of_multiple_variables_value(Var_dic, lv=None)[source]
SEE get_variations_of_variable_value

A function to return all the variations in which one of the variables has a specific value lv is list of variations (example [‘0’, ‘1’]), if None it takes all variations Var_dic is a dic with the name of the variable as key and the value to filter as item

get_variations_of_variable_value(swpvar, value, lv=None)[source]

A function to return all the variations in which one of the variables has a specific value lv is list of variations (example [‘0’, ‘1’]), if None it takes all variations swpvar is a string and the name of the variable we wish to filter value is the value of swapvr in which we are interested

returns lv - a list of the variations for which swavr==value

get_vs_variable(swp_var, attr: str)[source]

Convert the index of a dictionary that is stored here from variation number to variable value.

Parameters:
  • swp_var (str) – name of sweep variable in ansys
  • attr – name of local attribute, eg.., ‘ansys_energies’
plot_hamiltonian_results(swp_variable: str = 'variation', variations: list = None, fig=None, x_label: str = None)[source]

Plot results versus variation

Keyword Arguments:
 
  • {str} -- Variable against which we swept. If none, then just (swp_variable) – take the variation index (default: {None})
  • {list} -- [description] (default (variations) – {None})
  • {[type]} -- [description] (default (fig) – {None})
Returns:

fig, axs

plot_results(result, Y_label, variable, X_label, variations: list = None)[source]
plotting_dic_x(Var_dic, var_name)[source]
print_info()[source]
print_result(result)[source]

Utility reporting function

print_variation(variation)[source]

Utility reporting function

project_info
quick_plot_chi_alpha(mode1, mode2, swp_variable='variation', ax=None, kw=None, numeric=False)[source]

Quick plot chi between mode 1 and mode 2.

If you select mode1=mode2, then you will plot the alpha

kw : extra plot arguments
quick_plot_convergence(ax=None)[source]

Plot a report of the Ansys convergence vs pass number ona twin axis for the number of tets and the max delta frequency of the eignemode.

quick_plot_frequencies(mode, swp_variable='variation', ax=None, kw=None, numeric=False)[source]

Quick plot freq for one mode

kw : extra plot arguments

quick_plot_mode(mode, junction, mode1=None, swp_variable='variation', numeric=False, sharex=True)[source]

Create a quick report to see mode parameters for only a single mode and a cross-kerr coupling to another mode. Plots the participation and cross participation Plots the frequencie plots the anharmonicity

The values are either for the numeric or the non-numeric results, set by numeric

quick_plot_participation(mode, junction, swp_variable='variation', ax=None, kw=None)[source]

Quick plot participation for one mode

kw : extra plot arguments

report_results(swp_variable='variation', numeric=True)[source]

Report in table form the results in a markdown friendly way in Jupyter notebook using the pandas interface.

pyEPR.core_quantum_analysis.extract_dic(name=None, file_name=None)[source]

#name is the name of the dictionary as saved in the npz file if it is None, the function will return a list of all dictionaries in the npz file file name is the name of the npz file