| 1 |
# |
| 2 |
# This file is part of the PyMeasure package. |
| 3 |
# |
| 4 |
# Copyright (c) 2013-2024 PyMeasure Developers |
| 5 |
# |
| 6 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 |
# of this software and associated documentation files (the "Software"), to deal |
| 8 |
# in the Software without restriction, including without limitation the rights |
| 9 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 |
# copies of the Software, and to permit persons to whom the Software is |
| 11 |
# furnished to do so, subject to the following conditions: |
| 12 |
# |
| 13 |
# The above copyright notice and this permission notice shall be included in |
| 14 |
# all copies or substantial portions of the Software. |
| 15 |
# |
| 16 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 |
# all copies or substantial portions of the Software. |
| 18 |
# |
| 19 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 22 |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 24 |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 25 |
# THE SOFTWARE. |
| 26 |
# |
| 27 |
|
| 28 |
import logging |
| 29 |
|
| 30 |
from ..widgets import ( |
| 31 |
ImageWidget, |
| 32 |
) |
| 33 |
from .managed_window import ManagedWindow |
| 34 |
|
| 35 |
log = logging.getLogger(__name__) |
| 36 |
log.addHandler(logging.NullHandler()) |
| 37 |
|
| 38 |
|
| 39 |
class ManagedImageWindow(ManagedWindow): |
| 40 |
""" |
| 41 |
Display experiment output with an :class:`~pymeasure.display.widgets.image_widget.ImageWidget` |
| 42 |
class. |
| 43 |
|
| 44 |
:param procedure_class: procedure class describing the experiment (see |
| 45 |
:class:`~pymeasure.experiment.procedure.Procedure`) |
| 46 |
:param x_axis: the data-column for the x-axis of the plot, cannot be changed afterwards for |
| 47 |
the image-plot |
| 48 |
:param y_axis: the data-column for the y-axis of the plot, cannot be changed afterwards for |
| 49 |
the image-plot |
| 50 |
:param z_axis: the initial data-column for the z-axis of the plot, can be changed afterwards |
| 51 |
:param \\**kwargs: optional keyword arguments that will be passed to |
| 52 |
:class:`~pymeasure.display.windows.managed_image_window.ManagedWindow` |
| 53 |
|
| 54 |
""" |
| 55 |
|
| 56 |
def __init__(self, procedure_class, x_axis, y_axis, z_axis=None, **kwargs): |
| 57 |
self.z_axis = z_axis |
| 58 |
self.image_widget = ImageWidget( |
| 59 |
"Image", procedure_class.DATA_COLUMNS, x_axis, y_axis, z_axis) |
| 60 |
|
| 61 |
if "widget_list" not in kwargs: |
| 62 |
kwargs["widget_list"] = () |
| 63 |
kwargs["widget_list"] = kwargs["widget_list"] + (self.image_widget,) |
| 64 |
|
| 65 |
super().__init__(procedure_class, x_axis=x_axis, y_axis=y_axis, **kwargs) |