Plot
build_title(title, path, params)
Build a plot title that includes the values of given parameters found in the params_dict.json file, e.g. One tone with I = 0.5 mA.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str
|
Title of the plot to which the parameters will be appended. |
required |
path
|
str
|
Path to the param_dict.json file. |
required |
params
|
List[str]
|
List of keys of parameters in the param_dict.json file. |
required |
Returns:
Type | Description |
---|---|
str
|
The original title followed by parameter values. |
Source code in sqil_core/utils/_plot.py
finalize_plot(fig, title, fit_res=None, qubit_params={}, updated_params={}, sweep_info={}, relevant_params=[])
Annotates a matplotlib figure with experiment parameters, fit quality, and title.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig
|
Figure
|
The figure object to annotate. |
required |
title
|
str
|
Title text to use for the plot. |
required |
fit_res
|
FitResult
|
Fit result object containing model name and quality summary. |
None
|
qubit_params
|
ParamDict
|
Dictionary of experimental qubit parameters, indexed by parameter ID. |
{}
|
updated_params
|
dict
|
Dictionary of updated parameters (e.g., from fitting), where keys are param IDs and values are numeric or symbolic parameter values. |
{}
|
sweep_info
|
dict
|
Information about sweep parameters (e.g., their IDs and labels). |
{}
|
relevant_params
|
list
|
List of parameter IDs considered relevant for display under "Experiment". |
[]
|
Source code in sqil_core/utils/_plot.py
get_x_id_by_plot_dim(exp_id, plot_dim, sweep_param_id)
Returns the param_id of the parameter that should be used as the x-axis.
Source code in sqil_core/utils/_plot.py
guess_plot_dimension(f, sweep=[], threshold_2D=10)
Guess if the plot should be a 1D line, a collection of 1D lines (1.5D), or a 2D color plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
ndarray
|
Main variable, usually frequency |
required |
sweep
|
Union[ndarray, List]
|
Sweep variable, by default [] |
[]
|
threshold_2D
|
int
|
Threshold of sweeping parameters after which the data is considered, by default 10 |
10
|
Returns:
Type | Description |
---|---|
Tuple[Union['1', '1.5', '2'], ndarray]
|
The plot dimension ('1', '1.5' or '2') and the vector that should be used as the x axis in the plot. |
Source code in sqil_core/utils/_plot.py
plot_mag_phase(path=None, datadict=None, raw=False)
Plot the magnitude and phase of complex measurement data from an db path or in-memory dictionary.
This function generates either a 1D or 2D plot of the magnitude and phase of complex data, depending on the presence of sweep parameters. It supports normalization and background subtraction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str or None
|
Path to the folder containing measurement data. Required if |
None
|
datadict
|
dict or None
|
Pre-loaded data dictionary with schema, typically extracted using |
None
|
raw
|
bool
|
If True, skip normalization and background subtraction for 2D plots. Useful for viewing raw data. |
False
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure
|
The matplotlib Figure object containing the plot. |
axs |
matplotlib.axes.Axes or ndarray of Axes
|
The Axes object(s) used for the subplot(s). |
Raises:
Type | Description |
---|---|
Exception
|
If neither |
Notes
- Axes and units are automatically inferred from the schema in the dataset.
Source code in sqil_core/utils/_plot.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
plot_projection_IQ(path=None, datadict=None, proj_data=None, full_output=False)
Plots the real projection of complex I/Q data versus the x-axis and the full IQ plane.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to the HDF5 file containing the data. Required if |
None
|
datadict
|
dict
|
Pre-loaded data dictionary with schema, typically extracted using |
None
|
proj_data
|
ndarray
|
Precomputed projected data (real part of transformed complex values).
If not provided, it will be computed using |
None
|
full_output
|
bool
|
Whether to return projected data and the inverse transformation function. |
False
|
Returns:
Name | Type | Description |
---|---|---|
res |
tuple
|
If |
Notes
This function supports only 1D datasets. If sweep dimensions are detected, no plot is created. The projection is performed using a data transformation routine (e.g., PCA or rotation).
Source code in sqil_core/utils/_plot.py
reset_plot_style(plt)
set_plot_style(plt)
Sets the matplotlib plotting style to a SQIL curated one.