Portable bounded TDMS 2.0 measurement data interchange
moon add Lucaswang5777/moontdms@0.2.3import {
"Lucaswang5777/moontdms" @tdms,
}
pkgtype(kind: "executable")fn main raise {
let doc : @tdms.Document = {
objects: [@tdms.DataObject::new(
@tdms.ObjectPath::channel("run", "voltage"),
kind=@tdms.F64,
values=[@tdms.Real(1.25), @tdms.Real(1.5)],
)],
}
let bytes = @tdms.write(doc)
let restored = @tdms.read(bytes)
println(restored.csv())
}moon run . --target js| 用户与入口 | 输入与处理 | 可断言结果 |
|---|---|---|
| 采集/测试接入作者:examples/ingest | 构造带单位的采集文档,写为 TDMS,再读取类型化通道 | 三个电压样本与 V 单位保留 |
| 实验室流水线:examples/crop | 选择温度通道样本 [1,3),重算波形偏移,写回 TDMS | 两个样本,对应相对时刻 10.25、10.5 |
| 报表系统:examples/report | 对电流通道求摘要并输出 CSV | 均值 4、最小值 2、最大值 6,CSV 含单位和样本 |
moon run examples/ingest --target js --deny-warn
moon run examples/crop --target js --deny-warn
moon run examples/report --target js --deny-warnmoon run examples/daqmx --target js --deny-warnmoon build --target js --deny-warn
node _build/js/debug/build/cmd/main/main.js '{"protocol":"moontdms/1","op":"encode","objects":[{"path":"/\u0027g\u0027/\u0027c\u0027","type":3,"values":["1","2"]}]}'| op | 字段 | result |
|---|---|---|
| encode | objects,可选 big_endian/interleaved | hex |
| decode | hex | objects |
| raw | hex | objects、daqmx scaler 流 |
| physical | hex | objects、普通物理值 hex |
| crop_raw | hex、paths,可选 start/end/big_endian | 保留原始采样与缩放的 hex |
| inspect | hex | segments |
| select | hex、paths,可选 start/end | hex |
| csv | hex,可选 waveform_time | csv |
moon info --target all
moon fmt --check
moon check --target js --deny-warn
moon test --target js --deny-warn
moon build --target js --deny-warn
python -m pip install numpy==2.3.5 npTDMS==1.10.0
python scripts/differential.py
python scripts/daqmx_differential.py
python scripts/cli_smoke.py
python scripts/audit.pyfn Acquisition::select(self : Acquisition, paths : Array[ObjectPath], start? : Int, end? : Int, limits? : Limits) -> Acquisition raise TdmsErrorfn Acquisition::write(self : Acquisition, big_endian? : Bool, limits? : Limits) -> Bytes raise TdmsErrorpub(all) struct DaqChannel {
path : ObjectPath
scalers : Array[ScalerData]
native_type : DataType?
} derive(Eq, Debug)fn DataObject::new(path : ObjectPath, kind? : DataType, values? : Array[Value], properties? : Array[Property]) -> DataObject