squadds.simulations package#
Submodules#
squadds.simulations.ansys_simulator module#
- class squadds.simulations.ansys_simulator.AnsysSimulator(analyzer, design_options, **kwargs)[source]#
Bases:
objectAnsysSimulator class for simulating devices using Ansys.
- analyzer#
The analyzer object.
- device_dict#
The device dictionary containing design and setup options.
- lom_analysis_obj#
The LOM analysis object.
- epr_analysis_obj#
The EPR analysis object.
- design#
The design planar object.
- gui#
The MetalGUI object.
Initialize the AnsysSimulator object.
- Parameters:
analyzer – The analyzer object.
design_options (dict) – The device dictionary (renamed to device_dict internally).
- Optional arguments:
open_gui (bool): If True, a MetalGUI instance is created and assigned to self.gui. Default is False.
- get_renderer_screenshot()[source]#
Saves a screenshot of the renderer.
If the EPR analysis object is not None, it saves a screenshot of the EPR analysis simulation. If the LOM analysis object is not None, it saves a screenshot of the LOM analysis simulation.
- get_simulation_setup(target='all')[source]#
Displays the current simulation setup parameters.
- Parameters:
target (str) – Which setup to display. Options: “all”, “qubit”, “cavity”, “coupler”, “generic”.
- Returns:
Dictionary containing the requested setup(s).
- Return type:
dict
- get_xmon_info(xmon_dict)[source]#
Retrieves information about the Xmon qubit from the given xmon_dict.
- Parameters:
xmon_dict (dict) – A dictionary containing simulation results and design options.
- Returns:
A dictionary containing the qubit frequency in GHz and the anharmonicity in MHz.
- Return type:
dict
- plot_device(device_dict)[source]#
Plot the device based on the given device dictionary.
Parameters: - device_dict (dict): A dictionary containing the device information.
Returns: None
- simulate(device_dict=None, run_async=False)[source]#
Simulates the device based on the provided device dictionary.
- Parameters:
device_dict (dict, optional) – A dictionary containing the device design options and setup. If None, uses the internally stored device_dict.
run_async (bool) – If True, runs the simulation asynchronously.
- Returns:
The simulation results or a Future object.
- Return type:
pandas.DataFrame or concurrent.futures.Future
- sweep(sweep_dict, emode_setup=None, lom_setup=None)[source]#
Sweeps the device based on the provided sweep dictionary.
- Returns:
The sweep results.
- Return type:
pandas.DataFrame
- Raises:
None –
- sweep_qubit_cavity(device_dict, emode_setup=None, lom_setup=None)[source]#
Sweeps a single geometric parameter of the qubit and cavity system based on the provided sweep dictionary.
- Parameters:
device_dict (dict) – A dictionary containing the device design options and setup.
emode_setup (dict) – A dictionary containing the eigenmode setup options.
lom_setup (dict) – A dictionary containing the LOM setup options.
- Returns:
The sweep results.
- Return type:
results
- update_design_parameters(**kwargs)[source]#
Updates the geometry design parameters in the stored device dictionary. Smartly searches for the keys in ‘design_options’, ‘design_options_qubit’, etc.
- Parameters:
**kwargs – Key-value pairs of design parameters to update (e.g., cross_length=”300um”).
- update_simulation_setup(target='all', **kwargs)[source]#
Updates the simulation setup parameters in the stored device dictionary. Intelligently maps targets to setup keys based on system type.
- Parameters:
target (str) – Which setup to update. Options: “all”, “qubit”, “cavity”, “coupler”, “generic”.
**kwargs – Key-value pairs of parameters to update (e.g., max_passes=10).
squadds.simulations.objects module#
SimulationConfig#
- class squadds.simulations.objects.SimulationConfig(design_name='CavitySweep', renderer_type='hfss', sim_type='eigenmode', setup_name='Setup', max_passes=49, max_delta_f=0.05, min_converged_passes=2, Lj=0, Cj=0)[source]#
Bases:
objectRepresents the configuration for a simulation.
- Parameters:
design_name (str) – The name of the design.
renderer_type (str) – The type of renderer.
sim_type (str) – The type of simulation.
setup_name (str) – The name of the setup.
max_passes (int) – The maximum number of passes.
max_delta_f (float) – The maximum delta frequency.
min_converged_passes (int) – The minimum number of converged passes.
Lj (float) – The value of Lj.
Cj (float) – The value of Cj.
Initialize the Simulation object.
- Parameters:
design_name (str) – The name of the design.
renderer_type (str) – The type of renderer to be used.
sim_type (str) – The type of simulation.
setup_name (str) – The name of the setup.
max_passes (int) – The maximum number of passes.
max_delta_f (float) – The maximum change in frequency.
min_converged_passes (int) – The minimum number of converged passes.
Lj (float) – The value of inductance.
Cj (float) – The value of capacitance.
- squadds.simulations.objects.get_sim_results(emode_df=None, lom_df=None, ncap_lom_df=None)[source]#
Retrieves simulation results from the provided dataframes and calculates additional parameters.
- Parameters:
emode_df (dict) – Dataframe containing eigenmode simulation results.
lom_df (dict) – Dataframe containing lumped element model simulation results.
ncap_lom_df (dict) – Dataframe containing lumped element model simulation results for NCap coupler.
- Returns:
A dictionary containing the calculated simulation results.
- Return type:
dict
- squadds.simulations.objects.render_simulation_no_ports(epra, components, open_pins, ansys_design_name, setup_vars)[source]#
Renders the simulation into HFSS.
- Parameters:
epra – The EPR analysis object.
ansys_design_name – The name of the Ansys design.
setup_vars – The setup variables for the rendering.
components – List of QComponent object.
- squadds.simulations.objects.render_simulation_with_ports(epra, ansys_design_name, setup_vars, coupler)[source]#
Renders the simulation into HFSS.
- Parameters:
epra – The EPR analysis object.
ansys_design_name – The name of the Ansys design.
setup_vars – The setup variables for the rendering.
coupler – The coupler object.
- squadds.simulations.objects.run_capn_LOM(design, param, sim_options)[source]#
Run capacitance analysis using Qiskit Metal and Ansys HFSS.
- Parameters:
design (metal.designs.design_planar.DesignPlanar) – The design object.
param (dict) – Design options for the coupler.
sim_options (dict) – Simulation options.
- Returns:
- A tuple containing the following:
data_df (dict): Dictionary containing design, simulation options, simulation results, and miscellaneous data.
loma (LOManalysis): The LOManalysis object.
- Return type:
tuple
- squadds.simulations.objects.run_eigenmode(design, geometry_dict, sim_options, generate_plots=False, **kwargs)[source]#
Runs the eigenmode simulation for a given design using Ansys HFSS.
- Parameters:
design (str) – The name of the design.
geometry_dict (dict) – A dictionary containing the geometry options for the simulation.
sim_options (dict) – A dictionary containing the simulation options.
generate_plots (bool) – If True, generate convergence and field plots. Default is False.
- Returns:
- A tuple containing the simulation results and the EPRAnalysis object.
The simulation results are stored in a dictionary with the following structure: {
- ”design”: {
“coupler_type”: “CLT”, “design_options”: geometry_dict, “design_tool”: “Qiskit Metal”
}, “sim_options”: {
”sim_type”: “epr”, “setup”: setup, “simulator”: “Ansys HFSS”
}, “sim_results”: {
”cavity_frequency”: f_rough, “Q”: Q, “kappa”: kappa
}, “misc”: data
} The EPRAnalysis object is returned for further analysis or post-processing.
- Return type:
tuple
- squadds.simulations.objects.run_qubit_cavity_sweep(design, device_options, emode_setup=None, lom_setup=None, filename='default_sweep')[source]#
Runs a parameter sweep for the specified design.
- Parameters:
design (Design) – The design object.
sweep_opts (dict) – The sweep options.
device_dict (dict) – The device dictionary containing the design options and setup.
emode_setup (dict) – The eigenmode setup options.
lom_setup (dict) – The LOM setup options.
filename (str) – The filename for the simulation results.
Returns
- squadds.simulations.objects.run_sweep(design, sweep_opts, emode_options, lom_options, filename='default_sweep')[source]#
Runs a parameter sweep for the specified design.
- Parameters:
design (Design) – The design object.
sweep_opts (dict) – The sweep options.
emode_options (dict) – The eigenmode setup options.
lom_options (dict) – The LOM setup options.
filename (str) – The filename for the simulation results.
- Returns:
None Saves each sweep iteration to a JSON file with the specified filename.
- squadds.simulations.objects.run_xmon_LOM(design, cross_dict, sim_options)[source]#
Runs the XMON LOM simulation.
- Parameters:
design (metal.designs.design_planar.DesignPlanar) – The design object.
cross_dict (dict) – The dictionary containing cross connection information.
sim_options (dict) – The simulation options.
- Returns:
A tuple containing the simulation data and the LOManalysis object.
- Return type:
tuple
- squadds.simulations.objects.set_simulation_hyperparameters(epra, config)[source]#
Sets the simulation hyperparameters based on the provided configuration.
- Parameters:
epra – The EPR analysis object.
config – The configuration settings for the simulation.
- Returns:
The setup object with the updated settings.
- squadds.simulations.objects.simulate_single_design(design, device_dict, emode_options=None, lom_options=None, coupler_type='CLT', generate_plots=False)[source]#
Simulates a single design using the provided parameters.
- Parameters:
design (Design) – The design object representing the design.
device_dict (dict) – A dictionary containing device options.
emode_options (dict) – A dictionary containing the eigenmode simulation options.
lom_options (dict) – A dictionary containing the LOM simulation options.
coupler_type (str) – The type of coupler to be used.
sim_options (dict) – A dictionary containing simulation options.
generate_plots (bool) – If True, generate convergence and field plots. Default is False.
- Returns:
The simulation results. If eigenmode simulation is performed, returns a dictionary containing the eigenmode results. If LOM simulation is performed, returns a tuple containing the LOM dataframe and LOM object.
- Return type:
dict or tuple
- squadds.simulations.objects.simulate_whole_device(design, device_dict, eigenmode_options, LOM_options, open_gui=False, generate_plots=False)[source]#
Simulates the whole device by running eigenmode and LOM simulations.
- Parameters:
design (metal.designs.design_planar.DesignPlanar) – The design object.
cross_dict (dict) – Dictionary containing qubit options.
cavity_dict (dict) – Dictionary containing cavity options.
LOM_options (dict) – Dictionary containing LOM setup options.
eigenmode_options (dict) – Dictionary containing eigenmode setup options.
open_gui (bool, optional) – If True, the Metal GUI is opened. Default is False.
generate_plots (bool, optional) – If True, generate convergence and field plots. Default is False.
- Returns:
A tuple containing the simulation results, LOM analysis object, and eigenmode analysis object.
- Return type:
tuple
- squadds.simulations.objects.start_simulation(design, config)[source]#
Starts the simulation with the specified design and configuration.
- Parameters:
design – The design to be simulated.
config – The configuration settings for the simulation.
- Returns:
A tuple containing the EPR analysis object and the HFSS object.
squadds.simulations.result_normalization module#
Pure helpers for shaping simulation outputs into SQuADDS records.
- squadds.simulations.result_normalization.build_eigenmode_payload(coupler_type, geometry_dict, setup, renderer_options, f_rough, Q, kappa, data)[source]#
Build the legacy eigenmode result payload.
- squadds.simulations.result_normalization.build_ncap_lom_payload(param, setup, cap_df, data, coupler_name)[source]#
Build the legacy NCap lumped-element payload.
squadds.simulations.simulator module#
squadds.simulations.sweeper_helperfunctions module#
Helpers for expanding nested sweep dictionaries into concrete combinations.
- squadds.simulations.sweeper_helperfunctions.create_dict_list(keys, values)[source]#
Rebuild nested dictionaries for every key/value combination.
- Return type:
list[dict[str, Any]]
- squadds.simulations.sweeper_helperfunctions.extract_QSweep_parameters(parameters)[source]#
Return every concrete parameter combination from a nested sweep dictionary.
The public API is intentionally unchanged. Nested dictionaries are flattened into dotted paths, leaf values are converted into lists when needed, and the cartesian product of all leaf lists is reconstructed back into nested dictionaries.
- Return type:
list[dict[str, Any]]
- squadds.simulations.sweeper_helperfunctions.extract_parameters(dictionary, keys=None, prefix='')[source]#
Flatten nested keys into dotted paths in traversal order.
- Return type:
list[str]
squadds.simulations.utils module#
- squadds.simulations.utils.generate_bbox(component)[source]#
- Return type:
qiskit_metal.Dict.(<class ‘str’>, <class ‘float’>)
- squadds.simulations.utils.getMeshScreenshot(projectname, designname, solutiontype='Eigenmode')[source]#
squadds.simulations.utils_ansys module#
- squadds.simulations.utils_ansys.getMeshScreenshot(projectname, designname, solutiontype='Eigenmode')[source]#