Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 94 additions & 5 deletions doc/serverConfig.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# Server Configuration File
# ========================
#
# This file configures instruments and GUI defaults for the InstrumentServer.
#
# GLOB PATTERN MATCHING
# ---------------------
# All hide/star/trash configuration lists support glob pattern matching:
# * Matches any number of characters
# Example: "power_*" matches "power_level", "power_offset", "power_max"
#
# ? Matches exactly one character
# Example: "ch?_gain" matches "ch1_gain", "ch2_gain", "chA_gain"
#
# [seq] Matches any character in the sequence
# Example: "trace_[0-3]" matches "trace_0", "trace_1", "trace_2", "trace_3"
#
# [!seq] Matches any character NOT in the sequence
# Example: "param_[!xy]" matches "param_a", "param_z" but NOT "param_x" or "param_y"
#
# You can use exact names or glob patterns in any hide/star/trash list.
#
# From qcodes station config, the first field must be instruments for instruments config
instruments:
# Name of the instrument
Expand All @@ -18,17 +40,25 @@ instruments:
# any item under kwargs will be passed to the constructor of the widget as kwargs.
# The following are kwargs specifically for the generic widget
kwargs:
# Instance-specific config: These settings apply ONLY to this 'dummy' instance
# They will be MERGED with gui_defaults for this class (DummyInstrumentWithSubmodule)
#
# For this 'dummy' instance, the final merged config will include:
# From __default__: [IDN, device_id, timeout] (but IDN is overridden below)
# From DummyInstrumentWithSubmodule class: [param*, A] (param* will match param0, param1, etc.)
# From this instance: [A, B.ch0, IDN] (below)
# Final parameters-hide = [device_id, timeout, param*, A, B.ch0, IDN]

# Any parameters inside parameters-hide will never be loaded or shown.
parameters-hide:
- A
- B.ch0
- IDN
- A # Instance-specific: hide parameter A
- B.ch0 # Instance-specific: hide submodule parameter
- IDN # Instance-specific: explicitly hide IDN (also in __default__)

# Any parameters inside parameters-star will start being starred.
parameters-star:
- param0
- C
- param0 # Instance-specific: star param0
- C # Merged with class default which also stars C

# Any parameters inside parameters-trash will start trashed.
parameters-trash:
Expand All @@ -55,6 +85,65 @@ instruments:
# By having the parameter manager GUI as the gui type, we can have it directly in the server instead of on a separate window.
type: instrumentserver.gui.instruments.ParameterManagerGui

# GUI defaults: Class-based configuration that applies to all instances of a given instrument class
# These are merged with instance-specific gui.kwargs configs (instance settings take precedence)
# Merge order: __default__ → ClassName → instance-specific
gui_defaults:
# __default__ applies to ALL instruments (unless overridden)
__default__:
# Hide common parameters across all instruments
parameters-hide:
- IDN # Hide identification parameter
- device_id # Hide device ID
- timeout # Hide timeout setting

# Hide common methods across all instruments
methods-hide:
- get_idn # Hide get_idn method
- snapshot # Hide snapshot method
- print_readable_snapshot

# Class-specific defaults - applies to all instances of DummyInstrumentWithSubmodule
DummyInstrumentWithSubmodule:
parameters-hide:
- param* # Wildcard: hide all parameters starting with 'param'
- A # Hide specific parameter 'A'

methods-hide:
- test_* # Wildcard: hide all methods starting with 'test_'

# These would be starred by default for all DummyInstrumentWithSubmodule instances
parameters-star:
- C

methods-star:
- dummy_function

# Another class example - ResonatorResponse
ResonatorResponse:
parameters-hide:
- calibration_* # Hide all calibration parameters
- raw_data # Hide raw data parameter

parameters-star:
- frequency # Star important parameters by default
- power

# Example for a real instrument class
Keysight_E5080B:
parameters-hide:
- power_* # Hide all power-related parameters
- if_bandwidth_* # Hide IF bandwidth parameters

methods-hide:
- reset # Hide reset method
- clear_status

parameters-star:
- start_frequency # Star the most important parameters
- stop_frequency
- center_frequency

# Field for adding broadcasting and listening addresses to the instrument server
networking:
# Adds additional address to listen to messages received by the server, Example: "192.168.1.1"
Expand Down
19 changes: 18 additions & 1 deletion instrumentserver/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from .server.application import startServerGuiApplication
from .server.core import startServer

from .client import Client
from .client import Client, ClientStation
from .client.application import ClientStationGui
from .gui import widgetMainWindow
from .gui.instruments import ParameterManagerGui
from .server.pollingWorker import PollingWorker
Expand Down Expand Up @@ -130,3 +131,19 @@ def detachedServerScript() -> None:
app.exec_()


def clientStationScript() -> None:
parser = argparse.ArgumentParser(description='Starting a client station GUI')
parser.add_argument("--host", default="localhost", help="Server host address")
parser.add_argument("--port", default=5555, type=int, help="Server port")
parser.add_argument("-c", "--config", type=str, default='', help="Path to client station config file (YAML)")
args = parser.parse_args()

app = QtWidgets.QApplication([])

config_path = args.config if args.config else None
station = ClientStation(host=args.host, port=args.port, config_path=config_path)
window = ClientStationGui(station)
window.show()
app.exec_()


2 changes: 1 addition & 1 deletion instrumentserver/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .core import sendRequest
from .proxy import ProxyInstrument, Client, QtClient, SubClient
from .proxy import ProxyInstrument, Client, QtClient, SubClient, ClientStation

Loading