You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Doc_BoxAlgorithm_CSVFileWriter.dox-part 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /**
  2. * \page BoxAlgorithm_CSVFileWriter CSV File Writer
  3. __________________________________________________________________
  4. Detailed description
  5. __________________________________________________________________
  6. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Description|
  7. This box writes incoming time series along with a stimulation stream into a text file using the
  8. Comma Separated Values format conforming to the RFC 4180 format.
  9. The header of the CSV file contains some additional information that enables additional features
  10. during subsequent reading. This format is described in the \ref Doc_BoxAlgorithm_CSVFileWriter_Miscellaneous
  11. section.
  12. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Description|
  13. __________________________________________________________________
  14. Inputs description
  15. __________________________________________________________________
  16. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Inputs|
  17. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Inputs|
  18. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Input1|
  19. Time series input, this can be either a Signal, Streamed Matrix, Spectrum, Covariance Matrix or Feature Vector stream.
  20. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Input1|
  21. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Input2|
  22. Stimulations to be written alongside the signal.
  23. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Input2|
  24. __________________________________________________________________
  25. Settings description
  26. __________________________________________________________________
  27. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Settings|
  28. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Settings|
  29. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Setting1|
  30. Path of the CSV file to be written.
  31. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Setting1|
  32. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Setting2|
  33. Precision, in number of decimal digits, of the resulting data. For longer data the precision can significantly impact the file size.
  34. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Setting2|
  35. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Setting3|
  36. By default this box will overwrite data in the file if it exists. If this setting is set to true, the box will append data to the file instead. If the file is empty a header will be added as well. It is up to the user to ensure herself that the data written is of the same type and dimensions.
  37. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Setting3|
  38. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Setting4|
  39. If this setting is activated, only the last received matrix will be written to the file. This can be used, for example, with cumulative average box.
  40. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Setting4|
  41. __________________________________________________________________
  42. Examples description
  43. __________________________________________________________________
  44. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Examples|
  45. Example of writing a spectrum into a CSV file:
  46. \image html csv-file-writer-example.png "Writing a CSV file"
  47. \image latex csv-file-writer-example.png "Writing a CSV file" width=8cm
  48. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Examples|
  49. __________________________________________________________________
  50. Miscellaneous description
  51. __________________________________________________________________
  52. * |OVP_DocBegin_BoxAlgorithm_CSVFileWriter_Miscellaneous|
  53. The CSV Format
  54. ## Example file containing Signal data and Stimulations
  55. Signal file sampled at 8Hz, with epochs of 0.5s length. Note that the timestamps do not have an end time which is implicit.
  56. In this example each x represents an arbitrary floating point value. The header contains the following rows:
  57. - Time:8Hz - contains the timestamp of each sample, this label also encodes the original sampling rate
  58. - Epoch - contains the number of the epoch in which each sample is contained, this allows encoding even overlapping signal
  59. - O1, O2, Pz, P3, P4 - channels containing EEG data
  60. - Event Id - contains a colon separated list of StimulationIds
  61. - Event Date - contains the same number of timestamps
  62. - Event Duration - is constructed in the same manner as Event Date
  63. \code{.unparsed}
  64. Time:8Hz,Epoch,O1,O2,Pz,P3,P4,Event Id,Event Date,Event Duration
  65. 0.00000,0,x,x,x,x,x,,,
  66. 0.12500,0,x,x,x,x,x,,,
  67. 0.25000,0,x,x,x,x,x,32000:32010,0.25000:0.25000,0:0
  68. 0.37500,0,x,x,x,x,x,,,
  69. 0.50000,1,x,x,x,x,x,,,
  70. 0.62500,1,x,x,x,x,x,,,
  71. 0.75000,1,x,x,x,x,x,35000,0.75250,0
  72. 0.87500,1,x,x,x,x,x,,,
  73. \endcode
  74. ## Example file containing a three dimensional matrix
  75. This example file contains 2x2x2 matrices produced every 0.125 seconds and spanning one second.
  76. The labels for this matrix are:
  77. - for first dimension "LA", "LB"
  78. - for second dimension "1", "2"
  79. - for third dimension "X", "Y"
  80. \code{.unparsed}
  81. Time:2x2x2,End Time,LA:1:X,LA:1:Y,LA:2:X,LA:2:Y,LB:1:X,...,LB:2:Y,Event Id,Event Date,Event Duration
  82. 0.00000,1.00000,x,x,x,x,x,...,x,,,
  83. 0.12500,1.12500,x,x,x,x,x,...,x,,,
  84. 0.25000,1.25000,x,x,x,x,x,...,x,,,
  85. 0.37500,1.37500,x,x,x,x,x,...,x,,,
  86. 0.50000,1.50000,x,x,x,x,x,...,x,,,
  87. 0.62500,1.62500,x,x,x,x,x,...,x,,,
  88. 0.75000,1.75000,x,x,x,x,x,...,x,,,
  89. 0.87500,1.62500,x,x,x,x,x,...,x,,,
  90. 1.00000,2.00000,x,x,x,x,x,...,x,,,
  91. 1.12500,2.12500,x,x,x,x,x,...,x,,,
  92. \endcode
  93. \note
  94. A label can be an empty string. If second dimension had an empty label then the first column would have label "LA::X", if it were the third dimension the column would have label "LA:1:"
  95. ## Example file containing a spectrum
  96. Spectrum file with 2 channels, 128Hz signal and spectra calculated on periods of 1 second every 0.125 seconds. The last element in the Time column (128) represents the original sampling rate.
  97. \code{.unparsed}
  98. Time:2x64:128,End Time,O1:0,O1:1.015873,...,O1:64,O2:0,...,O2:64,Event Id,Event Date,Event Duration
  99. 0.00000,1.00000,x,x,...,x,x,...,x,,,
  100. 0.12500,1.12500,x,x,...,x,x,...,x,,,
  101. 0.25000,1.25000,x,x,...,x,x,...,x,,,
  102. 0.37500,1.37500,x,x,...,x,x,...,x,,,
  103. 0.50000,1.50000,x,x,...,x,x,...,x,,,
  104. 0.62500,1.62500,x,x,...,x,x,...,x,,,
  105. 0.75000,1.75000,x,x,...,x,x,...,x,,,
  106. 0.87500,1.87500,x,x,...,x,x,...,x,,,
  107. 1.00000,2.00000,x,x,...,x,x,...,x,,,
  108. 1.12500,2.12500,x,x,...,x,x,...,x,,,
  109. \endcode
  110. * |OVP_DocEnd_BoxAlgorithm_CSVFileWriter_Miscellaneous|
  111. */