private void eventBin() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens(path); EventEntry ee = u.createEventEntry("event.bin", 1000); u.setMeasurementId("sampleData"); u.setTimestampStart(DateTime.Now); u.setComment("Example data set , derived from Holtervergleich_0001 ."); ee.setFileFormat(ee.createBinFileFormat()); ee.setCommentLength(6); ee.setTypeLength(1); List <Event> eventList = new List <Event>(); eventList.Add(new Event(124, "N", "NORMAL")); eventList.Add(new Event(346, "N", "NORMAL")); eventList.Add(new Event(523, "V", "PVC")); ee.append(eventList); //ee.append(new Event(124, "N", "NORMAL")); //ee.append(new Event(346, "N", "NORMAL")); //ee.append(new Event(523, "V", "PVC ")); ee.setComment("Reference trigger list "); ee.setContentClass("TRIGGER"); ee.setSourceId("trigger_reference .csv"); ee.setSampleRate(1000); ee.setSource("PADSY /M. Kirst "); ee.setTypeLength(1); u.save(); u.closeAll(); }
private void signalBin() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); SignalEntry se = u.createSignalEntry("signal.bin", new String[] { "A", "B" }, DataType.INT16, 250); short[][] A = new short[][] { new short[] { 1, 2, 3 }, new short[] { 4, 5, 6 } }; se.append(A); u.save(); u.closeAll(); }
private void eventXml() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); EventEntry ee = u.createEventEntry("event.xml", 1000); ee.setFileFormat(ee.createXmlFileFormat()); ee.append(new Event(124, "N", "NORMAL")); ee.append(new Event(346, "N", "NORMAL")); ee.append(new Event(523, "V", "PVC")); u.save(); u.closeAll(); }
private void valuesXml() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); ValuesEntry ve = u.createValuesEntry("values.xml", new String[] { "A", "B" }, DataType.INT16, 250); ve.setFileFormat(ve.createXmlFileFormat()); ve.append(new Value(1320, new short[] { 1, 4 })); ve.append(new Value(22968, new short[] { 2, 5 })); ve.append(new Value(30232, new short[] { 3, 6 })); u.save(); u.closeAll(); }
private void eventBin() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); EventEntry ee = u.createEventEntry("event.bin", 1000); ee.setFileFormat(ee.createBinFileFormat()); ee.setCommentLength(6); ee.setTypeLength(1); ee.append(new Event(124, "N", "NORMAL")); ee.append(new Event(346, "N", "NORMAL")); ee.append(new Event(523, "V", "PVC ")); u.save(); u.closeAll(); }
private void signalCsvDouble() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); SignalEntry se = u.createSignalEntry("signalD.csv", new String[] { "A", "B" }, DataType.DOUBLE, 250); double[][] A = new double[][] { new double[] { 1.3, 2.5, 3.2 }, new double[] { 4.3, 5.0, 6.123456 } }; CsvFileFormat cff = se.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator(","); se.setFileFormat(cff); se.append(A); u.save(); u.closeAll(); }
private void signalCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); SignalEntry se = u.createSignalEntry("signal.csv", new String[] { "A", "B" }, DataType.INT16, 250); short[][] A = new short[][] { new short[] { 1, 2, 3 }, new short[] { 4, 5, 6 } }; CsvFileFormat cff = se.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator(","); se.setFileFormat(cff); se.append(A); u.save(); u.closeAll(); }
private void eventCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); EventEntry ee = u.createEventEntry("event.csv", 1000); CsvFileFormat cff = ee.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator("."); ee.setFileFormat(cff); ee.append(new Event(124, "N", "NORMAL")); ee.append(new Event(346, "N", "NORMAL")); ee.append(new Event(523, "V", "PVC")); u.save(); u.closeAll(); }
private void valuesCsv() { UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens("C:\\TestData"); ValuesEntry ve = u.createValuesEntry("values.csv", new String[] { "A", "B" }, DataType.INT16, 250); CsvFileFormat cff = ve.createCsvFileFormat(); cff.setSeparator(";"); cff.setDecimalSeparator("."); ve.setFileFormat(cff); ve.append(new Value(1320, new short[] { 1, 4 })); ve.append(new Value(22968, new short[] { 2, 5 })); ve.append(new Value(30232, new short[] { 3, 6 })); u.save(); u.closeAll(); }
public void testSampleRateAgain() { double sampleRate = 10.24; System.IO.Directory.CreateDirectory(Test1Location + "_x"); Unisens unisensTest = factory.createUnisens(Test1Location + "_x"); SignalEntry signalEntry = unisensTest.createSignalEntry("sampleratetest.bin", new String[] { "c1" }, DataType.INT32, sampleRate); signalEntry.append(new Int32[] { 1, 2, 3, 4 }); unisensTest.save(); unisensTest.closeAll(); SignalEntry testEntry = (SignalEntry)unisensTest.getEntry("sampleratetest.bin"); Assert.AreEqual(sampleRate, testEntry.getSampleRate()); Assert.AreEqual(sampleRate, signalEntry.getSampleRate()); }
public void testLsbValueAgain() { double lsbValue = 1.345; System.IO.Directory.CreateDirectory(Test1Location + "_x"); Unisens unisensTest = factory.createUnisens(Test1Location + "_x"); SignalEntry signalEntry = unisensTest.createSignalEntry("lsbtest.bin", new String[] { "c1" }, DataType.INT32, 400); signalEntry.append(new Int32[] { 1, 2, 3, 4 }); signalEntry.setLsbValue(lsbValue); unisensTest.save(); unisensTest.closeAll(); SignalEntry testEntry = (SignalEntry)unisensTest.getEntry("lsbtest.bin"); Assert.AreEqual(testEntry.getLsbValue(), signalEntry.getLsbValue()); Assert.AreEqual(lsbValue, signalEntry.getLsbValue()); }
public static void tearDownAfterClass() { unisens.closeAll(); }
public static void MyClassCleanup() { unisens.closeAll(); }
// WRITE private void signalTest(string fileFormat, DataType dataType) { string[] Channelnames = { "CH1", "CH2" }; UnisensFactory uf = UnisensFactoryBuilder.createFactory(); Unisens u = uf.createUnisens(path); string fileName = "signal_" + dataType.ToString() + "." + fileFormat; SignalEntry se = u.createSignalEntry(fileName, new String[] { "A", "B" }, dataType, 250); switch (fileFormat) { case "bin": // BIN BinFileFormat bff = se.createBinFileFormat(); bff.setEndianess(Endianess.LITTLE); se.setFileFormat(bff); break; case "xml": // XML XmlFileFormat xff = se.createXmlFileFormat(); se.setFileFormat(xff); break; case "csv": // CSV CsvFileFormat cff = se.createCsvFileFormat(); cff.setSeparator("\t"); cff.setDecimalSeparator("."); se.setFileFormat(cff); break; } switch (dataType) { case DataType.INT8: var A = new sbyte[][] { new sbyte[] { 127, -128 }, new sbyte[] { 2, 5 }, new sbyte[] { 3, 6 } }; //var A = new byte[][] { new byte[] { 127, 255 }, new byte[] { 1, 0 }, new byte[] { 3, 6 } }; se.append(A); break; case DataType.UINT8: //var B = new short[][] { new short[] { 255, 0 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; var B = new byte[][] { new byte[] { 127, 255 }, new byte[] { 1, 0 }, new byte[] { 3, 6 } }; se.append(B); break; case DataType.INT16: var C = new short[][] { new short[] { 32767, -32768 }, new short[] { 2, 5 }, new short[] { 3, 6 } }; se.append(C); break; case DataType.UINT16: var D = new UInt16[][] { new UInt16[] { 65535, 0 }, new UInt16[] { 2, 5 }, new UInt16[] { 3, 6 } }; se.append(D); break; case DataType.INT32: var E = new int[][] { new int[] { 2147483647, -2147483648 }, new int[] { 2, 5 }, new int[] { 3, 6 } }; se.append(E); break; case DataType.UINT32: var F = new UInt32[][] { new UInt32[] { 4294967295, 0 }, new UInt32[] { 2, 5 }, new UInt32[] { 3, 6 } }; se.append(F); break; case DataType.FLOAT: var G = new float[][] { new float[] { 123.4567F, 4 }, new float[] { 2, 5 }, new float[] { 3, 6 } }; se.append(G); break; case DataType.DOUBLE: var H = new double[][] { new double[] { 123.4567D, 4 }, new double[] { 2, 5 }, new double[] { 3, 6 } }; se.append(H); break; } // Attributes se.setAdcResolution(16); se.setBaseline(0); se.setAdcZero(0); se.setComment("FhG - Elektroden "); se.setContentClass("ECG"); se.setSourceId("ecg_m500_250 .bin "); se.setSource("FhG-Elektroden , ADS8345 "); se.setUnit("uV"); se.setLsbValue(1.8273); se.setSampleRate(250); se.setChannelNames(Channelnames); // Save and close u.save(); u.closeAll(); }