qftrace: Network analyser trace file parser

The module handles the reading and processing of the network analyzer traces, containing the reflection coefficient as a function of the sweeped frequency, \(\Gamma(f)\).

qftrace loads the reflection trace data, determines the uncertainties of the signal (y-axis), and explicitly populates the points in the time axis (x-axis).

Usage

Available since yadg-3.0. The parser supports the following parameters:

pydantic model dgbowl_schemas.yadg.dataschema_5_0.step.QFTrace

Parser for network analyzer traces.

Show JSON schema
{
   "title": "QFTrace",
   "description": "Parser for network analyzer traces.",
   "type": "object",
   "properties": {
      "tag": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Tag"
      },
      "parser": {
         "const": "qftrace",
         "title": "Parser"
      },
      "input": {
         "$ref": "#/$defs/Input"
      },
      "extractor": {
         "$ref": "#/$defs/LabView_csv"
      },
      "parameters": {
         "anyOf": [
            {
               "$ref": "#/$defs/Parameters"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "externaldate": {
         "anyOf": [
            {
               "$ref": "#/$defs/ExternalDate"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "ExternalDate": {
         "additionalProperties": false,
         "description": "Supply timestamping information that are external to the processed file.",
         "properties": {
            "using": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ExternalDateFile"
                  },
                  {
                     "$ref": "#/$defs/ExternalDateFilename"
                  },
                  {
                     "$ref": "#/$defs/ExternalDateISOString"
                  },
                  {
                     "$ref": "#/$defs/ExternalDateUTSOffset"
                  }
               ],
               "title": "Using"
            },
            "mode": {
               "default": "add",
               "enum": [
                  "add",
                  "replace"
               ],
               "title": "Mode",
               "type": "string"
            }
         },
         "required": [
            "using"
         ],
         "title": "ExternalDate",
         "type": "object"
      },
      "ExternalDateFile": {
         "additionalProperties": false,
         "description": "Read external date information from file.",
         "properties": {
            "file": {
               "$ref": "#/$defs/dgbowl_schemas__yadg__dataschema_5_0__externaldate__ExternalDateFile__Content"
            }
         },
         "required": [
            "file"
         ],
         "title": "ExternalDateFile",
         "type": "object"
      },
      "ExternalDateFilename": {
         "additionalProperties": false,
         "description": "Read external date information from the file name.",
         "properties": {
            "filename": {
               "$ref": "#/$defs/dgbowl_schemas__yadg__dataschema_5_0__externaldate__ExternalDateFilename__Content"
            }
         },
         "required": [
            "filename"
         ],
         "title": "ExternalDateFilename",
         "type": "object"
      },
      "ExternalDateISOString": {
         "additionalProperties": false,
         "description": "Read a constant external date using an ISO-formatted string.",
         "properties": {
            "isostring": {
               "title": "Isostring",
               "type": "string"
            }
         },
         "required": [
            "isostring"
         ],
         "title": "ExternalDateISOString",
         "type": "object"
      },
      "ExternalDateUTSOffset": {
         "additionalProperties": false,
         "description": "Read a constant external date using a Unix timestamp offset.",
         "properties": {
            "utsoffset": {
               "title": "Utsoffset",
               "type": "number"
            }
         },
         "required": [
            "utsoffset"
         ],
         "title": "ExternalDateUTSOffset",
         "type": "object"
      },
      "Input": {
         "additionalProperties": false,
         "description": "Specification of input files/folders to be processed by the :class:`Step`.",
         "properties": {
            "folders": {
               "items": {
                  "type": "string"
               },
               "title": "Folders",
               "type": "array"
            },
            "prefix": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Prefix"
            },
            "suffix": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Suffix"
            },
            "contains": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Contains"
            },
            "exclude": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Exclude"
            }
         },
         "required": [
            "folders"
         ],
         "title": "Input",
         "type": "object"
      },
      "LabView_csv": {
         "additionalProperties": false,
         "properties": {
            "filetype": {
               "const": "labview.csv",
               "title": "Filetype"
            },
            "timezone": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timezone"
            },
            "locale": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Locale"
            },
            "encoding": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Encoding"
            }
         },
         "required": [
            "filetype"
         ],
         "title": "LabView_csv",
         "type": "object"
      },
      "Parameters": {
         "additionalProperties": false,
         "description": "Empty parameters specification with no extras allowed.",
         "properties": {},
         "title": "Parameters",
         "type": "object"
      },
      "dgbowl_schemas__yadg__dataschema_5_0__externaldate__ExternalDateFile__Content": {
         "additionalProperties": false,
         "properties": {
            "path": {
               "title": "Path",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "type": "string"
            },
            "match": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Match"
            }
         },
         "required": [
            "path",
            "type"
         ],
         "title": "Content",
         "type": "object"
      },
      "dgbowl_schemas__yadg__dataschema_5_0__externaldate__ExternalDateFilename__Content": {
         "additionalProperties": false,
         "properties": {
            "format": {
               "title": "Format",
               "type": "string"
            },
            "len": {
               "title": "Len",
               "type": "integer"
            }
         },
         "required": [
            "format",
            "len"
         ],
         "title": "Content",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "parser",
      "input",
      "extractor"
   ]
}

Config:
  • extra: str = forbid

field parser: Literal['qftrace'] [Required]
field extractor: LabView_csv [Required]
  • LabView output in a tab-separated format (csv): labviewcsv

Schema

For filetypes containing the reflection trace data, the schema is as follows:

datatree.DataTree:
  S11:
    coords:
      uts:        !!float
      freq:       !!float       # Field frequency (Hz)
    data_vars:
      Re(G):      (uts, freq)   # Imaginary part of the reflection coefficient
      Im(G)       (uts, freq)   # Real part of the reflection coefficient
      average:    (uts)         # Number of scans averaged to form a single trace
      bandwidth:  (uts)         # Filter bandwidth (Hz)

Module Functions

yadg.parsers.qftrace.process(*, filetype, **kwargs)

VNA reflection trace parser. Forwards kwargs to the worker functions based on the supplied filetype.

Parameters:

filetype (str) – Discriminator used to select the appropriate worker function.

Return type:

datatree.DataTree

Submodules

labviewcsv: Processing Agilent LabVIEW CSV files

Used to process files generated using Agilent PNA-L N5320C via its LabVIEW driver. This file format includes a header, with the values of bandwidth and averaging, and three tab-separated columns containing the frequency \(f\), and the real and imaginary parts of the complex reflection coefficient \(\Gamma(f)\).

Timestamps are determined from file name. One trace per file. As the set-up for which this format was designed always uses the S11 port, the name of the trace is hard-coded to this value.

Code author: Peter Kraus

yadg.parsers.qftrace.labviewcsv.process(*, fn, encoding='utf-8', **kwargs)

VNA reflection trace parser for Agilent’s LabVIEW driver.

Parameters:
  • fn (str) – File to process

  • encoding (str) – Encoding of fn, by default “utf-8”.

Returns:

A datatree.DataTree containing a single xarray.Dataset with the S11 (reflection) trace.

Return type:

datatree.DataTree