From 474256085f955dcd7e63449a5ca161c231d08f9e Mon Sep 17 00:00:00 2001 From: Jin1L Date: Sat, 23 Sep 2023 15:49:25 +0000 Subject: [PATCH 1/4] update: Upload app.jpeg pictures and modify sort_vector --- .../SORT_VECTOR/a1-[autogen]/docstring.txt | 6 ++++++ .../SORT_VECTOR/a1-[autogen]/python_code.txt | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt index e0b1d3fc15..0e6da274aa 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt @@ -5,6 +5,12 @@ The SORT_VECTOR node returns the input Vector that is sorted default : Vector The input vector + Parameters + ---------- + reverse : int + If it's given 0, sort in ascending order. + If it's given 1, sort in descending order. + Returns ------- Vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt index e908201a23..3028e5c72e 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt @@ -4,7 +4,12 @@ from flojoy import flojoy, Vector @flojoy def SORT_VECTOR( default: Vector, + reverse: int = 0, ) -> Vector: - - return Vector(v=sorted(default.v)) + if reverse == 0: + return Vector(v=sorted(default.v)) + elif reverse == 1: + return Vector(v=sorted(default.v, reverse=True)) + else: + raise AssertionError(f"Invalid reverse value! It should be either 0 or 1 but given {reverse}") From 75b99c043327dbb4a54be10e2fbfdaa8796332ba Mon Sep 17 00:00:00 2001 From: Jin1L Date: Thu, 28 Sep 2023 17:39:14 +0000 Subject: [PATCH 2/4] update: Merge branch 'develop' into jinwonlee/nod-70-basic-nodes --- .../AI_ML/LOAD_MODEL/ONNX_MODEL/ONNX_MODEL.md | 57 ++++ .../ONNX_MODEL/a1-[autogen]/docstring.txt | 41 +++ .../ONNX_MODEL/a1-[autogen]/python_code.txt | 62 ++++ .../ONNX_MODEL/appendix/hardware.md | 1 + .../LOAD_MODEL/ONNX_MODEL/appendix/media.md | 1 + .../LOAD_MODEL/ONNX_MODEL/appendix/notes.md | 1 + .../a1-[autogen]/docstring.txt | 11 +- .../a1-[autogen]/python_code.txt | 37 +- .../BURST_MODE_33510B/examples/EX1/app.json | 213 +++++++----- .../a1-[autogen]/docstring.txt | 11 +- .../a1-[autogen]/python_code.txt | 39 +-- .../examples/EX1/app.json | 148 ++++---- .../CONNECTION_33510B/CONNECTION_33510B.md | 57 ++++ .../a1-[autogen]/docstring.txt | 16 + .../a1-[autogen]/python_code.txt | 29 ++ .../CONNECTION_33510B/appendix/hardware.md | 1 + .../BASIC/CONNECTION_33510B/appendix/media.md | 1 + .../BASIC/CONNECTION_33510B/appendix/notes.md | 1 + .../CONNECTION_33510B/examples/EX1/app.json | 322 ++++++++++++++++++ .../CONNECTION_33510B/examples/EX1/example.md | 0 .../ON_OFF_33510B/a1-[autogen]/docstring.txt | 11 +- .../a1-[autogen]/python_code.txt | 39 +-- .../BASIC/ON_OFF_33510B/examples/EX1/app.json | 250 ++++++-------- .../a1-[autogen]/docstring.txt | 13 +- .../a1-[autogen]/python_code.txt | 39 +-- .../OUTPUT_SYNC_33510B/examples/EX1/app.json | 161 ++++----- .../a1-[autogen]/docstring.txt | 13 +- .../a1-[autogen]/python_code.txt | 39 +-- .../SET_WAVEFORM_33510B/examples/EX1/app.json | 254 ++++++-------- nodeSidebar.json | 1 + 30 files changed, 1110 insertions(+), 759 deletions(-) create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/ONNX_MODEL.md create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/docstring.txt create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/python_code.txt create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/hardware.md create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/media.md create mode 100644 docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/notes.md create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.md create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/docstring.txt create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/python_code.txt create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/hardware.md create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/media.md create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/notes.md create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/app.json create mode 100644 docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/example.md diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/ONNX_MODEL.md b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/ONNX_MODEL.md new file mode 100644 index 0000000000..4ded5d315d --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/ONNX_MODEL.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..902772f8a6 --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/docstring.txt @@ -0,0 +1,41 @@ +ONNX_MODEL loads a serialized ONNX model and uses it to make predictions using ONNX Runtime. + + This allows supporting a wide range of deep learning frameworks and hardware platforms. + + Notes + ----- + + On the one hand, ONNX is an open format to represent deep learning models. + ONNX defines a common set of operators - the building blocks of machine learning + and deep learning models - and a common file format to enable AI developers + to use models with a variety of frameworks, tools, runtimes, and compilers. + + See: https://onnx.ai/ + + On the other hand, ONNX Runtime is a high-performance inference engine for machine + learning models in the ONNX format. ONNX Runtime has proved to considerably increase + performance in inferencing for a broad range of ML models and hardware platforms. + + See: https://onnxruntime.ai/docs/ + + Moreover, the ONNX Model Zoo is a collection of pre-trained models for common + machine learning tasks. The models are stored in ONNX format and are ready to use + in different inference scenarios. + + See: https://github.com/onnx/models + + Parameters + ---------- + file_path : str + Path to a ONNX model to load and use for prediction. + + default : Vector + The input tensor to use for prediction. + For now, only a single input tensor is supported. + Note that the input tensor shape is not checked against the model's input shape. + + Returns + ------- + Vector: + The predictions made by the ONNX model. + For now, only a single output tensor is supported. diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..012554b48f --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/a1-[autogen]/python_code.txt @@ -0,0 +1,62 @@ +from flojoy import flojoy, run_in_venv, Vector +from flojoy.utils import FLOJOY_CACHE_DIR + + +@flojoy +@run_in_venv( + pip_dependencies=[ + "onnxruntime", + "numpy", + "onnx", + ] +) +def ONNX_MODEL( + file_path: str, + default: Vector, +) -> Vector: + + + import os + import onnx + import urllib.request + import numpy as np + import onnxruntime as rt + + model_name = os.path.basename(file_path) + + if file_path.startswith("http://") or file_path.startswith("https://"): + # Downloading the ONNX model from a URL to FLOJOY_CACHE_DIR. + onnx_model_zoo_cache = os.path.join( + FLOJOY_CACHE_DIR, "cache", "onnx", "model_zoo" + ) + + os.makedirs(onnx_model_zoo_cache, exist_ok=True) + + filename = os.path.join(onnx_model_zoo_cache, model_name) + + urllib.request.urlretrieve( + url=file_path, + filename=filename, + ) + + # Using the downloaded file. + file_path = filename + + # Pre-loading the serialized model to validate whether is well-formed or not. + model = onnx.load(file_path) + onnx.checker.check_model(model) + + # Using ONNX runtime for the ONNX model to make predictions. + sess = rt.InferenceSession(file_path, providers=["CPUExecutionProvider"]) + + # TODO(jjerphan): Assuming a single input and a single output for now. + input_name = sess.get_inputs()[0].name + label_name = sess.get_outputs()[0].name + + # TODO(jjerphan): For now NumPy is assumed to be the main backend for Flojoy. + # We might adapt it in the future so that we can use other backends + # for tensor libraries for application using Deep Learning libraries. + input_tensor = np.asarray(default.v, dtype=np.float32) + predictions = sess.run([label_name], {input_name: input_tensor})[0] + + return Vector(v=predictions) diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/hardware.md b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/media.md b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/notes.md b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/AI_ML/LOAD_MODEL/ONNX_MODEL/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/docstring.txt index bd3d501756..3962de8b6f 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/docstring.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/docstring.txt @@ -4,19 +4,16 @@ The BURST_MODE_33510B node is used to turn the Burst mode on or off. The burst mode is way to have signals come in "bursts" that are triggered externally or with a timer for instance. - If the "VISA_address" parameter is not specified the VISA_index will be - used to find the address. The LIST_VISA node can be used to show the - indicies of all available VISA instruments. + Requires a CONNECTION_33510B node at the start of the app to connect with + the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Parameters ---------- - VISA_address: str - The VISA address to query. - VISA_index: int - The address will be found from LIST_VISA node list with this index. + connection: VisaConnection + The VISA address (requires the CONNECTION_MDO3XXX node). on_off: str Turn the burst mode on or off. channel: str diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/python_code.txt index ef67d3cf6d..7b41f8dbb6 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/python_code.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/a1-[autogen]/python_code.txt @@ -1,22 +1,10 @@ -from flojoy import flojoy, DataContainer, TextBlob -import pyvisa +from flojoy import flojoy, DataContainer, TextBlob, VisaConnection from typing import Optional, Literal -from qcodes.instrument_drivers.Keysight import Keysight33512B -from usb.core import USBError -@flojoy( - deps={ - "pyvisa": "1.13.0", - "pyusb": "1.2.1", - "zeroconf": "0.102.0", - "pyvisa_py": "0.7.0", - "qcodes": "0.39.1", - } -) +@flojoy(inject_connection=True) def BURST_MODE_33510B( - VISA_address: Optional[str], - VISA_index: Optional[int] = 0, + connection: VisaConnection, on_off: Literal["ON", "OFF"] = "OFF", channel: Literal["ch1", "ch2"] = "ch1", trigger_source: Literal["EXT", "IMM", "TIM"] = "TIM", @@ -28,25 +16,10 @@ def BURST_MODE_33510B( burst_phase: float = 0, burst_polarity: Literal["NORM", "INV"] = "NORM", default: Optional[DataContainer] = None, -) -> Optional[DataContainer]: +) -> TextBlob: - rm = pyvisa.ResourceManager("@py") - if VISA_address == "": - VISA_addresses = rm.list_resources() - VISA_address = VISA_addresses[int(VISA_index)] - - try: - ks = Keysight33512B( - "ks", - VISA_address, - visalib="@py", - device_clear=False, - ) - except USBError as err: - raise Exception( - "USB port error. Trying unplugging+replugging the port." - ) from err + ks = connection.get_handle() channel_str = channel channel = getattr(ks, channel) diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/examples/EX1/app.json index 376e5d1db2..d312697942 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/examples/EX1/app.json +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/examples/EX1/app.json @@ -4,32 +4,111 @@ { "width": 192, "height": 192, - "id": "BURST_MODE_33510B-7ddc91f3-e2fa-47c8-baa4-9483b0372146", + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", "type": "IO", "data": { - "id": "BURST_MODE_33510B-7ddc91f3-e2fa-47c8-baa4-9483b0372146", + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", + "type": "IO", + "ctrls": { + "device": { + "type": "VisaDevice", + "default": null, + "desc": "The VISA address to connect to.", + "overload": null, + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "desc": "Optional: None" + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", + "selected": false + }, + "position": { + "x": -527.3533818261817, + "y": -104.51110954945591 + }, + "selected": false, + "positionAbsolute": { + "x": -527.3533818261817, + "y": -104.51110954945591 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": 233.00086174633415, + "y": -124.48626608153023 + }, + "selected": false, + "positionAbsolute": { + "x": 233.00086174633415, + "y": -124.48626608153023 + }, + "dragging": true + }, + { + "width": 192, + "height": 192, + "id": "BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431", + "type": "IO", + "data": { + "id": "BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431", "label": "BURST MODE 33510B", "func": "BURST_MODE_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "BURST_MODE_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "BURST_MODE_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -37,7 +116,7 @@ "OFF" ], "default": "OFF", - "desc": null, + "desc": "Turn the burst mode on or off.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "on_off", @@ -50,7 +129,7 @@ "ch2" ], "default": "ch1", - "desc": null, + "desc": "The channel to modify the burst mode for.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "channel", @@ -64,7 +143,7 @@ "TIM" ], "default": "TIM", - "desc": null, + "desc": "Set the trigger_source (e.g. externally or timed).", "overload": null, "functionName": "BURST_MODE_33510B", "param": "trigger_source", @@ -73,7 +152,7 @@ "trigger_delay": { "type": "float", "default": 0, - "desc": null, + "desc": "Delay the burst by this number of seconds after a trigger.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "trigger_delay", @@ -86,7 +165,7 @@ "NEG" ], "default": "POS", - "desc": null, + "desc": "If triggering is external, trigger on a positive or negative slope.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "trigger_slope", @@ -99,7 +178,7 @@ "overload": null, "functionName": "BURST_MODE_33510B", "param": "trigger_timer", - "value": 0.000001 + "value": 0.001 }, "burst_mode": { "type": "select", @@ -108,7 +187,7 @@ "Gated" ], "default": "N Cycle", - "desc": null, + "desc": "Set the burst mode for the WFG.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "burst_mode", @@ -117,16 +196,16 @@ "burst_ncycles": { "type": "int", "default": 1, - "desc": null, + "desc": "How many cycles to have in one burst.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "burst_ncycles", - "value": 10 + "value": 1 }, "burst_phase": { "type": "float", "default": 0, - "desc": null, + "desc": "What phase to start the burst with, in degrees.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "burst_phase", @@ -139,7 +218,7 @@ "INV" ], "default": "NORM", - "desc": null, + "desc": "The polarity of the burst in Gated mode, normal or inverted.", "overload": null, "functionName": "BURST_MODE_33510B", "param": "burst_polarity", @@ -157,92 +236,42 @@ } ], "outputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "desc": "TextBlob: ON or OFF depending on on_off value." - } - ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" - } - ], - "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/BURST_MODE_33510B.py", - "selected": false - }, - "position": { - "x": -240.28567405069748, - "y": -107.39744698085521 - }, - "selected": false, - "positionAbsolute": { - "x": -240.28567405069748, - "y": -107.39744698085521 - }, - "dragging": true - }, - { - "width": 384, - "height": 288, - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", - "type": "VISUALIZERS", - "data": { - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", - "label": "TEXT VIEW", - "func": "TEXT_VIEW", - "type": "VISUALIZERS", - "ctrls": {}, - "initCtrls": {}, - "inputs": [ { "name": "default", "id": "default", "type": "TextBlob", - "multiple": false, - "desc": "the DataContainer to be visualized in text format" + "desc": "TextBlob: summary of burst mode settings." } ], - "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/BURST_MODE_33510B.py", "selected": false }, "position": { - "x": 126.63251436934425, - "y": -126.35743104815421 + "x": -149.8564984407858, + "y": -110.30884513863724 }, "selected": false, "positionAbsolute": { - "x": 126.63251436934425, - "y": -126.35743104815421 + "x": -149.8564984407858, + "y": -110.30884513863724 }, "dragging": true } ], "edges": [ { - "source": "BURST_MODE_33510B-7ddc91f3-e2fa-47c8-baa4-9483b0372146", + "source": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "sourceHandle": "default", + "target": "BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431", + "targetHandle": "default", + "id": "reactflow__edge-CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027default-BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431default" + }, + { + "source": "BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431", "sourceHandle": "default", - "target": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "target": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "targetHandle": "default", - "id": "reactflow__edge-BURST_MODE_33510B-7ddc91f3-e2fa-47c8-baa4-9483b0372146default-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" + "id": "reactflow__edge-BURST_MODE_33510B-f8a40cc2-e5ec-408c-922f-6f58a235a431default-TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59bdefault" } ], "viewport": { diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/docstring.txt index 28b08580c6..6335dde3e4 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/docstring.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/docstring.txt @@ -3,19 +3,16 @@ The RETURN_ERRORS_33510B node returns error messages from the WFG. Error retrival is first-in-first-out (FIFO). Returning errors clears them from the instruments queue. - If the "VISA_address" parameter is not specified the VISA_index will be - used to find the address. The LIST_VISA node can be used to show the - indicies of all available VISA instruments. + Requires a CONNECTION_33510B node at the start of the app to connect with + the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Parameters ---------- - VISA_address: str - The VISA address to query. - VISA_index: int - The address will be found from LIST_VISA node list with this index. + connection: VisaConnection + The VISA address (requires the CONNECTION_MDO3XXX node). Returns ------- diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/python_code.txt index c1e5eb67fb..e5090be60d 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/python_code.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/a1-[autogen]/python_code.txt @@ -1,42 +1,15 @@ -from flojoy import flojoy, DataContainer, TextBlob -import pyvisa -from typing import Optional, Literal -from qcodes.instrument_drivers.Keysight import Keysight33512B -from usb.core import USBError +from flojoy import flojoy, DataContainer, TextBlob, VisaConnection +from typing import Optional -@flojoy( - deps={ - "pyvisa": "1.13.0", - "pyusb": "1.2.1", - "zeroconf": "0.102.0", - "pyvisa_py": "0.7.0", - "qcodes": "0.39.1", - } -) +@flojoy(inject_connection=True) def RETURN_ERRORS_33510B( - VISA_address: Optional[str], - VISA_index: Optional[int] = 0, + connection: VisaConnection, default: Optional[DataContainer] = None, -) -> Optional[DataContainer]: +) -> TextBlob: - rm = pyvisa.ResourceManager("@py") - if VISA_address == "": - VISA_addresses = rm.list_resources() - VISA_address = VISA_addresses[int(VISA_index)] - - try: - ks = Keysight33512B( - "ks", - VISA_address, - visalib="@py", - device_clear=False, - ) - except USBError as err: - raise Exception( - "USB port error. Trying unplugging+replugging the port." - ) from err + ks = connection.get_handle() err_code, err_message = ks.error() errors = f"{err_code} {err_message}" diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/examples/EX1/app.json index 3006d1ec91..5263851b66 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/examples/EX1/app.json +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/examples/EX1/app.json @@ -4,31 +4,22 @@ { "width": 192, "height": 192, - "id": "RETURN_ERRORS_33510B-3a066f98-2226-43cf-b6db-c231fd651f55", + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", "type": "IO", "data": { - "id": "RETURN_ERRORS_33510B-3a066f98-2226-43cf-b6db-c231fd651f55", - "label": "RETURN ERRORS 33510B", - "func": "RETURN_ERRORS_33510B", + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "device": { + "type": "VisaDevice", "default": null, - "desc": "The VISA address to query.", - "overload": null, - "functionName": "RETURN_ERRORS_33510B", - "param": "VISA_address", - "value": "" - }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", + "desc": "The VISA address to connect to.", "overload": null, - "functionName": "RETURN_ERRORS_33510B", - "param": "VISA_index", - "value": 2 + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" } }, "initCtrls": {}, @@ -46,51 +37,30 @@ "name": "default", "id": "default", "type": "Any", - "desc": "TextBlob: Returns all errors in the WFG memory." - } - ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" + "desc": "Optional: None" } ], - "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/RETURN_ERRORS_33510B.py", - "selected": false + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", + "selected": true }, "position": { - "x": 193.2467834815114, - "y": 112.8639037908917 + "x": -527.3533818261817, + "y": -104.51110954945591 }, - "selected": false, + "selected": true, "positionAbsolute": { - "x": 193.2467834815114, - "y": 112.8639037908917 - } + "x": -527.3533818261817, + "y": -104.51110954945591 + }, + "dragging": true }, { "width": 384, "height": 288, - "id": "TEXT_VIEW-9ef30eb9-6f9c-4b38-bdcf-a4093e1ec2a0", + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "type": "VISUALIZERS", "data": { - "id": "TEXT_VIEW-9ef30eb9-6f9c-4b38-bdcf-a4093e1ec2a0", + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "label": "TEXT VIEW", "func": "TEXT_VIEW", "type": "VISUALIZERS", @@ -109,24 +79,84 @@ "selected": false }, "position": { - "x": 591.3285686884251, - "y": 101.4852722421046 + "x": 233.00086174633415, + "y": -124.48626608153023 + }, + "selected": false, + "positionAbsolute": { + "x": 233.00086174633415, + "y": -124.48626608153023 + }, + "dragging": true + }, + { + "width": 192, + "height": 192, + "id": "RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788", + "type": "IO", + "data": { + "id": "RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788", + "label": "RETURN ERRORS 33510B", + "func": "RETURN_ERRORS_33510B", + "type": "IO", + "ctrls": { + "connection": { + "type": "VisaConnection", + "default": null, + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", + "overload": null, + "functionName": "RETURN_ERRORS_33510B", + "param": "connection", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "TextBlob: Returns all errors in the WFG memory." + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/RETURN_ERRORS_33510B.py", + "selected": false + }, + "position": { + "x": -147.83112432013039, + "y": -101.03938942263295 }, "selected": false, "positionAbsolute": { - "x": 591.3285686884251, - "y": 101.4852722421046 + "x": -147.83112432013039, + "y": -101.03938942263295 }, "dragging": true } ], "edges": [ { - "source": "RETURN_ERRORS_33510B-3a066f98-2226-43cf-b6db-c231fd651f55", + "source": "RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788", + "sourceHandle": "default", + "target": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", + "targetHandle": "default", + "id": "reactflow__edge-RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788default-TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59bdefault" + }, + { + "source": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", "sourceHandle": "default", - "target": "TEXT_VIEW-9ef30eb9-6f9c-4b38-bdcf-a4093e1ec2a0", + "target": "RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788", "targetHandle": "default", - "id": "reactflow__edge-RETURN_ERRORS_33510B-3a066f98-2226-43cf-b6db-c231fd651f55default-TEXT_VIEW-9ef30eb9-6f9c-4b38-bdcf-a4093e1ec2a0default" + "id": "reactflow__edge-CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027default-RETURN_ERRORS_33510B-399b56cc-0062-49f0-933c-ab01e39b6788default" } ], "viewport": { diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.md b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.md new file mode 100644 index 0000000000..f1175d59f6 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..be68a2a083 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/docstring.txt @@ -0,0 +1,16 @@ +The CONNECTION_33510B node connects Flojoy to a 33510B function generator. + + The connection is made with the VISA address in the Flojoy UI. + + This node should also work with compatible Keysight 33XXX wavefunction + generators (although they are untested). + + Parameters + ---------- + device: VisaDevice + The VISA address to connect to. + + Returns + ------- + DataContainer + Optional: None diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..07f74a65cc --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/a1-[autogen]/python_code.txt @@ -0,0 +1,29 @@ +from flojoy import VisaDevice, flojoy, DataContainer +from flojoy.connection_manager import DeviceConnectionManager +from typing import Optional +from qcodes.instrument_drivers.Keysight import Keysight33512B +from usb.core import USBError + + +@flojoy() +def CONNECTION_33510B( + device: VisaDevice, + default: Optional[DataContainer] = None, +) -> Optional[DataContainer]: + + + try: + ks = Keysight33512B( + "ks", + device.get_id(), + visalib="@py", + device_clear=False, + ) + except USBError as err: + raise Exception( + "USB port error. Trying unplugging+replugging the port." + ) from err + + DeviceConnectionManager.register_connection(device, ks) + + return None diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/hardware.md b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/media.md b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/notes.md b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/app.json new file mode 100644 index 0000000000..4f64505735 --- /dev/null +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/app.json @@ -0,0 +1,322 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": -97.20356336156576, + "y": -314.9312497214042 + }, + "selected": false, + "positionAbsolute": { + "x": -97.20356336156576, + "y": -314.9312497214042 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "label": "TEXT VIEW 1", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": -81.05571289888496, + "y": 57.102935591729135 + }, + "selected": false, + "positionAbsolute": { + "x": -81.05571289888496, + "y": 57.102935591729135 + }, + "dragging": true + }, + { + "width": 192, + "height": 192, + "id": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", + "type": "IO", + "data": { + "id": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", + "type": "IO", + "ctrls": { + "device": { + "type": "VisaDevice", + "default": null, + "desc": "The VISA address to connect to.", + "overload": null, + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "desc": "Optional: None" + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", + "selected": false + }, + "position": { + "x": -887.4349451815563, + "y": -64.27026427943238 + }, + "selected": false, + "positionAbsolute": { + "x": -887.4349451815563, + "y": -64.27026427943238 + }, + "dragging": true + }, + { + "width": 192, + "height": 192, + "id": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", + "type": "IO", + "data": { + "id": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", + "label": "ON OFF 33510B 2", + "func": "ON_OFF_33510B", + "type": "IO", + "ctrls": { + "connection": { + "type": "VisaConnection", + "default": null, + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "connection", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + }, + "on_off": { + "type": "select", + "options": [ + "ON", + "OFF" + ], + "default": "OFF", + "desc": "Whether to turn the waveform generation to on or off.", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "on_off", + "value": "ON" + }, + "channel": { + "type": "select", + "options": [ + "ch1", + "ch2" + ], + "default": "ch1", + "desc": "The channel to turn on or off.", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "channel", + "value": "ch2" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "TextBlob: ON or OFF depending on on_off value." + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/ON_OFF_33510B.py", + "selected": false + }, + "position": { + "x": -493.6858087739779, + "y": 102.59832750990404 + }, + "selected": false, + "positionAbsolute": { + "x": -493.6858087739779, + "y": 102.59832750990404 + }, + "dragging": true + }, + { + "width": 192, + "height": 192, + "id": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", + "type": "IO", + "data": { + "id": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", + "label": "ON OFF 33510B 1", + "func": "ON_OFF_33510B", + "type": "IO", + "ctrls": { + "connection": { + "type": "VisaConnection", + "default": null, + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "connection", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + }, + "on_off": { + "type": "select", + "options": [ + "ON", + "OFF" + ], + "default": "OFF", + "desc": "Whether to turn the waveform generation to on or off.", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "on_off", + "value": "OFF" + }, + "channel": { + "type": "select", + "options": [ + "ch1", + "ch2" + ], + "default": "ch1", + "desc": "The channel to turn on or off.", + "overload": null, + "functionName": "ON_OFF_33510B", + "param": "channel", + "value": "ch1" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "TextBlob: ON or OFF depending on on_off value." + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/ON_OFF_33510B.py", + "selected": false + }, + "position": { + "x": -487.4597221522696, + "y": -267.59982114760356 + }, + "selected": false, + "positionAbsolute": { + "x": -487.4597221522696, + "y": -267.59982114760356 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", + "sourceHandle": "default", + "target": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "targetHandle": "default", + "id": "reactflow__edge-ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08default-TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993default" + }, + { + "source": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", + "sourceHandle": "default", + "target": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "targetHandle": "default", + "id": "reactflow__edge-ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790default-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" + }, + { + "source": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", + "sourceHandle": "default", + "target": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", + "targetHandle": "default", + "id": "reactflow__edge-CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155dadefault-ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790default" + }, + { + "source": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", + "sourceHandle": "default", + "target": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", + "targetHandle": "default", + "id": "reactflow__edge-CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155dadefault-ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08default" + } + ], + "viewport": { + "x": 1104.261946392206, + "y": 573.1338859553202, + "zoom": 1.2154437530123414 + } + } +} \ No newline at end of file diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/example.md b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/examples/EX1/example.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/docstring.txt index 2304a38ef4..21a1a542bd 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/docstring.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/docstring.txt @@ -1,18 +1,15 @@ The ON_OFF_33510B node is used to turn the output on or off. - If the "VISA_address" parameter is not specified the VISA_index will be - used to find the address. The LIST_VISA node can be used to show the - indicies of all available VISA instruments. + Requires a CONNECTION_33510B node at the start of the app to connect with + the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Parameters ---------- - VISA_address: str - The VISA address to query. - VISA_index: int - The address will be found from LIST_VISA node list with this index. + connection: VisaConnection + The VISA address (requires the CONNECTION_MDO3XXX node). on_off: str Whether to turn the waveform generation to on or off. channel: str diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/python_code.txt index 3f2a382963..d674558cfb 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/python_code.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/a1-[autogen]/python_code.txt @@ -1,50 +1,21 @@ -from flojoy import flojoy, DataContainer, TextBlob -import pyvisa +from flojoy import flojoy, DataContainer, TextBlob, VisaConnection from typing import Optional, Literal -from qcodes.instrument_drivers.Keysight import Keysight33512B -from usb.core import USBError -@flojoy( - deps={ - "pyvisa": "1.13.0", - "pyusb": "1.2.1", - "zeroconf": "0.102.0", - "pyvisa_py": "0.7.0", - "qcodes": "0.39.1", - } -) +@flojoy(inject_connection=True) def ON_OFF_33510B( - VISA_address: Optional[str], - VISA_index: Optional[int] = 0, + connection: VisaConnection, on_off: Literal["ON", "OFF"] = "OFF", channel: Literal["ch1", "ch2"] = "ch1", default: Optional[DataContainer] = None, -) -> Optional[DataContainer]: +) -> TextBlob: - rm = pyvisa.ResourceManager("@py") - if VISA_address == "": - VISA_addresses = rm.list_resources() - VISA_address = VISA_addresses[int(VISA_index)] - - try: - ks = Keysight33512B( - "ks", - VISA_address, - visalib="@py", - device_clear=False, - ) - except USBError as err: - raise Exception( - "USB port error. Trying unplugging+replugging the port." - ) from err + ks = connection.get_handle() channel_str = channel channel = getattr(ks, channel) channel.output(on_off) - ks.close() - return TextBlob(text_blob=f"{channel_str}: {on_off}") diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/examples/EX1/app.json index 7b891eda71..4f64505735 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/examples/EX1/app.json +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/examples/EX1/app.json @@ -26,27 +26,72 @@ "selected": false }, "position": { - "x": -104.31280346396179, - "y": -275.1195051479864 + "x": -97.20356336156576, + "y": -314.9312497214042 }, "selected": false, "positionAbsolute": { - "x": -104.31280346396179, - "y": -275.1195051479864 + "x": -97.20356336156576, + "y": -314.9312497214042 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "label": "TEXT VIEW 1", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": -81.05571289888496, + "y": 57.102935591729135 + }, + "selected": false, + "positionAbsolute": { + "x": -81.05571289888496, + "y": 57.102935591729135 }, "dragging": true }, { "width": 192, "height": 192, - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", + "id": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", "type": "IO", "data": { - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", - "label": "CLOSE ALL", - "func": "CLOSE_ALL", + "id": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", "type": "IO", - "ctrls": {}, + "ctrls": { + "device": { + "type": "VisaDevice", + "default": null, + "desc": "The VISA address to connect to.", + "overload": null, + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, "initCtrls": {}, "inputs": [ { @@ -62,58 +107,43 @@ "name": "default", "id": "default", "type": "Any", - "desc": "optional: The input DataContainer is returned." + "desc": "Optional: None" } ], - "pip_dependencies": [ - { - "name": "qcodes", - "v": "0.39.1" - } - ], - "path": "IO/INSTRUMENTS/QCODES/CLOSE_ALL/CLOSE_ALL.py", + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", "selected": false }, "position": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -887.4349451815563, + "y": -64.27026427943238 }, "selected": false, "positionAbsolute": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -887.4349451815563, + "y": -64.27026427943238 }, "dragging": true }, { "width": 192, "height": 192, - "id": "ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126", + "id": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", "type": "IO", "data": { - "id": "ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126", - "label": "ON OFF 33510B", + "id": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", + "label": "ON OFF 33510B 2", "func": "ON_OFF_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "ON_OFF_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "ON_OFF_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -138,7 +168,7 @@ "overload": null, "functionName": "ON_OFF_33510B", "param": "channel", - "value": "ch1" + "value": "ch2" } }, "initCtrls": {}, @@ -155,75 +185,44 @@ { "name": "default", "id": "default", - "type": "Any", + "type": "TextBlob", "desc": "TextBlob: ON or OFF depending on on_off value." } ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" - } - ], "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/ON_OFF_33510B.py", "selected": false }, "position": { - "x": -518.9542744208309, - "y": -225.7992199828376 + "x": -493.6858087739779, + "y": 102.59832750990404 }, "selected": false, "positionAbsolute": { - "x": -518.9542744208309, - "y": -225.7992199828376 + "x": -493.6858087739779, + "y": 102.59832750990404 }, "dragging": true }, { "width": 192, "height": 192, - "id": "ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290", + "id": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", "type": "IO", "data": { - "id": "ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290", + "id": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", "label": "ON OFF 33510B 1", "func": "ON_OFF_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "ON_OFF_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "ON_OFF_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -248,7 +247,7 @@ "overload": null, "functionName": "ON_OFF_33510B", "param": "channel", - "value": "ch2" + "value": "ch1" } }, "initCtrls": {}, @@ -265,110 +264,53 @@ { "name": "default", "id": "default", - "type": "Any", + "type": "TextBlob", "desc": "TextBlob: ON or OFF depending on on_off value." } ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" - } - ], "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/ON_OFF_33510B.py", "selected": false }, "position": { - "x": -527.5335653145921, - "y": 123.28418767124424 + "x": -487.4597221522696, + "y": -267.59982114760356 }, "selected": false, "positionAbsolute": { - "x": -527.5335653145921, - "y": 123.28418767124424 - }, - "dragging": true - }, - { - "width": 384, - "height": 288, - "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", - "type": "VISUALIZERS", - "data": { - "id": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", - "label": "TEXT VIEW 1", - "func": "TEXT_VIEW", - "type": "VISUALIZERS", - "ctrls": {}, - "initCtrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "TextBlob", - "multiple": false, - "desc": "the DataContainer to be visualized in text format" - } - ], - "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", - "selected": false - }, - "position": { - "x": -120.86745747230276, - "y": 75.58695985795885 - }, - "selected": false, - "positionAbsolute": { - "x": -120.86745747230276, - "y": 75.58695985795885 + "x": -487.4597221522696, + "y": -267.59982114760356 }, "dragging": true } ], "edges": [ { - "source": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", + "source": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", "sourceHandle": "default", - "target": "ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126", + "target": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", "targetHandle": "default", - "id": "reactflow__edge-CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7default-ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126default" + "id": "reactflow__edge-ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08default-TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993default" }, { - "source": "ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126", + "source": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", "sourceHandle": "default", "target": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", "targetHandle": "default", - "id": "reactflow__edge-ON_OFF_33510B-40f04122-9a47-4ecd-8181-7b42d087a126default-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" + "id": "reactflow__edge-ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790default-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" }, { - "source": "ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290", + "source": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", "sourceHandle": "default", - "target": "TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993", + "target": "ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790", "targetHandle": "default", - "id": "reactflow__edge-ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290default-TEXT_VIEW-9b57ca0b-54cb-46c2-a71a-69bdc48fa993default" + "id": "reactflow__edge-CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155dadefault-ON_OFF_33510B-d19eca7b-b688-4c6d-a0b6-f70c43644790default" }, { - "source": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", + "source": "CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155da", "sourceHandle": "default", - "target": "ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290", + "target": "ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08", "targetHandle": "default", - "id": "reactflow__edge-CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7default-ON_OFF_33510B-c5638b61-e10d-48a1-b59d-835c2dfd2290default" + "id": "reactflow__edge-CONNECTION_33510B-d0efefd1-f09c-4f2c-b5d8-ca8fb95155dadefault-ON_OFF_33510B-b7a6b301-b085-4365-9ae4-d83fb88dfd08default" } ], "viewport": { diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/docstring.txt index 33bc7e7230..62514066a1 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/docstring.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/docstring.txt @@ -2,19 +2,16 @@ The OUTPUT_SYNC_33510B node is used sync multiple outputs phases. Can only be turned on for one channel. - If the "VISA_address" parameter is not specified the VISA_index will be - used to find the address. The LIST_VISA node can be used to show the - indicies of all available VISA instruments. + Requires a CONNECTION_33510B node at the start of the app to connect with + the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Parameters ---------- - VISA_address: str - The VISA address to query. - VISA_index: int - The address will be found from LIST_VISA node list with this index. + connection: VisaConnection + The VISA address (requires the CONNECTION_MDO3XXX node). on_off: str Whether to turn the waveform phase syncing on or off. channel: str @@ -23,4 +20,4 @@ The OUTPUT_SYNC_33510B node is used sync multiple outputs phases. Returns ------- DataContainer - TextBlob: ON or OFF depending on on_off value. + TextBlob: The channel, and ON or OFF depending on on_off value. diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/python_code.txt index 24fc5fd124..262b12685b 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/python_code.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/a1-[autogen]/python_code.txt @@ -1,44 +1,17 @@ -from flojoy import flojoy, DataContainer, TextBlob -import pyvisa +from flojoy import flojoy, DataContainer, TextBlob, VisaConnection from typing import Optional, Literal -from qcodes.instrument_drivers.Keysight import Keysight33512B -from usb.core import USBError -@flojoy( - deps={ - "pyvisa": "1.13.0", - "pyusb": "1.2.1", - "zeroconf": "0.102.0", - "pyvisa_py": "0.7.0", - "qcodes": "0.39.1", - } -) +@flojoy(inject_connection=True) def OUTPUT_SYNC_33510B( - VISA_address: Optional[str], - VISA_index: Optional[int] = 0, + connection: VisaConnection, on_off: Literal["ON", "OFF"] = "OFF", channel: Literal["1", "2"] = "1", default: Optional[DataContainer] = None, -) -> Optional[DataContainer]: +) -> TextBlob: - rm = pyvisa.ResourceManager("@py") - if VISA_address == "": - VISA_addresses = rm.list_resources() - VISA_address = VISA_addresses[int(VISA_index)] - - try: - ks = Keysight33512B( - "ks", - VISA_address, - visalib="@py", - device_clear=False, - ) - except USBError as err: - raise Exception( - "USB port error. Trying unplugging+replugging the port." - ) from err + ks = connection.get_handle() ks.sync.source(int(channel)) match on_off: @@ -48,6 +21,4 @@ def OUTPUT_SYNC_33510B( ks.sync.output("ON") ks.write("PHAS:SYNC") - ks.close() - return TextBlob(text_blob=f"CH{channel} sync: {on_off}") diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/examples/EX1/app.json index 8bc9459b0a..5eb997992c 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/examples/EX1/app.json +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/examples/EX1/app.json @@ -2,118 +2,113 @@ "rfInstance": { "nodes": [ { - "width": 384, - "height": 288, - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", - "type": "VISUALIZERS", + "width": 192, + "height": 192, + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "type": "IO", "data": { - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", - "label": "TEXT VIEW", - "func": "TEXT_VIEW", - "type": "VISUALIZERS", - "ctrls": {}, + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", + "type": "IO", + "ctrls": { + "device": { + "type": "VisaDevice", + "default": null, + "desc": "The VISA address to connect to.", + "overload": null, + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, "initCtrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "TextBlob", + "type": "Any", "multiple": false, - "desc": "the DataContainer to be visualized in text format" + "desc": null } ], - "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "desc": "Optional: None" + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", "selected": false }, "position": { - "x": -73.10397672973124, - "y": -120.11566570130807 + "x": -886.7395156170513, + "y": -112.96725387394693 }, "selected": false, "positionAbsolute": { - "x": -73.10397672973124, - "y": -120.11566570130807 + "x": -886.7395156170513, + "y": -112.96725387394693 }, "dragging": true }, { - "width": 192, - "height": 192, - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", - "type": "IO", + "width": 225, + "height": 226, + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", + "type": "VISUALIZERS", "data": { - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", - "label": "CLOSE ALL", - "func": "CLOSE_ALL", - "type": "IO", + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", "ctrls": {}, "initCtrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", + "type": "TextBlob", "multiple": false, - "desc": null - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "desc": "optional: The input DataContainer is returned." - } - ], - "pip_dependencies": [ - { - "name": "qcodes", - "v": "0.39.1" + "desc": "the DataContainer to be visualized in text format" } ], - "path": "IO/INSTRUMENTS/QCODES/CLOSE_ALL/CLOSE_ALL.py", + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", "selected": false }, "position": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -228.91602197898922, + "y": -130.8283743248985 }, "selected": false, "positionAbsolute": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -228.91602197898922, + "y": -130.8283743248985 }, "dragging": true }, { "width": 192, "height": 192, - "id": "OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16", + "id": "OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0", "type": "IO", "data": { - "id": "OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16", + "id": "OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0", "label": "OUTPUT SYNC 33510B", "func": "OUTPUT_SYNC_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "OUTPUT_SYNC_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "OUTPUT_SYNC_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -155,61 +150,39 @@ { "name": "default", "id": "default", - "type": "Any", - "desc": "TextBlob: ON or OFF depending on on_off value." - } - ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" + "type": "TextBlob", + "desc": "TextBlob: The channel, and ON or OFF depending on on_off value." } ], "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/OUTPUT_SYNC_33510B.py", "selected": false }, "position": { - "x": -510.11784179817596, - "y": -76.20285758215164 + "x": -576.8436213938844, + "y": -112.88858916855764 }, "selected": false, "positionAbsolute": { - "x": -510.11784179817596, - "y": -76.20285758215164 + "x": -576.8436213938844, + "y": -112.88858916855764 }, "dragging": true } ], "edges": [ { - "source": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", + "source": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", "sourceHandle": "default", - "target": "OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16", + "target": "OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0", "targetHandle": "default", - "id": "reactflow__edge-CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7default-OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16default" + "id": "reactflow__edge-CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027default-OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0default" }, { - "source": "OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16", + "source": "OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0", "sourceHandle": "default", - "target": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "target": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "targetHandle": "default", - "id": "reactflow__edge-OUTPUT_SYNC_33510B-3ac2323e-d6a3-44e7-b7b2-f89168e0ad16default-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" + "id": "reactflow__edge-OUTPUT_SYNC_33510B-a889708d-f110-42a5-a7ce-67c30d4eb9c0default-TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59bdefault" } ], "viewport": { diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/docstring.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/docstring.txt index 2f5e0fc149..3838008c5d 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/docstring.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/docstring.txt @@ -2,19 +2,16 @@ The SET_WAVEFORM_33510B node is used to set waveform settings for a 33510B. The Keysight 33510B has a variety of waveform settings available. - If the "VISA_address" parameter is not specified the VISA_index will be - used to find the address. The LIST_VISA node can be used to show the - indicies of all available VISA instruments. + Requires a CONNECTION_33510B node at the start of the app to connect with + the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Parameters ---------- - VISA_address: str - The VISA address to query. - VISA_index: int - The address will be found from LIST_VISA node list with this index. + connection: VisaConnection + The VISA address (requires the CONNECTION_MDO3XXX node). on_off: str Whether to turn the waveform generation to on or off. query_set: str @@ -41,4 +38,4 @@ The SET_WAVEFORM_33510B node is used to set waveform settings for a 33510B. Returns ------- DataContainer - Scalar: The waveform measurement in the selected statistic mode. + TextBlob: Summary of waveform generator settings. diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/python_code.txt b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/python_code.txt index 1b02ff10e4..d446053ac5 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/python_code.txt +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/a1-[autogen]/python_code.txt @@ -1,22 +1,10 @@ -from flojoy import flojoy, DataContainer, TextBlob -import pyvisa +from flojoy import flojoy, DataContainer, TextBlob, VisaConnection from typing import Optional, Literal -from qcodes.instrument_drivers.Keysight import Keysight33512B -from usb.core import USBError -@flojoy( - deps={ - "pyvisa": "1.13.0", - "pyusb": "1.2.1", - "zeroconf": "0.102.0", - "pyvisa_py": "0.7.0", - "qcodes": "0.39.1", - } -) +@flojoy(inject_connection=True) def SET_WAVEFORM_33510B( - VISA_address: Optional[str], - VISA_index: Optional[int] = 0, + connection: VisaConnection, on_off: Literal["ON", "OFF"] = "OFF", query_set: Literal["query", "set"] = "query", channel: Literal["ch1", "ch2"] = "ch1", @@ -31,25 +19,10 @@ def SET_WAVEFORM_33510B( ramp_symmetry: float = 50, pulse_width: float = 20, default: Optional[DataContainer] = None, -) -> Optional[DataContainer]: +) -> TextBlob: - rm = pyvisa.ResourceManager("@py") - if VISA_address == "": - VISA_addresses = rm.list_resources() - VISA_address = VISA_addresses[int(VISA_index)] - - try: - ks = Keysight33512B( - "ks", - VISA_address, - visalib="@py", - device_clear=False, - ) - except USBError as err: - raise Exception( - "USB port error. Trying unplugging+replugging the port." - ) from err + ks = connection.get_handle() channel_str = channel channel = getattr(ks, channel) @@ -106,6 +79,4 @@ def SET_WAVEFORM_33510B( if on_off == "ON": channel.output("ON") - ks.close() - return TextBlob(text_blob=summary) diff --git a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/examples/EX1/app.json b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/examples/EX1/app.json index d287b26ea9..df59690bd7 100644 --- a/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/examples/EX1/app.json +++ b/docs/nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/examples/EX1/app.json @@ -1,13 +1,66 @@ { "rfInstance": { "nodes": [ + { + "width": 192, + "height": 192, + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "type": "IO", + "data": { + "id": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", + "label": "CONNECTION 33510B", + "func": "CONNECTION_33510B", + "type": "IO", + "ctrls": { + "device": { + "type": "VisaDevice", + "default": null, + "desc": "The VISA address to connect to.", + "overload": null, + "functionName": "CONNECTION_33510B", + "param": "device", + "value": "USB0::2391::9735::MY59003244::0::INSTR" + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "desc": "Optional: None" + } + ], + "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B.py", + "selected": false + }, + "position": { + "x": -979.7571031864528, + "y": -121.42339819843798 + }, + "selected": false, + "positionAbsolute": { + "x": -979.7571031864528, + "y": -121.42339819843798 + }, + "dragging": true + }, { "width": 384, "height": 288, - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "type": "VISUALIZERS", "data": { - "id": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "id": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "label": "TEXT VIEW", "func": "TEXT_VIEW", "type": "VISUALIZERS", @@ -26,45 +79,36 @@ "selected": false }, "position": { - "x": 126.63251436934425, - "y": -126.35743104815421 + "x": 131.5271298524416, + "y": -142.45557277107372 }, "selected": false, "positionAbsolute": { - "x": 126.63251436934425, - "y": -126.35743104815421 + "x": 131.5271298524416, + "y": -142.45557277107372 }, "dragging": true }, { "width": 192, "height": 192, - "id": "SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275a", + "id": "SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2", "type": "IO", "data": { - "id": "SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275a", - "label": "QUERY WAVEFORM 33510B", + "id": "SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2", + "label": "SET WAVEFORM", "func": "SET_WAVEFORM_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "SET_WAVEFORM_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "SET_WAVEFORM_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -89,7 +133,7 @@ "overload": null, "functionName": "SET_WAVEFORM_33510B", "param": "query_set", - "value": "query" + "value": "set" }, "channel": { "type": "select", @@ -207,75 +251,44 @@ { "name": "default", "id": "default", - "type": "Any", - "desc": "Scalar: The waveform measurement in the selected statistic mode." - } - ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" + "type": "TextBlob", + "desc": "TextBlob: Summary of waveform generator settings." } ], "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/SET_WAVEFORM_33510B.py", "selected": false }, "position": { - "x": -235.3146615647039, - "y": -80.09846489697861 + "x": -621.6271042931016, + "y": -120.43534000032497 }, "selected": false, "positionAbsolute": { - "x": -235.3146615647039, - "y": -80.09846489697861 + "x": -621.6271042931016, + "y": -120.43534000032497 }, "dragging": true }, { "width": 192, "height": 192, - "id": "SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5", + "id": "SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083f", "type": "IO", "data": { - "id": "SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5", - "label": "SET WAVEFORM 33510B 1", + "id": "SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083f", + "label": "QUERY WAVEFORM", "func": "SET_WAVEFORM_33510B", "type": "IO", "ctrls": { - "VISA_address": { - "type": "str", + "connection": { + "type": "VisaConnection", "default": null, - "desc": "The VISA address to query.", + "desc": "The VISA address (requires the CONNECTION_MDO3XXX node).", "overload": null, "functionName": "SET_WAVEFORM_33510B", - "param": "VISA_address", + "param": "connection", "value": "USB0::2391::9735::MY59003244::0::INSTR" }, - "VISA_index": { - "type": "int", - "default": 0, - "desc": "The address will be found from LIST_VISA node list with this index.", - "overload": null, - "functionName": "SET_WAVEFORM_33510B", - "param": "VISA_index", - "value": 0 - }, "on_off": { "type": "select", "options": [ @@ -287,7 +300,7 @@ "overload": null, "functionName": "SET_WAVEFORM_33510B", "param": "on_off", - "value": "OFF" + "value": "ON" }, "query_set": { "type": "select", @@ -300,7 +313,7 @@ "overload": null, "functionName": "SET_WAVEFORM_33510B", "param": "query_set", - "value": "set" + "value": "query" }, "channel": { "type": "select", @@ -351,7 +364,7 @@ "overload": null, "functionName": "SET_WAVEFORM_33510B", "param": "amplitude", - "value": 0.2 + "value": 0.1 }, "amplitude_unit": { "type": "select", @@ -418,117 +431,46 @@ { "name": "default", "id": "default", - "type": "Any", - "desc": "Scalar: The waveform measurement in the selected statistic mode." - } - ], - "pip_dependencies": [ - { - "name": "pyvisa", - "v": "1.13.0" - }, - { - "name": "pyusb", - "v": "1.2.1" - }, - { - "name": "zeroconf", - "v": "0.102.0" - }, - { - "name": "pyvisa_py", - "v": "0.7.0" - }, - { - "name": "qcodes", - "v": "0.39.1" + "type": "TextBlob", + "desc": "TextBlob: Summary of waveform generator settings." } ], "path": "IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/SET_WAVEFORM_33510B.py", "selected": false }, "position": { - "x": -587.0980217998496, - "y": -74.46641189574345 - }, - "selected": false, - "positionAbsolute": { - "x": -587.0980217998496, - "y": -74.46641189574345 - }, - "dragging": true - }, - { - "width": 192, - "height": 192, - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", - "type": "IO", - "data": { - "id": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", - "label": "CLOSE ALL", - "func": "CLOSE_ALL", - "type": "IO", - "ctrls": {}, - "initCtrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false, - "desc": null - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "desc": "optional: The input DataContainer is returned." - } - ], - "pip_dependencies": [ - { - "name": "qcodes", - "v": "0.39.1" - } - ], - "path": "IO/INSTRUMENTS/QCODES/CLOSE_ALL/CLOSE_ALL.py", - "selected": false - }, - "position": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -249.25622073246237, + "y": -118.32870369988929 }, "selected": false, "positionAbsolute": { - "x": -919.3821328184661, - "y": -74.54262269929615 + "x": -249.25622073246237, + "y": -118.32870369988929 }, "dragging": true } ], "edges": [ { - "source": "SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275a", + "source": "CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027", "sourceHandle": "default", - "target": "TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0e", + "target": "SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2", "targetHandle": "default", - "id": "reactflow__edge-SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275adefault-TEXT_VIEW-819c7e1c-0ff5-4c09-8a13-b65b1e1bab0edefault" + "id": "reactflow__edge-CONNECTION_33510B-4c8ca1dd-a8ee-4ba9-ae8b-886c80a0a027default-SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2default" }, { - "source": "SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5", + "source": "SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2", "sourceHandle": "default", - "target": "SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275a", + "target": "SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083f", "targetHandle": "default", - "id": "reactflow__edge-SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5default-SET_WAVEFORM_33510B-5d984289-23fd-4a07-8581-9e67f458275adefault" + "id": "reactflow__edge-SET_WAVEFORM_33510B-0ab66699-2865-4958-ac92-6ff441f13cf2default-SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083fdefault" }, { - "source": "CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7", + "source": "SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083f", "sourceHandle": "default", - "target": "SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5", + "target": "TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59b", "targetHandle": "default", - "id": "reactflow__edge-CLOSE_ALL-5ce40df5-d7b2-4c4c-a350-028ed7d948d7default-SET_WAVEFORM_33510B-cff57b5b-40b6-48a6-bce1-b72039d971a5default" + "id": "reactflow__edge-SET_WAVEFORM_33510B-9dc26886-d55d-4825-bb40-7f86db98083fdefault-TEXT_VIEW-1e087237-ee3a-4db7-963d-46fbdbd7b59bdefault" } ], "viewport": { diff --git a/nodeSidebar.json b/nodeSidebar.json index 67bff8ce72..6b4da632bc 100644 --- a/nodeSidebar.json +++ b/nodeSidebar.json @@ -151,6 +151,7 @@ "I/O > Function Generators": [ "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/BURST_MODE_33510B/BURST_MODE_33510B", "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/ADVANCED/RETURN_ERRORS_33510B/RETURN_ERRORS_33510B", + "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/CONNECTION_33510B/CONNECTION_33510B", "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/ON_OFF_33510B/ON_OFF_33510B", "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/OUTPUT_SYNC_33510B/OUTPUT_SYNC_33510B", "nodes/IO/INSTRUMENTS/FUNCTION_GENERATORS/KEYSIGHT/33XXX/BASIC/SET_WAVEFORM_33510B/SET_WAVEFORM_33510B" From 8266629652dec9ecfba5827254af4ac5fac9b706 Mon Sep 17 00:00:00 2001 From: Jin1L Date: Thu, 28 Sep 2023 17:44:58 +0000 Subject: [PATCH 3/4] update: Update SORT_VECTOR.py --- .../SORT_VECTOR/a1-[autogen]/docstring.txt | 5 ++--- .../SORT_VECTOR/a1-[autogen]/python_code.txt | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt index 0e6da274aa..bb1385bc85 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt @@ -7,9 +7,8 @@ The SORT_VECTOR node returns the input Vector that is sorted Parameters ---------- - reverse : int - If it's given 0, sort in ascending order. - If it's given 1, sort in descending order. + reverse : bool + If False, sort in ascending order. If True, descending order. Returns ------- diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt index 3028e5c72e..3e139f2152 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt @@ -4,12 +4,10 @@ from flojoy import flojoy, Vector @flojoy def SORT_VECTOR( default: Vector, - reverse: int = 0, + reverse: bool = False, ) -> Vector: - if reverse == 0: + if reverse: return Vector(v=sorted(default.v)) - elif reverse == 1: + elif reverse: return Vector(v=sorted(default.v, reverse=True)) - else: - raise AssertionError(f"Invalid reverse value! It should be either 0 or 1 but given {reverse}") From e4238681472cd09083a650ed8851c8fdaf14402e Mon Sep 17 00:00:00 2001 From: Jin1L Date: Thu, 28 Sep 2023 17:56:02 +0000 Subject: [PATCH 4/4] update: fix sort for bool --- .../SORT_VECTOR/a1-[autogen]/python_code.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt index 3e139f2152..147351de6d 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt @@ -7,7 +7,4 @@ def SORT_VECTOR( reverse: bool = False, ) -> Vector: - if reverse: - return Vector(v=sorted(default.v)) - elif reverse: - return Vector(v=sorted(default.v, reverse=True)) + return Vector(v=sorted(default.v, reverse=reverse))