-
Notifications
You must be signed in to change notification settings - Fork 21
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
7 changed files
with
315 additions
and
50 deletions.
There are no files selected for viewing
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
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
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,45 @@ | ||
import json | ||
import pytest | ||
from pathlib import Path | ||
|
||
from zhinst.toolkit.command_table import CommandTable | ||
|
||
|
||
CT_SCHEMA_22_02 = Path(__file__).parent / "data/command_table_schema_22_02.json" | ||
CT_SCHEMA_22_08 = Path(__file__).parent / "data/command_table_schema_22_08.json" | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def command_table_completed(): | ||
"""L1 22.02""" | ||
with open(Path(__file__).parent / "data/command_table_completed.json") as f: | ||
data = json.load(f) | ||
yield data | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def command_table_schema_22_02(): | ||
"""L1 22.02""" | ||
with open(CT_SCHEMA_22_02) as f: | ||
data = json.load(f) | ||
return data | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def command_table_schema_22_08(): | ||
"""L1 22.08""" | ||
with open(CT_SCHEMA_22_08) as f: | ||
data = json.load(f) | ||
return data | ||
|
||
|
||
@pytest.fixture(scope="module", params=[CT_SCHEMA_22_02, CT_SCHEMA_22_08]) | ||
def command_table_schema(request): | ||
with open(request.param) as f: | ||
data = json.load(f) | ||
return data | ||
|
||
|
||
@pytest.fixture | ||
def command_table(command_table_schema): | ||
yield CommandTable(command_table_schema) |
2 changes: 1 addition & 1 deletion
2
tests/data/command_table_completed.json → ...d_table/data/command_table_completed.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
File renamed without changes.
218 changes: 218 additions & 0 deletions
218
tests/command_table/data/command_table_schema_22_08.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,218 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-04/schema#", | ||
"title": "AWG Command Table Schema", | ||
"description": "Schema for ZI SHFSG AWG Command Table", | ||
"version": "1.1.0", | ||
"definitions": { | ||
"header": { | ||
"properties": { | ||
"version": { | ||
"type": "string", | ||
"pattern": "^1\\.[0-1](\\.[0-9]+)?$", | ||
"description": "File format version (Major.Minor / Major.Minor.Patch). This version must match with the relevant schema version." | ||
}, | ||
"partial": { | ||
"description": "Set to true for incremental table updates", | ||
"type": "boolean", | ||
"default": "false" | ||
}, | ||
"userString": { | ||
"description": "User-definable label", | ||
"type": "string", | ||
"maxLength": 30 | ||
} | ||
}, | ||
"required": [ | ||
"version" | ||
] | ||
}, | ||
"table": { | ||
"items": { | ||
"$ref": "#/definitions/entry" | ||
}, | ||
"minItems": 0, | ||
"maxItems": 1024 | ||
}, | ||
"entry": { | ||
"properties": { | ||
"index": { | ||
"$ref": "#/definitions/tableindex" | ||
}, | ||
"waveform": { | ||
"$ref": "#/definitions/waveform" | ||
}, | ||
"phase": { | ||
"$ref": "#/definitions/phase" | ||
}, | ||
"amplitude00": { | ||
"$ref": "#/definitions/amplitude" | ||
}, | ||
"amplitude01": { | ||
"$ref": "#/definitions/amplitude" | ||
}, | ||
"amplitude10": { | ||
"$ref": "#/definitions/amplitude" | ||
}, | ||
"amplitude11": { | ||
"$ref": "#/definitions/amplitude" | ||
}, | ||
"oscillatorSelect": { | ||
"$ref": "#/definitions/oscillatorselect" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"index" | ||
] | ||
}, | ||
"tableindex": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 1023, | ||
"exclusiveMinimum": false, | ||
"exclusiveMaximum": false | ||
}, | ||
"waveform": { | ||
"properties": { | ||
"index": { | ||
"$ref": "#/definitions/waveformindex" | ||
}, | ||
"length": { | ||
"$ref": "#/definitions/waveformlength" | ||
}, | ||
"samplingRateDivider": { | ||
"$ref": "#/definitions/samplingratedivider" | ||
}, | ||
"playZero": { | ||
"$ref": "#/definitions/playzero" | ||
}, | ||
"awgChannel0": { | ||
"$ref": "#/definitions/awgchannel" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"anyOf": [ | ||
{ | ||
"required": [ | ||
"index" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"playZero", | ||
"length" | ||
] | ||
} | ||
] | ||
}, | ||
"waveformindex": { | ||
"description": "Index of the waveform to play as defined with the assignWaveIndex sequencer instruction", | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 65535, | ||
"exclusiveMinimum": false, | ||
"exclusiveMaximum": false | ||
}, | ||
"awgchannel": { | ||
"description": "Assign the given AWG channel to signal output 0 & 1", | ||
"type": "array", | ||
"minItems": 1, | ||
"maxItems": 2, | ||
"uniqueItems": true, | ||
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"sigout0", | ||
"sigout1" | ||
] | ||
} | ||
}, | ||
"waveformlength": { | ||
"description": "The length of the waveform in samples", | ||
"type": "integer", | ||
"multipleOf": 16, | ||
"minimum": 32, | ||
"exclusiveMinimum": false | ||
}, | ||
"samplingratedivider": { | ||
"descpription": "Integer exponent n of the sampling rate divider: 2.0 GSa/s / 2^n, n in range 0 ... 13", | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 13 | ||
}, | ||
"playzero": { | ||
"description": "Play a zero-valued waveform for specified length of waveform, equivalent to the playZero sequencer instruction", | ||
"type": "boolean", | ||
"default": "false" | ||
}, | ||
"phase": { | ||
"properties": { | ||
"value": { | ||
"description": "Phase value of the given sine generator in degree", | ||
"type": "number" | ||
}, | ||
"increment": { | ||
"description": "Set to true for incremental phase value, or to false for absolute", | ||
"type": "boolean", | ||
"default": "false" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"value" | ||
] | ||
}, | ||
"amplitude": { | ||
"properties": { | ||
"value": { | ||
"description": "Amplitude scaling factor of the given AWG channel", | ||
"type": "number", | ||
"minimum": -1.0, | ||
"maximum": 1.0, | ||
"exclusiveMinimum": false, | ||
"exclusiveMaximum": false | ||
}, | ||
"increment": { | ||
"description": "Set to true for incremental amplitude value, or to false for absolute", | ||
"type": "boolean", | ||
"default": "false" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"value" | ||
] | ||
}, | ||
"oscillatorselect": { | ||
"properties": { | ||
"value": { | ||
"description": "Index of oscillator that is selected for sine/cosine generation", | ||
"type": "number", | ||
"minimum": 0, | ||
"maximum": 7, | ||
"exclusiveMinimum": false, | ||
"exclusiveMaximum": false | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"value" | ||
] | ||
} | ||
}, | ||
"properties": { | ||
"$schema": { | ||
"type": "string" | ||
}, | ||
"header": { | ||
"$ref": "#/definitions/header" | ||
}, | ||
"table": { | ||
"$ref": "#/definitions/table" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"header" | ||
] | ||
} |
Oops, something went wrong.