Parser for NI TDMS files written in Elixir. The TDMS file parser is implemented natively in elixir and comes with zero-dependencies.
You can see the API documentation here.
The package can be installed by adding tdms_parser
to your list of dependencies in mix.exs
:
defp deps do
[
{:tdms_parser, "~> 0.0"}
]
end
The following command parses the given file and returns a TDMS.File structure.
iex> TDMS.Parser.parse(File.read!("test/data/basic.tdms"))
The single, most important feature to understand about the internal format of the TDMS file structure is its inherent hierarchical organization. The TDMS file format is structured using three levels of hierarchy: file, group, and channel. The file level can contain groups, and each group can contain multiple channels.
The high-level description of the TDMS file format can be found at The NI TDMS File Format.
For a detailed description of all fields, their data types and byte representations see TDMS File Format Internal Structure.
%TDMS.File{
path: "/",
properties: [
%TDMS.Property{
data_type: :string,
name: "name",
value: "ni-crio-9068-190fdf5_20190609_235850.tdms"
}
],
groups: [
%TDMS.Group{
name: "Temperature",
path: "/'Temperature'",
properties: [
%TDMS.Property{data_type: :string, name: "name", value: "Temperature"}
]
channels: [
%TDMS.Channel{
data: [24.172693869632123, 24.238202284912816, 24.22418907461031, ...],
data_count: 201,
data_type: :double,
name: "ai.0",
path: "/'Temperature'/'ai.0'",
properties: [
%TDMS.Property{data_type: :string, name: "name", value: "ai.0"},
%TDMS.Property{
data_type: :string,
name: "datatype",
value: "DT_DOUBLE"
},
...
]
},
%TDMS.Channel{
data: [24.07053512461277, 24.136787008557807, 24.128304594848682, ...],
data_count: 201,
data_type: :double,
name: "ai.1",
path: "/'Temperature'/'ai.1'",
properties: [
%TDMS.Property{data_type: :string, name: "name", value: "ai.1"},
%TDMS.Property{
data_type: :string,
name: "datatype",
value: "DT_DOUBLE"
},
...
]
},
...
]
}
]
}
Build:
mix compile
Run the unit tests:
mix test --only unittest
Run the integration tests:
mix test --only integration