Skip to content

Commit

Permalink
Add channel controls to data capture functions
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Oct 1, 2024
1 parent 6f526c0 commit f8cdc04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bench/cli/iiotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ def set_dds(ctx, frequency, amplitude, device, channel, complex):
@cli.command()
@click.option("--filename", "-f", help="Name of file to write data to", required=True)
@click.option("--device", "-d", help="Name of device to configure", required=True)
@click.option("--channel", "-c", help="Channel to capture data from", required=True)
@click.option("--samples", "-s", help="Number of samples to capture", required=True)
@click.argument("props", nargs=-1)
@click.pass_context
def capture_Data(ctx, filename, device, samples, props):
def capture_Data(ctx, filename, device, channel, samples, props):

# Checks
samples = int(samples)
Expand All @@ -98,4 +99,6 @@ def capture_Data(ctx, filename, device, samples, props):
oprops[k] = v
props = oprops

capture_iq_datafile(filename, device, samples, ctx.obj["uri"], **dict(props))
capture_iq_datafile(
filename, device, channel, samples, ctx.obj["uri"], **dict(props)
)
4 changes: 3 additions & 1 deletion bench/keysight/dwta/data_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@


def capture_iq_datafile(
filename: str, device_name: str, samples: int, uri: str, **kwargs
filename: str, device_name: str, channel: int, samples: int, uri: str, **kwargs
) -> None:
"""Capture IQ data to a file.
Args:
filename: The filename to write to.
device_name: The device name.
channel: The channel to capture data from.
samples: The number of samples to capture.
uri: The URI of the device.
*args: Additional arguments.
Expand All @@ -38,6 +39,7 @@ def capture_iq_datafile(
setattr(device, key, value)

# Capture data
device.rx_enabled_channels = [channel]
device.rx_buffer_size = samples
data = device.rx()

Expand Down

0 comments on commit f8cdc04

Please sign in to comment.