1
1
import iklayout # type: ignore
2
2
import matplotlib .pyplot as plt # type: ignore
3
3
from ipywidgets import interactive , IntSlider # type: ignore
4
- from typing import List
4
+ from typing import List , Optional
5
5
6
6
7
7
def plot_circuit (component ):
@@ -23,7 +23,7 @@ def plot_circuit(component):
23
23
24
24
25
25
def plot_losses (
26
- losses : List [float ], iterations : List [int ] | None = None , return_fig : bool = True
26
+ losses : List [float ], iterations : Optional [ List [int ]] = None , return_fig : bool = True
27
27
):
28
28
"""
29
29
Plot a list of losses with labels.
@@ -45,8 +45,8 @@ def plot_losses(
45
45
46
46
def plot_constraints (
47
47
constraints : List [List [float ]],
48
- constraints_labels : List [str ] | None = None ,
49
- iterations : List [int ] | None = None ,
48
+ constraints_labels : Optional [ List [str ]] = None ,
49
+ iterations : Optional [ List [int ]] = None ,
50
50
return_fig : bool = True ,
51
51
):
52
52
"""
@@ -80,8 +80,8 @@ def plot_constraints(
80
80
def plot_single_spectrum (
81
81
spectrum : List [float ],
82
82
wavelengths : List [float ],
83
- vlines : List [float ] | None = None ,
84
- hlines : List [float ] | None = None ,
83
+ vlines : Optional [ List [float ]] = None ,
84
+ hlines : Optional [ List [float ]] = None ,
85
85
return_fig : bool = True ,
86
86
):
87
87
"""
@@ -112,10 +112,10 @@ def plot_single_spectrum(
112
112
def plot_interactive_spectrums (
113
113
spectrums : List [List [List [float ]]],
114
114
wavelengths : List [float ],
115
- spectrum_labels : List [str ] | None = None ,
116
- slider_index : List [int ] | None = None ,
117
- vlines : List [float ] | None = None ,
118
- hlines : List [float ] | None = None ,
115
+ spectrum_labels : Optional [ List [str ]] = None ,
116
+ slider_index : Optional [ List [int ]] = None ,
117
+ vlines : Optional [ List [float ]] = None ,
118
+ hlines : Optional [ List [float ]] = None ,
119
119
):
120
120
"""
121
121
Creates an interactive plot of spectrums with a slider to select different indices.
0 commit comments