kqcircuits.simulations.export.simulation_export

kqcircuits.simulations.export.simulation_export.get_combined_parameters(simulation, solution)[source]

Return parameters of Simulation and Solution in a combined dictionary. In case of common keys, ‘solution.’ prefix is added to Solution parameter key.

kqcircuits.simulations.export.simulation_export.copy_content_into_directory(source_paths: list, path: Path, folder)[source]

Create a folder and copy the contents of the source folders into it

Parameters:
  • source_paths – list of source directories from which to copy content

  • path – path where the new folder will be created

  • folder – name of the new folder

kqcircuits.simulations.export.simulation_export.get_post_process_command_lines(post_process, path, json_filenames)[source]

Return post process command line calls as string. Can be used in construction of .bat or .sh script files.

Parameters:
  • post_process – List of PostProcess objects, a single PostProcess object, or None to be executed after simulations

  • path – simulation folder path

  • json_filenames – list of paths to simulation json files

Returns:

Command lines as string

kqcircuits.simulations.export.simulation_export.export_simulation_json(json_data, json_file_path)[source]

Export simulation definitions json. Raise an error if file exists

kqcircuits.simulations.export.simulation_export.export_simulation_oas(simulations, path: Path, file_prefix='simulation')[source]

Write single OASIS file containing all simulations in list.

kqcircuits.simulations.export.simulation_export.sweep_simulation(layout, sim_class, sim_parameters, sweeps)[source]

Create simulation sweep by varying one parameter at time. Return list of simulations.

kqcircuits.simulations.export.simulation_export.cross_sweep_simulation(layout, sim_class, sim_parameters, sweeps)[source]

Create simulation sweep by cross-varying all parameters. Return list of simulations.

kqcircuits.simulations.export.simulation_export.sweep_solution(sol_class, sol_parameters, sweeps)[source]

Create solution sweep by varying one parameter at time. Return list of solutions.

kqcircuits.simulations.export.simulation_export.cross_sweep_solution(sol_class, sol_parameters, sweeps)[source]

Create solution sweep by cross-varying all parameters. Return list of solutions.

kqcircuits.simulations.export.simulation_export.cross_combine(simulations, solutions)[source]

Combines simulations and solutions into list of tuples.

Parameters:
  • simulations – A Simulation object or a list of Simulation objects.

  • solutions – A Solution object or a list of Solution objects.

Returns:

A list of tuples containing all combinations of simulations and solutions.

kqcircuits.simulations.export.simulation_export.unique_rows(a)[source]
kqcircuits.simulations.export.simulation_export.latin_hypercube_sampling(l_bounds, u_bounds, n, integers=True, add_edges=False, remove_duplicates=True)[source]

Samples parameters from d-dimensional parameter space defined by bounds using Latin Hypercube sampling. Implementation for sampling either integers or floats https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.qmc.LatinHypercube.html

Parameters:
  • l_bounds – Lower bounds for parameters

  • u_bounds – Upper bounds for parameters

  • n – Number of samples

  • integers – Boolean to check if only integer values should be generated

  • add_edges – Boolean to add also the edge points of the hypercube. Adds 2^len(l_bounds) values

  • remove_duplicates – Boolen to remove duplicate samples

Returns:

A numpy array of samples

kqcircuits.simulations.export.simulation_export.latin_hypercube_sampling_mixed_dtypes(l_bounds_int, u_bounds_int, l_bounds_float, u_bounds_float, n, add_edges=False)[source]

Samples parameters from d-dimensional parameter space defined by bounds using Latin Hypercube sampling. Implemementation for sampling combination of int and float values https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.qmc.LatinHypercube.html

Parameters:
  • l_bounds_int – Lower bounds for parameters with int dtype

  • u_bounds_int – Upper bounds for parameters with int dtype

  • l_bounds_float – Lower bounds for parameters with float dtype

  • u_bounds_float – Upper bounds for parameters with float dtype

  • n – Number of samples

  • add_edges – Boolean to add also the edge points of the hypercube. Adds 2^len(l_bounds_int+l_bounds_float) values

Returns:

A numpy array of samples

kqcircuits.simulations.export.simulation_export.combine_sweep_simulation(layout, sim_class, sim_parameters, keys, samples)[source]

Creates a simulation sweep from created samples. Returns a list of simulations. :param layout: Layout for simulation :param sim_class: Simulation class :param sim_parameters: Simulation parameters which are not in the sweep :param keys: List of parameter names corresponding to samples :param samples: List of samples for sweep parameters

Returns:

A list of simulations

../_images/kqcircuits.simulations.export.simulation_export.png