dnoberon / tdms Goto Github PK
View Code? Open in Web Editor NEWRust library for parsing TDMS files
License: MIT License
Rust library for parsing TDMS files
License: MIT License
Asynchronously reading large TDMS files using tokio::fs
could be beneficial for performance. I am willing to create a pull request for this and draw on my experience from implementing reading TDMS files in F#.
Hi,
I am starting with rust and labview and I am trying out this library, thanks for the work men!
Just a question about how to extract a value from a TDMSValue
. In this particular case I need to extract the date to send it to a .csv
file. I have this function:
fn extract_date(tdms_file: &TDMSFile, file: &mut File) -> std::io::Result<()> {
let name = tdms_file.segments.get(0).unwrap().metadata.clone().unwrap();
let obj = name
.objects
.iter()
.find(|obj| obj.object_path == "/")
.unwrap();
// .collect();
let date = obj
.properties
.iter()
.find(|n| n.name == "DateTime")
.unwrap()
.value
.clone();
println!("extract date ---------->>> {:?}", date);
Ok(())
}
date
is of type TDMSValue
, reading the docs I found that this struct has a method pub fn from_reader(...)
that I supose that is to extract that value from value depending on each type, but It seems that this function does not exists. I am not able to call this function.
Do you know what can be happening? any help is welcome. ๐
I am attempting to read in a tdms file so I can perform calculations on the data contained within. The structure of the file is this:
test.tdms
aux_data
time [s]
distance [in]
gps
mic_data
time [s]
mic 1
mic 2
... mic 12
Reading in this test.tdms file like so:
let file = match TDMSFile::from_path(Path::new("src/data/test.tdms")) {
Ok(f) => f,
Err(e) => panic!("{:?}", e),
};
throws the following error. I fear that the error is due to the tiered structure of my data because reading in the provided (non-tiered) standard, raw, and big endian tdms files works fine.
thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tdms-0.2.5\src\segment.rs:114:75
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library\std\src\panicking.rs:584
1: core::panicking::panic_fmt
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library\core\src\panicking.rs:142
2: core::panicking::panic_bounds_check
at /rustc/897e37553bba8b42751c67658967889d11ecd120/library\core\src\panicking.rs:84
3: core::slice::index::impl$2::index<str>
at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\slice\index.rs:250
4: core::slice::index::impl$0::index
at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\slice\index.rs:18
5: alloc::vec::impl$16::index<str,usize,alloc::alloc::Global>
at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\alloc\src\vec\mod.rs:2628
6: tdms::segment::Segment::new<std::io::buffered::bufreader::BufReader<std::fs::File> >
at C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tdms-0.2.5\src\segment.rs:114
7: tdms::TDMSFile::from_path
at C:\...\.cargo\registry\src\github.com-1ecc6299db9ec823\tdms-0.2.5\src\lib.rs:124
8: test::tdms_reader::open
at .\src\tdms_reader.rs:11
9: test::main
at .\src\main.rs:15
10: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\ops\function.rs:248
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.