--- source_files: - Common/DTS.Common.Serialization/SoMat/SoMat.File.cs - Common/DTS.Common.Serialization/SoMat/SoMatTestHeader.cs - Common/DTS.Common.Serialization/SoMat/SoMatChannel.cs - Common/DTS.Common.Serialization/SoMat/SoMat.File.Writer.cs generated_at: "2026-04-17T15:38:19.942361+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "950813b64d2e6206" --- # SoMat Serialization Module Documentation ## 1. Purpose This module provides serialization support for exporting `DTS.Serialization.Test` objects to the SoMat file format (a text-based format compatible with DIAdem). It implements the `IWritable` interface to write test data, channel metadata, and filtered data samples to `.txt` files with a specific key-value structure. The module transforms internal test/channel structures into the SoMat schema, including header information, channel definitions, and tab-separated data columns. --- ## 2. Public Interface ### `DTS.Serialization.SoMat.File` A partial class representing the SoMat file format handler. | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `File()` | Initializes a new instance, passing `"SoMat"` to the base `Serialization.File` constructor. | | `Extension` | `static string Extension => ".txt"` | Static property returning the file extension for this format. | | `Exporter` | `IWriter Exporter { get; }` | Lazily initializes and returns a `Writer` instance using `DefaultEncoding`. Wraps exceptions in a custom `Exception` with message "encountered problem getting exporter". | --- ### `DTS.Serialization.SoMat.SoMatTestHeader` Represents the header section of a SoMat file. | Member | Signature | Description | |--------|-----------|-------------| | `TestTitle` | `string TestTitle { get; set; }` | Defaults to empty string. | | `Operator` | `string Operator { get; set; }` | Defaults to empty string. | | `RunDateTime` | `string RunDateTime { get; set; }` | Defaults to empty string. | | `NumLogChannels` | `int NumLogChannels => _channels.Count` | Read-only count of channels. | | `Channels` | `SoMatChannel[] Channels => _channels.ToArray()` | Returns a copy of the internal channel list as an array. | | `NumDataModes` | `int NumDataModes { get; set; }` | Defaults to `1`. | | `Serialize` | `void Serialize(System.IO.StreamWriter sw)` | Writes header key-value pairs to the stream (DM_TestTitle, DM_Operator, RUNDATETIME, DM_NumLogChans, DM_NumDataModes). | | Constructor | `SoMatTestHeader(Test test, FilteredData[] filteredData)` | Populates header from test data; attempts to set Operator from `WindowsIdentity.GetCurrent().Name` (silently catches exceptions). Creates `SoMatChannel` instances for each channel up to `filteredData.Length`. | --- ### `DTS.Serialization.SoMat.SoMatChannel` Represents a single channel's metadata in the SoMat format. | Member | Signature | Description | |--------|-----------|-------------| | `LogicalChannel` | `int LogicalChannel { get; set; }` | Logical channel number. | | `ChanType` | `string ChanType { get; set; }` | Defaults to `"SEQUENTIAL"`. | | `ChanName` | `string ChanName { get; set; }` | Defaults to empty string. | | `NumDataPoints` | `ulong NumDataPoints { get; set; }` | Defaults to `0`. | | `NumDims` | `int NumDims { get; set; }` | Defaults to `2`. | | `DataMode` | `int DataMode { get; set; }` | Defaults to `1`. | | `DataModeType` | `string DataModeType { get; set; }` | Defaults to `"TIMHIS"`. | | `AxisLabelDim1` | `string AxisLabelDim1 { get; set; }` | Defaults to `"Time"`. | | `AxisUnitsDim1