This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
7,478 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...ARE/FUNCTION_GENERATORS/TEKTRONIX/AFG31000/ALIGN_PHASES_AFG31000/ALIGN_PHASES_AFG31000.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from flojoy import flojoy, DataContainer, TextBlob, VisaConnection | ||
from typing import Optional, Literal | ||
|
||
|
||
@flojoy(inject_connection=True) | ||
def ALIGN_PHASES_AFG31000( | ||
connection: VisaConnection, | ||
channel: Literal["1", "2"] = "1", | ||
input: Optional[DataContainer] = None, | ||
) -> TextBlob: | ||
"""Run this block to align the phases for ch1 and ch2. | ||
This block should also work with compatible Tektronix AFG31XXX instruments. | ||
Parameters | ||
---------- | ||
connection: VisaConnection | ||
The VISA address (requires the CONNECTION_AFG31000 block). | ||
channel: select, default=ch1 | ||
Which channel is the reference? | ||
Returns | ||
------- | ||
TextBlob | ||
Placeholder | ||
""" | ||
|
||
afg = connection.get_handle() | ||
|
||
afg.write(f"SOURCE{channel}:PHASE:INIT") | ||
|
||
return TextBlob(text_blob="Aligned channel phases") |
633 changes: 633 additions & 0 deletions
633
blocks/HARDWARE/FUNCTION_GENERATORS/TEKTRONIX/AFG31000/ALIGN_PHASES_AFG31000/app.json
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
blocks/HARDWARE/FUNCTION_GENERATORS/TEKTRONIX/AFG31000/ALIGN_PHASES_AFG31000/block_data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"docstring": { | ||
"long_description": "This block should also work with compatible Tektronix AFG31XXX instruments.", | ||
"short_description": "Run this block to align the phases for ch1 and ch2.", | ||
"parameters": [ | ||
{ | ||
"name": "connection", | ||
"type": "VisaConnection", | ||
"description": "The VISA address (requires the CONNECTION_AFG31000 block)." | ||
}, | ||
{ | ||
"name": "channel", | ||
"type": "select, default=ch1", | ||
"description": "Which channel is the reference?" | ||
} | ||
], | ||
"returns": [ | ||
{ | ||
"name": null, | ||
"type": "TextBlob", | ||
"description": "Placeholder" | ||
} | ||
] | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ARDWARE/FUNCTION_GENERATORS/TEKTRONIX/AFG31000/ALIGN_PHASES_AFG31000/example.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
In this example, an Tektronix AFG31000 is used to generate two waveforms. | ||
|
||
First the necessary blocks were added: | ||
|
||
- `CONNECT_AFG31000` | ||
- `RESET_AFG31000` | ||
- 2x `FUNCTION_AFG31000` | ||
- `ALIGN_PHASES_AFG31000` | ||
- `OUTPUT_AFG31000` | ||
- `SAVE_STATE_AFG31000` | ||
|
||
The instrument address was set for each `AFG31000` block. Ensure the `OUTPUT_AFG31000` block has both channels turn on. | ||
|
||
The blocks were connected as shown and the app was run. The `SAVE_STATE_AFG31000` block can be used to save and recall the current state of the AFG. However, you must use a `OUTPUT_AFG31000` block to turn the outputs back on. | ||
|
||
An oscilloscope was connected to the AFG31000 resulting in waveform: | ||
|
||
![image](https://res.cloudinary.com/dhopxs1y3/image/upload/v1701277906/flojoy-docs/afg31000/afg31000_basic.png) |
68 changes: 68 additions & 0 deletions
68
.../HARDWARE/FUNCTION_GENERATORS/TEKTRONIX/AFG31000/ARBITRARY_AFG31000/ARBITRARY_AFG31000.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from flojoy import flojoy, OrderedPair, TextBlob, VisaConnection, Vector | ||
from typing import Literal | ||
from numpy import max, min | ||
|
||
|
||
@flojoy(inject_connection=True) | ||
def ARBITRARY_AFG31000( | ||
input: OrderedPair | Vector, | ||
connection: VisaConnection, | ||
memory_state: Literal["EMEM1", "EMEM2"] = "EMEM1", | ||
source: Literal["1", "2"] = "1", | ||
frequency: float = 1e6, | ||
amplitude: float = 1, | ||
offset: float = 0, | ||
phase: float = 0, | ||
) -> TextBlob: | ||
"""Take the input waveform and use it as the arbitrary wavefunction. | ||
This block should also work with compatible Tektronix AFG31XXX instruments. | ||
Parameters | ||
---------- | ||
connection: VisaConnection | ||
The VISA address (requires the CONNECTION_AFG31000 block). | ||
memory_state: select, default=EMEM1 | ||
Save the function in "Edit Memory" 1 or 2. | ||
channel: select, default=1 | ||
Choose the channel to use with the waveform. | ||
frequency: float, default=1e6 | ||
The voltage of the waveform to set, in Hz. | ||
amplitude: float, default=1 | ||
The voltage of the waveform to set. | ||
offset: float, default=0 | ||
The voltage offset to set the waveform to, in volts. | ||
phase: float, default=0 | ||
The phase to set the waveform to, in degrees. | ||
Returns | ||
------- | ||
TextBlob | ||
Placeholder | ||
""" | ||
|
||
assert -180.0 <= phase <= 180.0, "The phase must be between -180 and 180 degrees." | ||
|
||
afg = connection.get_handle() | ||
|
||
match input: | ||
case OrderedPair(): | ||
y = input.y | ||
case Vector(): | ||
y = input.v | ||
|
||
y -= min(y) | ||
y /= max(y) | ||
y *= 16383 | ||
|
||
afg.write_binary_values( | ||
f"DATA:DATA {memory_state}, ", y, is_big_endian=True, datatype="h" | ||
) | ||
afg.write(f"SOURCE{source}:FUNCTION {memory_state}") | ||
|
||
afg.write(f"SOURCE{source}:FREQUENCY {frequency}") | ||
afg.write(f"SOURCE{source}:VOLTAGE:AMPLITUDE {amplitude}") | ||
afg.write(f"SOURCE{source}:VOLTAGE:OFFSET {offset}") | ||
afg.write(f"SOURCE{source}:PHASE:ADJUST {phase}DEG") | ||
|
||
return TextBlob(text_blob="Set FG parameters") |
Oops, something went wrong.