diff --git a/squadds/__init__.py b/squadds/__init__.py index 27c6cae1..a69e79ab 100644 --- a/squadds/__init__.py +++ b/squadds/__init__.py @@ -9,4 +9,5 @@ __library_path__ = os.path.join(__repo_path__, "library") -from squadds.core.db import SQuADDS_DB \ No newline at end of file +from squadds.core.db import SQuADDS_DB +from squadds.core.analysis import Analyzer \ No newline at end of file diff --git a/squadds/core/analysis.py b/squadds/core/analysis.py index 098550f0..55104f00 100644 --- a/squadds/core/analysis.py +++ b/squadds/core/analysis.py @@ -40,14 +40,9 @@ def __init__(self, db): Attributes: db (SQuADDS_DB): The database to analyze. - component_name (str): The name of the component to analyze. - component_type (str): The type of the component to analyze. - df (pd.DataFrame): The dataframe of the component to analyze. metric_strategy (MetricStrategy): The strategy to use for calculating the distance metric. custom_metric_func (function): The custom function to use for calculating the distance metric. metric_weights (dict): The weights to use for calculating the weighted distance metric. - smart_df (SmartDataframe): The SmartDataframe of the component to analyze. - H_param_keys (list): The keys of the Hamiltonian parameters. Raises: ValueError: If the specified metric is not supported. @@ -63,14 +58,25 @@ def __init__(self, db): self.selected_cavity = self.db.selected_cavity self.selected_coupler = self.db.selected_coupler self.selected_system = self.db.selected_system - self.selected_df = self.db.selected_df + self.df = self.db.selected_df + self.closest_designs = None + self.closest_df_entry = None + self.interpolate_design = None + self.H_param_keys = self.db.target_param_keys self.metric_strategy = None # Will be set dynamically self.custom_metric_func = None self.metric_weights = None self.smart_df = None self.coupling_type = None + def target_param_keys(self): + """ + Returns: + list: The target parameter keys. + """ + return self.db.target_param_keys + def set_metric_strategy(self, strategy: MetricStrategy): """ Sets the metric strategy to use for calculating the distance metric. @@ -129,24 +135,6 @@ def find_closest(self, metric: str = 'Euclidean', display: bool = True): """ - Finds the rows in the DataFrame with the closest matching characteristics - to the given target parameters using a specified metric. - - Args: - target_params (dict): A dictionary containing the target values for columns in `self.df`. - Keys are column names and values are the target values. - num_top (int): The number of closest matching rows to return. - metric (str, optional): The distance metric to use for finding the closest matches. - Available options are specified in `self.__supported_metrics__`. - Defaults to 'Euclidean'. - display (bool, optional): Whether to display warnings and logs. Defaults to True. - - Returns: - pd.DataFrame: A DataFrame containing the rows with the closest matching characteristics, - sorted by the distance metric. - - Raises: - ValueError: If the specified metric is not supported or `num_top` exceeds the DataFrame size. """ ### Checks # Check for supported metric @@ -184,246 +172,14 @@ def find_closest(self, return closest_df - def chat(self, question, llm="OpenAI"): - """ - Chat with the library using a language model. - - Args: - question (str): The question to ask the library. - llm (str, optional): The language model to use for answering the question. - - Returns: - SmartDataframe: The answer to the question in a dataframe format. - """ - - # set up LLM - load_dotenv() - if llm == "OpenAI": - llm = OpenAI() - elif llm == "Starcoder": - llm = Starcoder(api_token=os.getenv("HUGGING_FACE_API_KEY")) - elif llm == "Falcon": - llm = Falcon(api_token=os.getenv("HUGGING_FACE_API_KEY")) - - # filter the df - filtered_df = self.df[self.H_param_keys] # Filter DataFrame based on H_param_keys - - # chat with the dataframe using pandasai - self.smart_df = SmartDataframe(filtered_df, config={"llm": llm}) - response = self.smart_df.chat(question) - - # merge the response with the original dataframe - pd_response = pd.DataFrame(response, columns=self.H_param_keys) - df_response = self.df.merge(pd_response, on=list(pd_response.columns), how='inner') - if len(df_response) == 0: - contrib_message = f"\nIf you find a geometry which corresponds to these values, please consider contributing it! 😁🙏\n" - raise ValueError("No matching geometries were found for your query 😢\n" + contrib_message) - return df_response.head(len(pd_response)) - - def get_interpolated_design(self, target_params: dict, metric: str = 'Euclidean', display: bool = True): """ - Implement the 7-step interpolation procedure to find the best qubit and resonator design. - - Args: - target_params (dict): A dictionary containing the target parameters for qubit and resonator. - The dictionary should contain two keys: 'qubit_params' and 'resonator_params'. - metric (str, optional): The distance metric to use for finding the closest matches. - Defaults to 'Euclidean'. - display (bool, optional): Whether to display warnings and logs. Defaults to True. - - Returns: - dict: A dictionary containing the interpolated design for the qubit and resonator. - - Raises: - ValueError: If the specified metric is not supported or if `num_top` exceeds the DataFrame size. - NotImplementedError: If auxiliary methods for calculating parameters are not implemented. """ - ### Checks - # Validate target_params - if not isinstance(target_params, dict): - raise ValueError("`target_params` must be a dictionary.") - if not all(key in target_params for key in self.H_param_keys): - # remind the characteristics allowed - characteristics = self.db.get_characteristic_info(self.component_name, self.component_type) - raise ValueError("The target parameters must be one of the following: \n" + str(characteristics)) - - # Validate metric - if metric not in self.__supported_metrics__: - raise ValueError(f'`metric` must be one of the following: {self.__supported_metrics__}') - - # Set num_top to 1 - num_top = 1 - - ### Start the interpolation algorithm - - # Step 0: Extract the target parameters for qubit and resonator - f_q, alpha_target, g_target = target_params.get("Qubit_Frequency_GHz"), target_params.get("Qubit_Anharmonicity_MHz"), target_params.get("Coupling_Strength_MHz") - f_r, kappa, wavelength_type = target_params.get("Cavity_Frequency_GHz"), target_params.get("kappa_MHz"), target_params.get("wavelength") - self.coupling_type = target_params.get("feedline_coupling") - - # Step 1: Compute the coupling parameters - C_q, C_r, C_c, E_J, E_C = self.get_coupling_parameters(f_q, f_r, alpha_target, g_target, wavelength_type) - - # Step 2: Search database for best matching design for anharmonicity, coulping strength, resonator frequency and qubit frequency - target_params_1 = {"Qubit_Frequency_GHz": f_q, "Qubit_Anharmonicity_MHz": alpha_target, "Coupling_Strength_MHz": g_target, "Cavity_Frequency_GHz": f_r} - df_flagged_1 = self.find_closest(target_params_1, num_top, metric, display=False) - - # Step 3: Scale qubit and coupling capacitor areas - - # Step 3.1: Extract the best matching design parameters - alpha_sim, g_sim = df_flagged_1['Qubit_Anharmonicity_MHz'].values[0], df_flagged_1['Coupling_Strength_MHz'].values[0] - f_q_sim, f_r_sim = df_flagged_1['Qubit_Frequency_GHz'].values[0], df_flagged_1['Cavity_Frequency_GHz'].values[0] - # C_q_sim, C_r_sim, C_c_sim, E_J_sim, E_C_sim = self.get_coupling_parameters(f_q_sim, f_r_sim, alpha_sim, g_sim, wavelength_type) - - # Step 3.2: Scale the qubit and coupling capacitor areas - qubit_ratio, coupling_ratio = alpha_sim/alpha_target, (alpha_sim/alpha_target)*(g_target/g_sim) - - # Step 3.3: Get the design dict for the best matching design - design = self.get_design(df_flagged_1) - - # Step 3.4: Scale the qubit and coupling capacitor areas and update the design dict - updated_design1 = self.get_updated_design_with_scaled_qubit_and_coupling_capacitor_areas(design, qubit_ratio, coupling_ratio) - - - # Step 4: Search database for best matching resonator design - target_params_resonator = {"Cavity_Frequency_GHz": f_r, "kappa_MHz": kappa, "wavelength": wavelength_type} - df_flagged_2 = self.find_closest(target_params_resonator, num_top, metric, display=False) - - # Step 4.1: Extract the best matching resonator design parameters - kappa_sim, f_r_sim = df_flagged_2['kappa_MHz'].values[0], df_flagged_2['Cavity_Frequency_GHz'].values[0] - alpha_sim, g_sim = df_flagged_2['Qubit_Anharmonicity_MHz'].values[0], df_flagged_2['Coupling_Strength_MHz'].values[0] - f_q_sim = df_flagged_2['Qubit_Frequency_GHz'].values[0] - # C_q_sim, C_r_sim, C_c_sim, E_J_sim, E_C_sim = self.get_coupling_parameters(f_q_sim, f_r_sim, alpha_sim, g_sim, wavelength_type) - - # Steps 5: Scale the resonator length and coupling dimension - - # Step 5.1: Get the design dict for the best matching resonator design - design = self.get_design(df_flagged_2) - - # Step 5.2: Scale the resonator length and coupling dimension - res_length_ratio, coupling_dim_ratio = f_r_sim/f_r, np.sqrt(kappa/kappa_sim) - - # Step 5.3: Scale the resonator length and coupling dimension and update the design dict - updated_design2 = self.get_updated_design_scaled_resonator_length_and_coupling_dim(design, res_length_ratio, coupling_dim_ratio) - - - # Step 6: C_c / C_r > 0.01 check and rescale the resonator length as necessary to hit the target - - # Step 6.1: Calculate the target resonator length - L_r = 1 / (C_r * (2*np.pi*f_r)** 2) - - if C_c / C_r > 0.01: - # Step 6.2: rescale the resonator length - omega_r = 1 / np.sqrt(L_r*(C_r + C_c)) - res_length_ratio = (2*np.pi*f_r_sim) / omega_r - updated_design2 = self.get_updated_design_scaled_resonator_length_and_coupling_dim(design, res_length_ratio, coupling_dim_ratio) - - - # TODO: create a `interpolated_design` dict using the updated information - # interpolated_designs = self.interpolate_design(updated_design1, updated_design2) - interpolated_designs = [updated_design1, updated_design2] - - - # Step 7: Return interpolated design and best matching df - df_design= self.find_closest(target_params, num_top, metric, display=False) - - return interpolated_designs, df_design - - def extract_area_parameters(self, options: dict[str, str]) -> dict[str, float]: - """ - Extracts parameters of interest related to the qubit and cavity capacitor - areas from the input options dictionary. - - Args: - options (dict): Configuration options for qubit and cavity. - - Returns: - dict: A dictionary containing the parameters of interest. - """ - # Define keys of interest - if "Transmon" in self.component_name: - keys_of_interest = [ - 'cavity_options.coupler_options.coupling_length', - 'cavity_options.coupler_options.prime_width', - 'qubit_options.cross_width', - 'qubit_options.cross_length' - ] - else: - raise NotImplementedError("The method for calculating qubit parameters for the chosen qubit type is not implemented.") - - # Extract parameters of interest - params_of_interest = {} - for key in keys_of_interest: - if key not in options: - raise KeyError(f"Key {key} not found in options") - params_of_interest[key] = float(options[key].strip('um')) - return params_of_interest - - + raise NotImplementedError - def get_updated_design_with_scaled_qubit_and_coupling_capacitor_areas(self, design, qubit_ratio, coupling_ratio): - """ - Scales the qubit and coupling capacitor areas by a given ratio and updates the design dict accordingly. - - Args: - design (dict): A dictionary containing the design parameters. - qubit_ratio (float): The ratio by which to scale the qubit area. - coupling_ratio (float): The ratio by which to scale the coupling capacitor area. - - Returns: - dict: Updated design dict with scaled areas. - """ - - # Check and scale qubit capacitor area - if 'Transmon' in self.component_name: - design['qubit_options.cross_length'] = scale_value(design['qubit_options.cross_length'], qubit_ratio) - else: - raise NotImplementedError("The method for calculating qubit parameters for the chosen qubit type is not implemented.") - - # Check and scale coupling capacitor area - coupling_type = design.get('cavity_options.coupling_type', '') - if coupling_type in ['capacitive', 'inductive']: - design['cavity_options.coupler_options.coupling_length'] = scale_value(design['cavity_options.coupler_options.coupling_length'], coupling_ratio) - elif 'interdig' in coupling_type: - # If finger_length is not in the coupler_options dictionary, set its default value - if 'finger_length' not in design.get('cavity_options.coupler_options', {}): - design['cavity_options.coupler_options']['finger_length'] = '50um' - design['cavity_options.coupler_options']['finger_length'] = scale_value(design['cavity_options.coupler_options']['finger_length'], coupling_ratio) - - return design - - def get_updated_design_scaled_resonator_length_and_coupling_dim(self, design, res_length_ratio, coupling_dim_ratio): - """ - Scales the resonator length and coupling dimension by a given ratio and updates the design dict accordingly. - - Args: - design (dict): A dictionary containing the design parameters. - res_length_ratio (float): The ratio by which to scale the resonator length. - coupling_dim_ratio (float): The ratio by which to scale the coupling dimension. - - Returns: - dict: Updated design dict with scaled areas. - """ - - # Check and scale resonator length - design['cavity_options.cpw_options.total_length'] = scale_value(design['cavity_options.cpw_options.total_length'], res_length_ratio) - - # Check and scale coupling dimensions - coupling_type = design.get('cavity_options.coupling_type', '') - if coupling_type in ['capacitive', 'inductive']: - design['cavity_options.coupler_options.coupling_length'] = scale_value(design['cavity_options.coupler_options.coupling_length'], coupling_dim_ratio) - elif 'interdig' in coupling_type: - # If finger_length is not in the coupler_options dictionary, set its default value - if 'finger_length' not in design.get('cavity_options.coupler_options', {}): - design['cavity_options.coupler_options']['finger_length'] = '50um' - design['cavity_options.coupler_options']['finger_length'] = scale_value(design['cavity_options.coupler_options']['finger_length'], coupling_dim_ratio) - - return design - def get_design(self, df): """ @@ -442,47 +198,3 @@ def interpolate_design(self, updated_design1, updated_design2): Interpolates the design parameters of the resonator and qubit to the design dict. """ raise NotImplementedError - - def get_coupling_parameters(self, f_q, f_r, alpha, g, wavelength_type, Z_q=50, Z_r=50): - """ - Numerically calculate the required qubit capacitance, coupling capacitance, and E_J. - For demonstration, using theoretical expressions. - - Args: - f_q (float): Qubit frequency in GHz. - f_r (float): Resonator frequency in GHz. - alpha (float): Qubit anharmonicity in MHz. - g (float): Coupling strength in MHz. - wavelength_type (str): Type of wavelength to use for calculating coupling capacitance. - Z_q (float): Qubit impedance in Ohms. - Z_r (float): Resonator impedance in Ohms. - Returns: - tuple: A tuple containing the calculated qubit capacitance, coupling capacitance, and E_J. - """ - PHI_0 = 2.067833848E-15 # Magnetic flux quantum - H = 6.62607015E-34 # Planck's constant - Q = 1.602176634E-19 # Elementary charge - - scq.set_units("GHz") - - - if "Transmon" in self.component_name: - # alpha to gigahertz - alpha = - alpha/1000 #to gigahertz - E_J, E_C = TunableTransmon.find_EJ_EC(E01=f_q, anharmonicity=alpha, ncut=30) - - C_q = Q ** 2 / (2 * E_C) # Qubit capacitance - - if wavelength_type == "lambda/4" or "quarter": - C_r = np.pi / (4 * Z_r * f_r) # Resonator capacitance - elif wavelength_type == "lambda/2" or "half": - C_r = np.pi / (2 * Z_r * f_r) # Resonator capacitance - - C_c = C_q * g * (C_r / (Q**2 * f_r))**1/2 * ((8*E_C)/E_J )**1/4 # Coupling capacitance (Here E_{C,q} = E_C) - - if E_J / E_C < 30: - warnings.warn("E_J/E_C < 30, the design may not be optimal.") - return C_q, C_r, C_c, E_J, E_C - - else: - raise NotImplementedError("The method for calculating qubit parameters for the chosen qubit type is not implemented.") diff --git a/squadds/core/db.py b/squadds/core/db.py index c350ad07..3544195b 100644 --- a/squadds/core/db.py +++ b/squadds/core/db.py @@ -6,76 +6,7 @@ import pandas as pd from addict import Dict import numpy as np - -# Function to convert numpy arrays to lists within an object -def convert_numpy(obj): - if isinstance(obj, np.ndarray): - return obj.tolist() - elif isinstance(obj, dict): - return {k: convert_numpy(v) for k, v in obj.items()} - elif isinstance(obj, list): - return [convert_numpy(v) for v in obj] - return obj - -# Function to create a unified design_options dictionary -def create_unified_design_options(row): - cavity_dict = convert_numpy(row["design_options_cavity_claw"]) - coupler_type = row["coupler_type"] - qubit_dict = convert_numpy(row["design_options_qubit"]) - - device_dict = { - "cavity_claw_options": { - "coupling_type": coupler_type, - "coupler_options": cavity_dict.get("cplr_opts", {}), - "cpw_options": { - "left_options": cavity_dict.get("cpw_opts", {}) - } - }, - "qubit_options": qubit_dict - } - - return device_dict - - -def flatten_df_second_level(df): - # Initialize an empty dictionary to collect flattened data - flattened_data = {} - - # Iterate over each column in the DataFrame - for column in df.columns: - # Check if the column contains dictionary-like data - if isinstance(df[column].iloc[0], dict): - # Iterate over second-level keys and create new columns - for key in df[column].iloc[0].keys(): - flattened_data[f"{key}"] = df[column].apply(lambda x: x[key] if key in x else None) - else: - # For non-dictionary data, keep as is - flattened_data[column] = df[column] - - # Create a new DataFrame with the flattened data - new_df = pd.DataFrame(flattened_data) - return new_df - -def filter_df_by_conditions(df, conditions): - # Ensure conditions is a dictionary - if not isinstance(conditions, dict): - print("Conditions must be provided as a dictionary.") - return None - - # Start with the original DataFrame - filtered_df = df - - # Apply each condition - for column, value in conditions.items(): - if column in filtered_df.columns: - filtered_df = filtered_df[filtered_df[column] == value] - - # Check if the filtered DataFrame is empty - if filtered_df.empty: - print("Warning: No rows match the given conditions. Returning the original DataFrame.") - return df - else: - return filtered_df +from squadds.core.utils import * class SQuADDS_DB(metaclass=SingletonMeta): @@ -91,6 +22,8 @@ def __init__(self): self.selected_coupler = None self.selected_system = None self.selected_df = None + self.target_param_keys = None + self.units = None def supported_components(self): components = [] @@ -370,6 +303,7 @@ def get_dataset(self, data_type=None, component=None, component_name=None): config = f"{component}-{component_name}-{data_type}" try: df = load_dataset(self.repo_name, config)["train"].to_pandas() + self._set_target_param_keys(df) return flatten_df_second_level(df) except Exception as e: print(f"An error occurred while loading the dataset: {e}") @@ -390,7 +324,7 @@ def selected_system_df(self): qubit_df = self.get_dataset(data_type="cap_matrix", component="qubit", component_name=self.selected_qubit) #TODO: handle dynamically cavity_df = self.get_dataset(data_type="eigenmode", component="cavity_claw", component_name=self.selected_cavity) #TODO: handle dynamically df = self.create_qubit_cavity_df(qubit_df, cavity_df, merger_terms=['claw_width', 'claw_length', 'claw_gap']) #TODO: handle with user awareness - self.selected_system_df = df + self.selected_df = df else: raise UserWarning("Selected system is either not specified or does not contain a cavity! Please check `self.selected_system`") return df @@ -434,6 +368,30 @@ def show_selections(self): print("Selected system: ", self.selected_system) print("Selected coupler: ", self.selected_coupler) + def _set_target_param_keys(self, df): + # ensure selected_df is not None + if self.selected_system is None: + raise UserWarning("No selected system df is created. Please check `self.selected_df`") + else: + # check if self.target_param_keys is None + if self.target_param_keys is None: + self.target_param_keys = get_sim_results_keys(df) + #check if target_param_keys is type list and system has more than one element + elif isinstance(self.target_param_keys, list) and len(self.selected_system) == 2: + self.target_param_keys += get_sim_results_keys(df) + #check if target_param_keys is type list and system has only one element + elif isinstance(self.target_param_keys, list) and len(self.selected_system) != 1: + self.target_param_keys = get_sim_results_keys(df) + else: + raise UserWarning("target_param_keys is not None or a list. Please check `self.target_param_keys`") + + # update the attribute to remove any elements that start with "unit" + self.target_param_keys = [key for key in self.target_param_keys if not key.startswith("unit")] + + def _get_units(self, df): + # TODO: needs implementation + raise NotImplementedError() + def unselect(self, param): if param == "component": self.selected_component = None diff --git a/squadds/core/metrics.py b/squadds/core/metrics.py index 053aec5a..e64f3565 100644 --- a/squadds/core/metrics.py +++ b/squadds/core/metrics.py @@ -5,7 +5,6 @@ import logging logging.basicConfig(level=logging.INFO) - class MetricStrategy(ABC): """Abstract class for metric strategies.""" @@ -109,7 +108,7 @@ def calculate(self, target_params: dict, row: pd.Series) -> float: if isinstance(target_value, (int, float)): simulated_value = row.get(param, 0) weight = self.weights.get(param, 1) - distance += weight * ((target_value - simulated_value) ** 2) / target_value + distance += weight * ((target_value - simulated_value) ** 2) / target_value**2 return distance class CustomMetric(MetricStrategy): diff --git a/squadds/core/selector.py b/squadds/core/selector.py deleted file mode 100644 index 9bcf98ec..00000000 --- a/squadds/core/selector.py +++ /dev/null @@ -1,4 +0,0 @@ -class Selector: - - def __init__(self): - pass \ No newline at end of file diff --git a/squadds/core/utils.py b/squadds/core/utils.py index ec87347e..4387a5f1 100644 --- a/squadds/core/utils.py +++ b/squadds/core/utils.py @@ -4,6 +4,141 @@ import os from huggingface_hub import HfApi, HfFolder from squadds.core.globals import ENV_FILE_PATH +import pandas as pd +import numpy as np + +def get_sim_results_keys(dataframes): + # Initialize an empty list to store all keys + all_keys = [] + + # Ensure the input is a list, even if it's a single dataframe + if not isinstance(dataframes, list): + dataframes = [dataframes] + + # Iterate over each dataframe + for df in dataframes: + # Check if 'sim_results' column exists in the dataframe + if 'sim_results' in df.columns: + # Extract keys from each row's 'sim_results' and add them to the list + for row in df['sim_results']: + if isinstance(row, dict): # Ensure the row is a dictionary + all_keys.extend(row.keys()) + + # Remove duplicates from the list + unique_keys = list(set(all_keys)) + + return unique_keys + +def convert_numpy(obj): + """ + Converts NumPy arrays to Python lists recursively. + + Args: + obj: The object to be converted. + + Returns: + The converted object. + + """ + if isinstance(obj, np.ndarray): + return obj.tolist() + elif isinstance(obj, dict): + return {k: convert_numpy(v) for k, v in obj.items()} + elif isinstance(obj, list): + return [convert_numpy(v) for v in obj] + return obj + +# Function to create a unified design_options dictionary +def create_unified_design_options(row): + """ + Create a unified design options dictionary based on the given row. + + Args: + row (pandas.Series): The row containing the design options. + + Returns: + dict: The unified design options dictionary. + """ + cavity_dict = convert_numpy(row["design_options_cavity_claw"]) + coupler_type = row["coupler_type"] + qubit_dict = convert_numpy(row["design_options_qubit"]) + + device_dict = { + "cavity_claw_options": { + "coupling_type": coupler_type, + "coupler_options": cavity_dict.get("cplr_opts", {}), + "cpw_options": { + "left_options": cavity_dict.get("cpw_opts", {}) + } + }, + "qubit_options": qubit_dict + } + + return device_dict + + +def flatten_df_second_level(df): + """ + Flattens a DataFrame by expanding dictionary-like data in the second level of columns. + + Args: + df (pandas.DataFrame): The DataFrame to be flattened. + + Returns: + pandas.DataFrame: A new DataFrame with the flattened data. + """ + # Initialize an empty dictionary to collect flattened data + flattened_data = {} + + # Iterate over each column in the DataFrame + for column in df.columns: + # Check if the column contains dictionary-like data + if isinstance(df[column].iloc[0], dict): + # Iterate over second-level keys and create new columns + for key in df[column].iloc[0].keys(): + flattened_data[f"{key}"] = df[column].apply(lambda x: x[key] if key in x else None) + else: + # For non-dictionary data, keep as is + flattened_data[column] = df[column] + + # Create a new DataFrame with the flattened data + new_df = pd.DataFrame(flattened_data) + return new_df + +def filter_df_by_conditions(df, conditions): + """ + Filter a DataFrame based on given conditions. + + Args: + df (pandas.DataFrame): The DataFrame to be filtered. + conditions (dict): A dictionary containing column-value pairs as conditions. + + Returns: + pandas.DataFrame: The filtered DataFrame. + + Raises: + None + + """ + # Ensure conditions is a dictionary + if not isinstance(conditions, dict): + print("Conditions must be provided as a dictionary.") + return None + + # Start with the original DataFrame + filtered_df = df + + # Apply each condition + for column, value in conditions.items(): + if column in filtered_df.columns: + filtered_df = filtered_df[filtered_df[column] == value] + + # Check if the filtered DataFrame is empty + if filtered_df.empty: + print("Warning: No rows match the given conditions. Returning the original DataFrame.") + return df + else: + return filtered_df def set_huggingface_api_key(): """ diff --git a/tutorials/Tutorial-1_Getting_Started_with_SQuADDS.ipynb b/tutorials/Tutorial-1_Getting_Started_with_SQuADDS.ipynb index 397a9bf6..09985aed 100644 --- a/tutorials/Tutorial-1_Getting_Started_with_SQuADDS.ipynb +++ b/tutorials/Tutorial-1_Getting_Started_with_SQuADDS.ipynb @@ -29,9 +29,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Obtaining file:///Users/shanto/LFL/SQuADDS/SQuADDS\n", + " Preparing metadata (setup.py) ... \u001b[?25ldone\n", + "\u001b[?25hInstalling collected packages: SQuADDS\n", + " Attempting uninstall: SQuADDS\n", + " Found existing installation: SQuADDS 0.0.1\n", + " Uninstalling SQuADDS-0.0.1:\n", + " Successfully uninstalled SQuADDS-0.0.1\n", + " Running setup.py develop for SQuADDS\n", + "Successfully installed SQuADDS-0.0.1\n" + ] + } + ], "source": [ "!pip install -e ../." ] @@ -155,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -164,31 +180,16 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "9da5d152d56247fcbf33fb5fcfa38de8", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Downloading readme: 0%| | 0.00/2.35k [00:00\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
claw_to_clawclaw_to_groundcross_to_clawcross_to_crosscross_to_groundground_to_groundunitsPIdate_createdgroupinstitutionuploaderrenderer_optionssetupsimulatordesign_optionsdesign_tool
094.9742190.865853.73363158.40783158.40783311.25590nHEli Levenson-Falk, PhD2023-09-20-142547LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
182.4428079.193782.93820188.15089188.15089333.52997nHEli Levenson-Falk, PhD2023-10-25-153123LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
283.7641280.181303.16131104.35340104.35340237.02548nHEli Levenson-Falk, PhD2023-09-20-142547LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
3103.3705797.224055.77590174.13928174.13928335.31609nHEli Levenson-Falk, PhD2023-10-25-153126LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
468.9285465.686072.87375120.03923120.03923240.34085nHEli Levenson-Falk, PhD2023-09-20-142547LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
......................................................
1929106.43025101.531974.45645174.46380174.46380340.62919nHEli Levenson-Falk, PhD2023-09-20-142547LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
1930121.10943112.625707.95178187.43537187.43537367.34003nHEli Levenson-Falk, PhD2023-09-20-142549LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
1931144.56289136.368107.65968172.14561172.14561372.39970nHEli Levenson-Falk, PhD2023-10-25-153123LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
193268.7641365.781162.4879556.7523056.75230166.57383nHEli Levenson-Falk, PhD2023-09-20-142547LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
193358.4574955.507962.5439662.0100062.01000162.42140nHEli Levenson-Falk, PhD2023-09-20-142549LFLUSCAndre Kuo{'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...{'auto_increase_solution_order': True, 'enable...Ansys HFSS{'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...qiskit-metal
\n", + "

1934 rows × 17 columns

\n", + "" + ], + "text/plain": [ + " claw_to_claw claw_to_ground cross_to_claw cross_to_cross \\\n", + "0 94.97421 90.86585 3.73363 158.40783 \n", + "1 82.44280 79.19378 2.93820 188.15089 \n", + "2 83.76412 80.18130 3.16131 104.35340 \n", + "3 103.37057 97.22405 5.77590 174.13928 \n", + "4 68.92854 65.68607 2.87375 120.03923 \n", + "... ... ... ... ... \n", + "1929 106.43025 101.53197 4.45645 174.46380 \n", + "1930 121.10943 112.62570 7.95178 187.43537 \n", + "1931 144.56289 136.36810 7.65968 172.14561 \n", + "1932 68.76413 65.78116 2.48795 56.75230 \n", + "1933 58.45749 55.50796 2.54396 62.01000 \n", + "\n", + " cross_to_ground ground_to_ground units PI \\\n", + "0 158.40783 311.25590 nH Eli Levenson-Falk, PhD \n", + "1 188.15089 333.52997 nH Eli Levenson-Falk, PhD \n", + "2 104.35340 237.02548 nH Eli Levenson-Falk, PhD \n", + "3 174.13928 335.31609 nH Eli Levenson-Falk, PhD \n", + "4 120.03923 240.34085 nH Eli Levenson-Falk, PhD \n", + "... ... ... ... ... \n", + "1929 174.46380 340.62919 nH Eli Levenson-Falk, PhD \n", + "1930 187.43537 367.34003 nH Eli Levenson-Falk, PhD \n", + "1931 172.14561 372.39970 nH Eli Levenson-Falk, PhD \n", + "1932 56.75230 166.57383 nH Eli Levenson-Falk, PhD \n", + "1933 62.01000 162.42140 nH Eli Levenson-Falk, PhD \n", + "\n", + " date_created group institution uploader \\\n", + "0 2023-09-20-142547 LFL USC Andre Kuo \n", + "1 2023-10-25-153123 LFL USC Andre Kuo \n", + "2 2023-09-20-142547 LFL USC Andre Kuo \n", + "3 2023-10-25-153126 LFL USC Andre Kuo \n", + "4 2023-09-20-142547 LFL USC Andre Kuo \n", + "... ... ... ... ... \n", + "1929 2023-09-20-142547 LFL USC Andre Kuo \n", + "1930 2023-09-20-142549 LFL USC Andre Kuo \n", + "1931 2023-10-25-153123 LFL USC Andre Kuo \n", + "1932 2023-09-20-142547 LFL USC Andre Kuo \n", + "1933 2023-09-20-142549 LFL USC Andre Kuo \n", + "\n", + " renderer_options \\\n", + "0 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "2 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "3 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "4 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "... ... \n", + "1929 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1930 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1931 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1932 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1933 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "\n", + " setup simulator \\\n", + "0 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "2 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "3 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "4 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "... ... ... \n", + "1929 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1930 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1931 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1932 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1933 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "\n", + " design_options design_tool \n", + "0 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "2 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "3 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "4 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "... ... ... \n", + "1929 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1930 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1931 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1932 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1933 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "\n", + "[1934 rows x 17 columns]" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = db.selected_system_df()\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['cross_to_ground',\n", + " 'cross_to_cross',\n", + " 'claw_to_claw',\n", + " 'cross_to_claw',\n", + " 'claw_to_ground',\n", + " 'ground_to_ground']" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "db.target_param_keys" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Querying for a target cavity design" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [], + "source": [ + "db.unselect_all()" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [], + "source": [ + "db.select_system(\"cavity_claw\")" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [], + "source": [ + "db.select_cavity_claw(\"RouteMeander\")" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [], + "source": [ + "db.select_coupler(\"CLT\")" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selected component: cavity_claw\n", + "Selected component name: RouteMeander\n", + "Selected data type: eigenmode\n", + "Selected system: cavity_claw\n", + "Selected coupler: CLT\n" + ] + } + ], + "source": [ + "db.show_selections()" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [], + "source": [ + "df = db.selected_system_df()" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cavity_frequencykappaunitsPIdate_createdgroupinstitutionuploadersetupsimulatorcoupler_typedesign_optionsdesign_toolresonator_type
05.353550e+09161106.598429HzEli Levenson-Falk, PhD2023-12-01-170608LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
18.399241e+09268412.116632HzEli Levenson-Falk, PhD2023-12-04-124953LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
28.694845e+09255873.654612HzEli Levenson-Falk, PhD2023-12-09-204334LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
36.616574e+0930459.761161HzEli Levenson-Falk, PhD2023-12-08-173545LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
47.986835e+09208304.221064HzEli Levenson-Falk, PhD2023-12-09-204334LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
.............................................
2294.949469e+09126438.881378HzEli Levenson-Falk, PhD2023-12-01-170608LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
2308.805442e+09291439.656224HzEli Levenson-Falk, PhD2023-12-04-124953LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
2316.597444e+09587144.918000HzEli Levenson-Falk, PhD2023-12-06-224829LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
2328.116894e+09209744.544864HzEli Levenson-Falk, PhD2023-12-09-204334LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
2335.145996e+09155139.565546HzEli Levenson-Falk, PhD2023-12-01-170608LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
\n", + "

234 rows × 14 columns

\n", + "
" + ], + "text/plain": [ + " cavity_frequency kappa units PI \\\n", + "0 5.353550e+09 161106.598429 Hz Eli Levenson-Falk, PhD \n", + "1 8.399241e+09 268412.116632 Hz Eli Levenson-Falk, PhD \n", + "2 8.694845e+09 255873.654612 Hz Eli Levenson-Falk, PhD \n", + "3 6.616574e+09 30459.761161 Hz Eli Levenson-Falk, PhD \n", + "4 7.986835e+09 208304.221064 Hz Eli Levenson-Falk, PhD \n", + ".. ... ... ... ... \n", + "229 4.949469e+09 126438.881378 Hz Eli Levenson-Falk, PhD \n", + "230 8.805442e+09 291439.656224 Hz Eli Levenson-Falk, PhD \n", + "231 6.597444e+09 587144.918000 Hz Eli Levenson-Falk, PhD \n", + "232 8.116894e+09 209744.544864 Hz Eli Levenson-Falk, PhD \n", + "233 5.145996e+09 155139.565546 Hz Eli Levenson-Falk, PhD \n", + "\n", + " date_created group institution uploader \\\n", + "0 2023-12-01-170608 LFL USC Andre Kuo \n", + "1 2023-12-04-124953 LFL USC Andre Kuo \n", + "2 2023-12-09-204334 LFL USC Andre Kuo \n", + "3 2023-12-08-173545 LFL USC Andre Kuo \n", + "4 2023-12-09-204334 LFL USC Andre Kuo \n", + ".. ... ... ... ... \n", + "229 2023-12-01-170608 LFL USC Andre Kuo \n", + "230 2023-12-04-124953 LFL USC Andre Kuo \n", + "231 2023-12-06-224829 LFL USC Andre Kuo \n", + "232 2023-12-09-204334 LFL USC Andre Kuo \n", + "233 2023-12-01-170608 LFL USC Andre Kuo \n", + "\n", + " setup simulator \\\n", + "0 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "1 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "2 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "3 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "4 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + ".. ... ... \n", + "229 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "230 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "231 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "232 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "233 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "\n", + " coupler_type design_options \\\n", + "0 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "1 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "2 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "3 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "4 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + ".. ... ... \n", + "229 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "230 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "231 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "232 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "233 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "\n", + " design_tool resonator_type \n", + "0 qiskit-metal quarter \n", + "1 qiskit-metal quarter \n", + "2 qiskit-metal quarter \n", + "3 qiskit-metal quarter \n", + "4 qiskit-metal quarter \n", + ".. ... ... \n", + "229 qiskit-metal quarter \n", + "230 qiskit-metal quarter \n", + "231 qiskit-metal quarter \n", + "232 qiskit-metal quarter \n", + "233 qiskit-metal quarter \n", + "\n", + "[234 rows x 14 columns]" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['cavity_frequency', 'kappa']" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "db.target_param_keys" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [], + "source": [ + "from squadds import Analyzer" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [], + "source": [ + "analyzer = Analyzer(db)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['cavity_frequency', 'kappa']" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "analyzer.target_param_keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [], + "source": [ + "target_params = {\"cavity_frequency\": 6.9e9,\n", + " \"kappa\": 120e3}" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cavity_frequencykappaunitsPIdate_createdgroupinstitutionuploadersetupsimulatorcoupler_typedesign_optionsdesign_toolresonator_type
326.903565e+0935476.351309HzEli Levenson-Falk, PhD2023-12-08-173545LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
1666.932093e+0925525.969447HzEli Levenson-Falk, PhD2023-12-08-173545LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
156.861346e+09157507.137353HzEli Levenson-Falk, PhD2023-11-30-214122LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
\n", + "
" + ], + "text/plain": [ + " cavity_frequency kappa units PI \\\n", + "32 6.903565e+09 35476.351309 Hz Eli Levenson-Falk, PhD \n", + "166 6.932093e+09 25525.969447 Hz Eli Levenson-Falk, PhD \n", + "15 6.861346e+09 157507.137353 Hz Eli Levenson-Falk, PhD \n", + "\n", + " date_created group institution uploader \\\n", + "32 2023-12-08-173545 LFL USC Andre Kuo \n", + "166 2023-12-08-173545 LFL USC Andre Kuo \n", + "15 2023-11-30-214122 LFL USC Andre Kuo \n", + "\n", + " setup simulator \\\n", + "32 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "166 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "15 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "\n", + " coupler_type design_options \\\n", + "32 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "166 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "15 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "\n", + " design_tool resonator_type \n", + "32 qiskit-metal quarter \n", + "166 qiskit-metal quarter \n", + "15 qiskit-metal quarter " + ] + }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "results = analyzer.find_closest(target_params=target_params,\n", + " num_top=3,\n", + " metric=\"Euclidean\",\n", + " display=True)\n", + "results" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [], + "source": [ + "# Set up the weights\n", + "analyzer.metric_weights = {\"cavity_frequency\": 1, \"kappa\": 2}" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
cavity_frequencykappaunitsPIdate_createdgroupinstitutionuploadersetupsimulatorcoupler_typedesign_optionsdesign_toolresonator_type
1906.371017e+09121824.395058HzEli Levenson-Falk, PhD2023-11-30-214122LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
1236.339319e+09121639.168098HzEli Levenson-Falk, PhD2023-11-30-214122LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
646.316474e+09122186.081379HzEli Levenson-Falk, PhD2023-11-30-214122LFLUSCAndre Kuo{'basis_order': 1, 'max_delta_f': 0.05, 'max_p...Ansys HFSSCLT{'claw_opts': {'connection_pads': {'readout': ...qiskit-metalquarter
\n", + "
" + ], + "text/plain": [ + " cavity_frequency kappa units PI \\\n", + "190 6.371017e+09 121824.395058 Hz Eli Levenson-Falk, PhD \n", + "123 6.339319e+09 121639.168098 Hz Eli Levenson-Falk, PhD \n", + "64 6.316474e+09 122186.081379 Hz Eli Levenson-Falk, PhD \n", + "\n", + " date_created group institution uploader \\\n", + "190 2023-11-30-214122 LFL USC Andre Kuo \n", + "123 2023-11-30-214122 LFL USC Andre Kuo \n", + "64 2023-11-30-214122 LFL USC Andre Kuo \n", + "\n", + " setup simulator \\\n", + "190 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "123 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "64 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + "\n", + " coupler_type design_options \\\n", + "190 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "123 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "64 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + "\n", + " design_tool resonator_type \n", + "190 qiskit-metal quarter \n", + "123 qiskit-metal quarter \n", + "64 qiskit-metal quarter " + ] + }, + "execution_count": 92, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "results = analyzer.find_closest(target_params=target_params,\n", + " num_top=3,\n", + " metric=\"Weighted Euclidean\",\n", + " display=True)\n", + "results" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Querying for a target qubit-cavity design" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [], + "source": [ + "db.select_system([\"qubit\",\"cavity_claw\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [], + "source": [ + "db.select_qubit(\"TransmonCross\")\n", + "db.select_cavity_claw(\"RouteMeander\")\n", + "db.select_coupler(\"CLT\")" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Selected qubit: TransmonCross\n", + "Selected cavity: RouteMeander\n", + "Selected coupler: CLT\n", + "Selected system: ['qubit', 'cavity_claw']\n" ] } ], @@ -477,7 +1488,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 60, "metadata": {}, "outputs": [ { @@ -501,107 +1512,125 @@ " \n", " \n", " \n", - " cavity_frequency\n", - " kappa\n", + " claw_to_claw\n", + " claw_to_ground\n", + " cross_to_claw\n", + " cross_to_cross\n", + " cross_to_ground\n", + " ground_to_ground\n", " units\n", " PI\n", " date_created\n", " group\n", " institution\n", " uploader\n", + " renderer_options\n", " setup\n", " simulator\n", - " coupler_type\n", " design_options\n", " design_tool\n", - " resonator_type\n", " \n", " \n", " \n", " \n", " 0\n", - " 5.353550e+09\n", - " 161106.598429\n", - " Hz\n", + " 94.97421\n", + " 90.86585\n", + " 3.73363\n", + " 158.40783\n", + " 158.40783\n", + " 311.25590\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-01-170608\n", + " 2023-09-20-142547\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", " 1\n", - " 8.399241e+09\n", - " 268412.116632\n", - " Hz\n", + " 82.44280\n", + " 79.19378\n", + " 2.93820\n", + " 188.15089\n", + " 188.15089\n", + " 333.52997\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-04-124953\n", + " 2023-10-25-153123\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", " 2\n", - " 8.694845e+09\n", - " 255873.654612\n", - " Hz\n", + " 83.76412\n", + " 80.18130\n", + " 3.16131\n", + " 104.35340\n", + " 104.35340\n", + " 237.02548\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-09-204334\n", + " 2023-09-20-142547\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", " 3\n", - " 6.616574e+09\n", - " 30459.761161\n", - " Hz\n", + " 103.37057\n", + " 97.22405\n", + " 5.77590\n", + " 174.13928\n", + " 174.13928\n", + " 335.31609\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-08-173545\n", + " 2023-10-25-153126\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", " 4\n", - " 7.986835e+09\n", - " 208304.221064\n", - " Hz\n", + " 68.92854\n", + " 65.68607\n", + " 2.87375\n", + " 120.03923\n", + " 120.03923\n", + " 240.34085\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-09-204334\n", + " 2023-09-20-142547\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", " ...\n", @@ -619,232 +1648,209 @@ " ...\n", " ...\n", " ...\n", + " ...\n", + " ...\n", + " ...\n", " \n", " \n", - " 229\n", - " 4.949469e+09\n", - " 126438.881378\n", - " Hz\n", + " 1929\n", + " 106.43025\n", + " 101.53197\n", + " 4.45645\n", + " 174.46380\n", + " 174.46380\n", + " 340.62919\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-01-170608\n", + " 2023-09-20-142547\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", - " 230\n", - " 8.805442e+09\n", - " 291439.656224\n", - " Hz\n", + " 1930\n", + " 121.10943\n", + " 112.62570\n", + " 7.95178\n", + " 187.43537\n", + " 187.43537\n", + " 367.34003\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-04-124953\n", + " 2023-09-20-142549\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", - " 231\n", - " 6.597444e+09\n", - " 587144.918000\n", - " Hz\n", + " 1931\n", + " 144.56289\n", + " 136.36810\n", + " 7.65968\n", + " 172.14561\n", + " 172.14561\n", + " 372.39970\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-06-224829\n", + " 2023-10-25-153123\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", - " 232\n", - " 8.116894e+09\n", - " 209744.544864\n", - " Hz\n", + " 1932\n", + " 68.76413\n", + " 65.78116\n", + " 2.48795\n", + " 56.75230\n", + " 56.75230\n", + " 166.57383\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-09-204334\n", + " 2023-09-20-142547\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", - " 233\n", - " 5.145996e+09\n", - " 155139.565546\n", - " Hz\n", + " 1933\n", + " 58.45749\n", + " 55.50796\n", + " 2.54396\n", + " 62.01000\n", + " 62.01000\n", + " 162.42140\n", + " nH\n", " Eli Levenson-Falk, PhD\n", - " 2023-12-01-170608\n", + " 2023-09-20-142549\n", " LFL\n", " USC\n", " Andre Kuo\n", - " {'basis_order': 1, 'max_delta_f': 0.05, 'max_p...\n", + " {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name...\n", + " {'auto_increase_solution_order': True, 'enable...\n", " Ansys HFSS\n", - " CLT\n", - " {'claw_opts': {'connection_pads': {'readout': ...\n", + " {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct...\n", " qiskit-metal\n", - " quarter\n", " \n", " \n", "\n", - "

234 rows × 14 columns

\n", + "

1934 rows × 17 columns

\n", "" ], "text/plain": [ - " cavity_frequency kappa units PI \\\n", - "0 5.353550e+09 161106.598429 Hz Eli Levenson-Falk, PhD \n", - "1 8.399241e+09 268412.116632 Hz Eli Levenson-Falk, PhD \n", - "2 8.694845e+09 255873.654612 Hz Eli Levenson-Falk, PhD \n", - "3 6.616574e+09 30459.761161 Hz Eli Levenson-Falk, PhD \n", - "4 7.986835e+09 208304.221064 Hz Eli Levenson-Falk, PhD \n", - ".. ... ... ... ... \n", - "229 4.949469e+09 126438.881378 Hz Eli Levenson-Falk, PhD \n", - "230 8.805442e+09 291439.656224 Hz Eli Levenson-Falk, PhD \n", - "231 6.597444e+09 587144.918000 Hz Eli Levenson-Falk, PhD \n", - "232 8.116894e+09 209744.544864 Hz Eli Levenson-Falk, PhD \n", - "233 5.145996e+09 155139.565546 Hz Eli Levenson-Falk, PhD \n", + " claw_to_claw claw_to_ground cross_to_claw cross_to_cross \\\n", + "0 94.97421 90.86585 3.73363 158.40783 \n", + "1 82.44280 79.19378 2.93820 188.15089 \n", + "2 83.76412 80.18130 3.16131 104.35340 \n", + "3 103.37057 97.22405 5.77590 174.13928 \n", + "4 68.92854 65.68607 2.87375 120.03923 \n", + "... ... ... ... ... \n", + "1929 106.43025 101.53197 4.45645 174.46380 \n", + "1930 121.10943 112.62570 7.95178 187.43537 \n", + "1931 144.56289 136.36810 7.65968 172.14561 \n", + "1932 68.76413 65.78116 2.48795 56.75230 \n", + "1933 58.45749 55.50796 2.54396 62.01000 \n", "\n", - " date_created group institution uploader \\\n", - "0 2023-12-01-170608 LFL USC Andre Kuo \n", - "1 2023-12-04-124953 LFL USC Andre Kuo \n", - "2 2023-12-09-204334 LFL USC Andre Kuo \n", - "3 2023-12-08-173545 LFL USC Andre Kuo \n", - "4 2023-12-09-204334 LFL USC Andre Kuo \n", - ".. ... ... ... ... \n", - "229 2023-12-01-170608 LFL USC Andre Kuo \n", - "230 2023-12-04-124953 LFL USC Andre Kuo \n", - "231 2023-12-06-224829 LFL USC Andre Kuo \n", - "232 2023-12-09-204334 LFL USC Andre Kuo \n", - "233 2023-12-01-170608 LFL USC Andre Kuo \n", + " cross_to_ground ground_to_ground units PI \\\n", + "0 158.40783 311.25590 nH Eli Levenson-Falk, PhD \n", + "1 188.15089 333.52997 nH Eli Levenson-Falk, PhD \n", + "2 104.35340 237.02548 nH Eli Levenson-Falk, PhD \n", + "3 174.13928 335.31609 nH Eli Levenson-Falk, PhD \n", + "4 120.03923 240.34085 nH Eli Levenson-Falk, PhD \n", + "... ... ... ... ... \n", + "1929 174.46380 340.62919 nH Eli Levenson-Falk, PhD \n", + "1930 187.43537 367.34003 nH Eli Levenson-Falk, PhD \n", + "1931 172.14561 372.39970 nH Eli Levenson-Falk, PhD \n", + "1932 56.75230 166.57383 nH Eli Levenson-Falk, PhD \n", + "1933 62.01000 162.42140 nH Eli Levenson-Falk, PhD \n", "\n", - " setup simulator \\\n", - "0 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "1 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "2 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "3 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "4 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - ".. ... ... \n", - "229 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "230 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "231 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "232 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", - "233 {'basis_order': 1, 'max_delta_f': 0.05, 'max_p... Ansys HFSS \n", + " date_created group institution uploader \\\n", + "0 2023-09-20-142547 LFL USC Andre Kuo \n", + "1 2023-10-25-153123 LFL USC Andre Kuo \n", + "2 2023-09-20-142547 LFL USC Andre Kuo \n", + "3 2023-10-25-153126 LFL USC Andre Kuo \n", + "4 2023-09-20-142547 LFL USC Andre Kuo \n", + "... ... ... ... ... \n", + "1929 2023-09-20-142547 LFL USC Andre Kuo \n", + "1930 2023-09-20-142549 LFL USC Andre Kuo \n", + "1931 2023-10-25-153123 LFL USC Andre Kuo \n", + "1932 2023-09-20-142547 LFL USC Andre Kuo \n", + "1933 2023-09-20-142549 LFL USC Andre Kuo \n", "\n", - " coupler_type design_options \\\n", - "0 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "1 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "2 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "3 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "4 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - ".. ... ... \n", - "229 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "230 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "231 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "232 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", - "233 CLT {'claw_opts': {'connection_pads': {'readout': ... \n", + " renderer_options \\\n", + "0 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "2 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "3 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "4 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "... ... \n", + "1929 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1930 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1931 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1932 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", + "1933 {'Cj': 0, 'Lj': '10nH', '_Rj': 0, 'design_name... \n", "\n", - " design_tool resonator_type \n", - "0 qiskit-metal quarter \n", - "1 qiskit-metal quarter \n", - "2 qiskit-metal quarter \n", - "3 qiskit-metal quarter \n", - "4 qiskit-metal quarter \n", - ".. ... ... \n", - "229 qiskit-metal quarter \n", - "230 qiskit-metal quarter \n", - "231 qiskit-metal quarter \n", - "232 qiskit-metal quarter \n", - "233 qiskit-metal quarter \n", + " setup simulator \\\n", + "0 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "2 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "3 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "4 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "... ... ... \n", + "1929 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1930 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1931 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1932 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", + "1933 {'auto_increase_solution_order': True, 'enable... Ansys HFSS \n", "\n", - "[234 rows x 14 columns]" + " design_options design_tool \n", + "0 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "2 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "3 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "4 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "... ... ... \n", + "1929 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1930 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1931 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1932 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "1933 {'aedt_hfss_capacitance': 0, 'aedt_hfss_induct... qiskit-metal \n", + "\n", + "[1934 rows x 17 columns]" ] }, - "execution_count": 11, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "db.selected_system_df()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Querying for a target qubit-cavity design" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "db.select_system([\"qubit\",\"cavity_claw\"])" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [], - "source": [ - "db.select_qubit(\"TransmonCross\")\n", - "db.select_cavity_claw(\"RouteMeander\")\n", - "db.select_coupler(\"CLT\")" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Selected qubit: TransmonCross\n", - "Selected cavity: RouteMeander\n", - "Selected coupler: CLT\n", - "Selected system: ['qubit', 'cavity_claw']\n" - ] - } - ], - "source": [ - "db.show_selections()" + "db.selected_df" ] }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ @@ -853,7 +1859,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 62, "metadata": {}, "outputs": [ { @@ -1291,7 +2297,7 @@ "[11604 rows x 32 columns]" ] }, - "execution_count": 79, + "execution_count": 62, "metadata": {}, "output_type": "execute_result" } @@ -1301,10 +2307,12 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ - "### Simulating the \"best-guess\" design" + "analzyer = Analyzer(db)" ] }, { @@ -1313,7 +2321,7 @@ "metadata": {}, "outputs": [], "source": [ - "cavity_df.iloc[0][\"design_options\"][\"claw_opts\"][\"connection_pads\"][\"readout\"]" + "analzyer.__supported_metrics__" ] }, { @@ -1321,10 +2329,22 @@ "execution_count": null, "metadata": {}, "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, "source": [ - "qubit_df.iloc[0][\"design_options\"][\"connection_pads\"][\"c\"]" + "### Simulating the \"best-guess\" design" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {},