pulse_diagram ============= .. py:module:: quantify_scheduler.schedules._visualization.pulse_diagram .. autoapi-nested-parse:: Functions for drawing pulse diagrams Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.schedules._visualization.pulse_diagram.SampledPulse Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.schedules._visualization.pulse_diagram._populate_port_mapping quantify_scheduler.schedules._visualization.pulse_diagram.validate_operation_data quantify_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_plotly quantify_scheduler.schedules._visualization.pulse_diagram.sample_schedule quantify_scheduler.schedules._visualization.pulse_diagram.deduplicate_legend_handles_labels quantify_scheduler.schedules._visualization.pulse_diagram.plot_single_subplot_mpl quantify_scheduler.schedules._visualization.pulse_diagram.plot_multiple_subplots_mpl quantify_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_matplotlib quantify_scheduler.schedules._visualization.pulse_diagram.get_window_operations quantify_scheduler.schedules._visualization.pulse_diagram.plot_window_operations quantify_scheduler.schedules._visualization.pulse_diagram.plot_acquisition_operations Attributes ~~~~~~~~~~ .. autoapisummary:: quantify_scheduler.schedules._visualization.pulse_diagram.logger .. py:data:: logger .. py:function:: _populate_port_mapping(schedule, portmap: Dict[str, int], ports_length) -> None Dynamically add up to 8 ports to the port_map dictionary. .. py:function:: validate_operation_data(operation_data, port_map, schedulable, operation) Validates if the pulse/acquisition information is valid for visualization. .. py:function:: pulse_diagram_plotly(schedule: quantify_scheduler.Schedule | quantify_scheduler.CompiledSchedule, port_list: Optional[List[str]] = None, fig_ch_height: float = 300, fig_width: float = 1000, modulation: Literal[off, if, clock] = 'off', modulation_if: float = 0.0, sampling_rate: float = 1000000000.0) -> plotly.graph_objects.Figure Produce a plotly visualization of the pulses used in the schedule. :param schedule: The schedule to render. :param port_list: A list of ports to show. if set to `None` will use the first 8 ports it encounters in the sequence. :param fig_ch_height: Height for each channel subplot in px. :param fig_width: Width for the figure in px. :param modulation: Determines if modulation is included in the visualization. :param modulation_if: Modulation frequency used when modulation is set to "if". :param sampling_rate: The time resolution used to sample the schedule in Hz. :returns: the plot :rtype: :class:`plotly.graph_objects.Figure` .. py:class:: SampledPulse .. py:attribute:: time :type: numpy.ndarray .. py:attribute:: signal :type: numpy.ndarray .. py:attribute:: label :type: str .. py:function:: sample_schedule(schedule: quantify_scheduler.Schedule | quantify_scheduler.CompiledSchedule, port_list: Optional[List[str]] = None, modulation: Literal[off, if, clock] = 'off', modulation_if: float = 0.0, sampling_rate: float = 1000000000.0, x_range: Tuple[float, float] = (-np.inf, np.inf)) -> Dict[str, List[SampledPulse]] Sample a schedule at discrete points in time. :param schedule: The schedule to render. :param port_list: A list of ports to show. if set to `None` will use the first 8 ports it encounters in the sequence. :param modulation: Determines if modulation is included in the visualization. :param modulation_if: Modulation frequency used when modulation is set to "if". :param sampling_rate: The time resolution used to sample the schedule in Hz. :param x_range: The minimum and maximum time values at which to sample the waveforms. :returns: Dictionary that maps each used port to the sampled pulses played on that port. .. py:function:: deduplicate_legend_handles_labels(ax: matplotlib.axes.Axes) -> None Remove duplicate legend entries. See also: https://stackoverflow.com/a/13589144 .. py:function:: plot_single_subplot_mpl(sampled_schedule: Dict[str, List[SampledPulse]], ax: Optional[matplotlib.axes.Axes] = None) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] Plot all pulses for all ports in the schedule in the same subplot. Pulses in the same port have the same color and legend entry, and each port has its own legend entry. :param sampled_schedule: Dictionary that maps each used port to the sampled pulses played on that port. :param ax: A pre-existing Axes object to plot the pulses in. If `None` (default), this object is created within the function. :returns: * *fig* -- A matplotlib :class:`matplotlib.figure.Figure` containing the subplot. * *ax* -- The Axes of the subplot belonging to the Figure. .. py:function:: plot_multiple_subplots_mpl(sampled_schedule: Dict[str, List[SampledPulse]]) -> Tuple[matplotlib.figure.Figure, List[matplotlib.axes.Axes]] Plot pulses in a different subplot for each port in the sampled schedule. For each subplot, each different type of pulse gets its own color and legend entry. :param sampled_schedule: Dictionary that maps each used port to the sampled pulses played on that port. :returns: * *fig* -- A matplotlib :class:`matplotlib.figure.Figure` containing the subplots. * *axs* -- An array of Axes objects belonging to the Figure. .. py:function:: pulse_diagram_matplotlib(schedule: quantify_scheduler.Schedule | quantify_scheduler.CompiledSchedule, port_list: Optional[List[str]] = None, sampling_rate: float = 1000000000.0, modulation: Literal[off, if, clock] = 'off', modulation_if: float = 0.0, x_range: Tuple[float, float] = (-np.inf, np.inf), multiple_subplots: bool = False, ax: Optional[matplotlib.axes.Axes] = None) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes | List[matplotlib.axes.Axes]] Plots a schedule using matplotlib. :param schedule: The schedule to plot. :param port_list: A list of ports to show. If `None` (default) the first 8 ports encountered in the sequence are used. :param sampling_rate: The time resolution used to sample the schedule in Hz. By default 1e9. :param modulation: Determines if modulation is included in the visualization. By default "off". :param modulation_if: Modulation frequency used when modulation is set to "if". By default 0.0. :param x_range: The range of the x-axis that is plotted, given as a tuple (left limit, right limit). This can be used to reduce memory usage when plotting a small section of a long pulse sequence. By default (-np.inf, np.inf). :param multiple_subplots: Plot the pulses for each port on a different subplot if True, else plot everything in one subplot. By default False. When using just one subplot, the pulses are colored according to the port on which they play. For multiple subplots, each pulse has its own color and legend entry. :param ax: Axis onto which to plot. If `None`, this is created within the function. By default None. :returns: * *fig* -- A matplotlib :class:`matplotlib.figure.Figure` containing the subplot(s). * *ax* -- The Axes object belonging to the Figure, or an array of Axes if ``multiple_subplots=True``. .. py:function:: get_window_operations(schedule: quantify_scheduler.Schedule) -> List[Tuple[float, float, quantify_scheduler.Operation]] Return a list of all :class:`.WindowOperation`\s with start and end time. :param schedule: Schedule to use. :returns: List of all window operations in the schedule. .. py:function:: plot_window_operations(schedule: quantify_scheduler.Schedule, ax: Optional[matplotlib.axes.Axes] = None, time_scale_factor: float = 1) -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] Plot the window operations in a schedule. :param schedule: Schedule from which to plot window operations. :param ax: Axis handle to use for plotting. :param time_scale_factor: Used to scale the independent data before using as data for the x-axis of the plot. :returns: * *fig* -- The matplotlib figure. * *ax* -- The matplotlib ax. .. py:function:: plot_acquisition_operations(schedule: quantify_scheduler.Schedule, ax: Optional[matplotlib.axes.Axes] = None, **kwargs) -> List[Any] Plot the acquisition operations in a schedule. :param schedule: Schedule from which to plot window operations. :param ax: Axis handle to use for plotting. :param kwargs: Passed to matplotlib plotting routine :returns: List of handles