from flojoy import flojoy, DataContainer, OrderedPair, VisaConnection from typing import Optional from numpy import fromstring from time import sleep @flojoy(inject_connection=True) def EXTRACT_SWEEP_FSV( connection: VisaConnection, default: Optional[DataContainer] = None, ) -> OrderedPair: """Extract the sweep trace from an FSV network analyzer. Requires a CONNECTION_FSV block at the start of the app to connect with the instrument. The VISA address will then be listed under 'connection'. This block should also work with compatible R&S network analyzers. Parameters ---------- connection: VisaConnection The VISA address (requires the CONNECTION_FSV block). Returns ------- OrderedPair The sweep trace from the FSV is returned. """ rohde = connection.get_handle() # Wait until the sweep count reach the target. target = rohde.query("SWE:COUN?") while rohde.query("SWE:COUN:CURR?") != target: rohde.write("*WAI") sleep(0.1) x = fromstring(rohde.query("TRAC:DATA:X? TRACE1"), sep=",") y = fromstring(rohde.query("TRAC? TRACE1"), sep=",") return OrderedPair(x=x, y=y)
Read FM Radio Signals using Flojoy
In this example, the Rohde & Schwarz FSV Signal Analyzer is used to view the FM radio range (86-110 MHz).
First 4 FSV nodes were added:
LINE node was also added. The
VISA address was set for the 4 instrument nodes. The range of the signal analyzer sweep was set with
start = 86,
stop = 110 MHz).
The nodes were then connected as shown in the image, and the app was run.