-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plotter added as well. interpolater started
- Loading branch information
Showing
7 changed files
with
148 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .interpolator import Interpolator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from abc import ABC, abstractmethod | ||
import pandas as pd | ||
|
||
class Interpolator(ABC): | ||
"""Abstract class for interpolators.""" | ||
|
||
def __init__(self, df: pd.DataFrame, target_params: dict): | ||
self.df = df | ||
self.target_params = target_params | ||
|
||
@abstractmethod | ||
def get_design(self) -> pd.DataFrame: | ||
"""Interpolate based on the target parameters. | ||
Returns: | ||
pd.DataFrame: DataFrame with interpolated design options. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from squadds.interpolations import Interpolator | ||
import pandas as pd | ||
|
||
class ScalingInterpolator(Interpolator): | ||
"""Concrete class for scaling based interpolation.""" | ||
|
||
def __init__(self, df: pd.DataFrame, target_params: dict): | ||
super().__init__(df, target_params) | ||
|
||
def get_design(self) -> pd.DataFrame: | ||
"""Performs interpolation based on scaling logic. | ||
Returns: | ||
pd.DataFrame: DataFrame with interpolated design options. | ||
""" | ||
# Initialize lists to store the updated values | ||
updated_design_options = [] | ||
required_LJs = [] | ||
presimmed_best_qubit_designs = [] | ||
presimmed_best_cpw_designs = [] | ||
|
||
# Extract target parameters | ||
f_q_target = self.target_params['qubit_frequency_GHz'] | ||
g_target = self.target_params['g_MHz'] | ||
alpha_target = self.target_params['anharmonicity_MHz'] | ||
f_res_target = self.target_params['cavity_frequency_GHz'] | ||
kappa_target = self.target_params['kappa_kHz'] | ||
res_type = self.target_params['resonator_type'] | ||
|
||
# Placeholder for the calculate_target_quantities function | ||
# C_q_target, C_C_target, E_J, E_C_target, EJ_over_EC = calculate_target_quantities(...) | ||
|
||
# Placeholder for LJ_target calculation | ||
LJ_target = 10 # This should be computed based on E_J | ||
required_LJs.append(LJ_target) | ||
|
||
# Placeholder for updating the DataFrame with anharmonicity, g, and qubit frequency | ||
# self.df["g"], self.df["anharmonicity"], self.df["qubit_frequency"] = compute_g_alpha_freq(...) | ||
|
||
# Placeholder logic for finding the best qubit-claw and cpw-claw design | ||
# Implement actual logic here | ||
idx1, closest_qubit_claw_design = 0, self.df.iloc[0] # Placeholder | ||
idx2, closest_claw_cpw_design = 0, self.df.iloc[0] # Placeholder | ||
|
||
# Calculate scaling factors | ||
alpha_scaling = closest_qubit_claw_design['anharmonicity'] / alpha_target | ||
g_scaling = g_target / closest_qubit_claw_design['g'] | ||
|
||
# Update the lengths based on the closest design and scaling | ||
updated_cross_length = closest_qubit_claw_design['cross_length'] * alpha_scaling | ||
updated_claw_length = closest_qubit_claw_design['claw_length'] * g_scaling * alpha_scaling | ||
updated_resonator_length = closest_claw_cpw_design['total_length'] * (closest_claw_cpw_design['cavity_frequency'] / f_res_target) | ||
updated_coupling_length = closest_claw_cpw_design['coupling_length'] * (kappa_target / closest_claw_cpw_design['kappa']) ** 0.5 | ||
|
||
# Append the updated lengths to the lists | ||
updated_design_options.append({ | ||
'cross_length': updated_cross_length, | ||
'claw_length': updated_claw_length, | ||
'resonator_length': updated_resonator_length, | ||
'coupling_length': updated_coupling_length | ||
}) | ||
presimmed_best_qubit_designs.append(closest_qubit_claw_design) | ||
presimmed_best_cpw_designs.append(closest_claw_cpw_design) | ||
|
||
# Return DataFrame with updated values | ||
return pd.DataFrame({ | ||
'updated_design_options': updated_design_options, | ||
'required_LJs': required_LJs, | ||
'presimmed_best_qubit_designs': presimmed_best_qubit_designs, | ||
'presimmed_best_cpw_designs': presimmed_best_cpw_designs | ||
}) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters