CsImcIo 0.2.0-beta.2
See the version list below for details.
dotnet add package CsImcIo --version 0.2.0-beta.2
NuGet\Install-Package CsImcIo -Version 0.2.0-beta.2
<PackageReference Include="CsImcIo" Version="0.2.0-beta.2" />
<PackageVersion Include="CsImcIo" Version="0.2.0-beta.2" />
<PackageReference Include="CsImcIo" />
paket add CsImcIo --version 0.2.0-beta.2
#r "nuget: CsImcIo, 0.2.0-beta.2"
#:package CsImcIo@0.2.0-beta.2
#addin nuget:?package=CsImcIo&version=0.2.0-beta.2&prerelease
#tool nuget:?package=CsImcIo&version=0.2.0-beta.2&prerelease
CsImcIo
A .NET library for reading imc Famos data files (*.dat, *.raw) as written by
imc FAMOS, imc STUDIO and imc measurement devices. Both file format generations are
supported: imc2 (ASCII-key format, FAMOS up to 7.3) and imc3 (binary format,
FAMOS 7.4+).
The library is read-only. Metadata is parsed when a file is opened; sample data is read lazily per channel.
CsImcIo is an independent open-source project and is not affiliated with or endorsed by imc Test & Measurement GmbH.
Installation
The initial release is a prerelease targeting .NET 10:
dotnet add package CsImcIo --version 0.1.0-beta.1
The public API may change before version 1.0.
Usage
using CsImcIo;
using CsImcIo.Model;
using var file = FamosFile.Open("measurement.dat");
Console.WriteLine($"Producer: {file.Data.FileProducer}");
foreach (var channel in file.Data.AllChannels)
{
if (!channel.CanReadData)
{
Console.WriteLine($"{channel.Name}: skipped ({channel.UnsupportedDataReason})");
continue;
}
if (channel is FamosAnalogChannel analog)
{
var data = analog.ReadData();
Console.WriteLine(
$"{analog.Name} [{data.Unit}]: {data.Values.Length} samples, " +
$"x0={data.X0} {data.XUnit}, dx={data.Dx} {data.XUnit}");
}
}
FamosData additionally exposes Groups, SingleValues and TextValues
(text variables and text arrays), each with attached properties where present.
Channel kinds
FamosChannel is an abstract base carrying the metadata every channel has: index,
names, properties, trigger info, and the x-axis (X0, Dx, XUnit). The concrete
type describes what one sample is, and defines the reader for it, because the kinds
do not share a result shape:
FamosAnalogChannel.ReadData()returns scaleddouble[]values.FamosDigitalChannel.ReadData()returns the raw 16-bit portWords. Digital data is never scaled and has no unit.Bitslists the named signals of the port, andReadBit(indexBit)decodes one of them without materializing the other fifteen.FamosTimeStampAsciiChannelholds variable-length time-stamped records rather than equidistant samples, so it has no sample count and is read by walking it.ReadRecords()streams without allocating;ReadAllRecords()materializes the log.
if (channel is FamosTimeStampAsciiChannel bus)
{
foreach (var record in bus.ReadRecords())
{
Console.WriteLine($"{record.Time} {bus.XUnit}: {record.GetText()}");
}
}
ReadRecords() returns a ref struct, so a record's Content cannot outlive the loop —
the compiler rejects storing it, boxing it, or holding it across an await. Call
ToRecord() to keep one. The content may be arbitrary bytes rather than text: the file's
declared code page does not apply to Time Stamp ASCII, so GetText() decodes
byte-preserving unless another encoding is passed.
A multi-event (multi-shot) channel records several trigger events in one block.
EventCount reports how many, ReadEvents() returns their descriptors without reading
samples, and ReadData() packs the samples of all events into one array — leaving out
any gaps between them in the file — with Events locating each one:
var data = analog.ReadData();
foreach (var recorded in data.Events)
{
var samples = data.Values.AsSpan(recorded.StartIndex, recorded.SampleCount);
Console.WriteLine($"shot at {recorded.TriggerTime}: {samples.Length} samples");
}
The file records per-event trigger time, x-axis and scaling alongside flags saying which
of them apply; FamosEvent reports the effective value, falling back to the channel's
own where the event does not override it. Each event is scaled with its own factor.
The hierarchy is closed — only the library can derive from FamosChannel — so a
type switch over the channel kinds stays exhaustive.
if (channel is FamosDigitalChannel port)
{
foreach (var bit in port.Bits)
{
bool[] signal = port.ReadBit(bit.IndexBit);
Console.WriteLine($"{bit.Name}: {signal.Count(v => v)} samples high");
}
}
To test a bit against the raw words yourself, use bit.Mask rather than shifting by
bit.IndexBit, which is a file-format value and not a shift amount.
Indices that come from the file are presented as the file states them: ChannelIndex
and GroupIndex are 1-based, and IndexBit on a channel name or a property is 1 to 16
for the bits of a digital port from least to most significant, with 0 meaning the name
or property applies to the whole channel. These are file-format values rather than .NET
collection indices, so they can be compared directly against the FAMOS user interface
and the format documentation.
Supported
- imc2 and imc3 files, including format auto-detection
- Groups, channels, single values, text variables/arrays, properties
- Equidistant (1-component), XY and complex (2-component) channels
- Digital ports: 16-bit words with per-bit names, comments and properties
- Multi-event (multi-shot) imc3 channels with one component: per-event trigger time, x-axis and scaling, and chunks whose events are separated by gaps
- Time Stamp ASCII channels: time-stamped records streamed out of their 512-byte synchronisation clusters, including records that span cluster boundaries
- All fixed-size numerical formats (integers 8–64 bit, 48-bit time tracks, float, double)
- Value scaling (
physical = raw * factor + offset) - Channel-multiplexed imc2 data (interleaved buffers)
- ANSI code pages (via
|NL/|CL1keys) and UTF-8 (imc3); files without a declared code page fall back to Latin-1
Not supported
Opening a file with unsupported channel-level features succeeds; the affected
channels keep their metadata but report CanReadData == false with the reason in
UnsupportedDataReason, and ReadData() throws NotSupportedException:
- Multi-event imc2 channels: their events are stored as separate buffers
(
|CbNewEvent), which needs multi-buffer support - Multi-event channels with two components, multi-event digital ports and multi-event Time Stamp ASCII channels
- Digital and Time Stamp ASCII channels with more than one component, and channels mixing them with numeric components
- Extraction rules for deriving channels from a Time Stamp ASCII stream (
|NE,|CX1) - Segmented (matrix) data
- Ring buffers and channels spanning multiple buffers (imc2)
- zlib-compressed data blocks (
|CS,2)
File-level obstacles (imc3 compression, online variants) throw at Open, as do
files in the older imc1 format (|CF,1), which is out of scope.
Writing files is out of scope.
Notes
- The parsed metadata is immutable; channel data can be read from multiple
threads concurrently (e.g.
Parallel.ForEachoverAllChannels). Files opened from a path or an in-memory stream read in parallel; other streams serialize reads internally. Do not dispose theFamosFilewhile reads are in flight, and do not access a stream you passed toOpenyourself while the file is open. - All times (
TriggerTime,TimeOfOrigin) are local wall-clock times withDateTimeKind.Unspecified. When an imc3 file declares its UTC offset, the stored time is shifted to local time accordingly. - The file formats are documented in the "imc Shared Components" manual, chapter imc File format.
Benchmarks
./scripts/benchmark-portable.sh runs the benchmarks that use committed test
data. dotnet run -c Release --project CsImcIo.Benchmarks -- --filter "*" runs
the complete BenchmarkDotNet suite, including scenarios that require the
local-only large measurement file. Recorded results and the optimization log
live in CsImcIo.Benchmarks/Optimization.
Tests
./scripts/verify.sh restores dependencies, verifies formatting, builds in Release
with warnings treated as errors, and runs the test suite. Tests use the sample files
in CsImcIo.Tests/TestData plus synthetically generated files. One large measurement
file used by MeasurementDataTests is not committed; the test reports inconclusive
when it is absent.
The code boundaries and performance constraints used for maintenance are documented in the architecture notes.
Release preparation and publishing are documented in RELEASING.md.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.0-beta.1 | 129 | 8/4/2026 |
| 0.3.0-beta.1 | 86 | 8/3/2026 |
| 0.2.0-beta.2 | 86 | 8/1/2026 |
| 0.2.0-beta.1 | 90 | 7/31/2026 |