ca.nengo.io
Class DelimitedFileExporter

java.lang.Object
  extended by ca.nengo.io.DelimitedFileExporter

public class DelimitedFileExporter
extends java.lang.Object

Exports TimeSeries, SpikePattern, and float[][] data to delimited text files.

Author:
Bryan Tripp

Constructor Summary
DelimitedFileExporter()
          Uses default column delimiter ", " and row delimiter "\r\n".
DelimitedFileExporter(java.lang.String columnDelim, java.lang.String rowDelim)
           
 
Method Summary
 void export(float[][] matrix, java.io.File file)
          Exports a matrix with rows and columns delimited as specified in the constructor.
 void export(SpikePattern pattern, java.io.File file)
          Exports a SpikePattern as a matrix with spikes times of each neuron in a different row.
 void export(TimeSeries series, java.io.File file)
          Exports a TimeSeries with times in the first column and data from each dimension in subsequent columns.
 void export(TimeSeries series, java.io.File file, float tau)
          Exports a TimeSeries as a matrix with times in the first column and data from each dimension in subsequent rows.
 float[][] importAsMatrix(java.io.File file)
          Imports a delimited file as a matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelimitedFileExporter

public DelimitedFileExporter()
Uses default column delimiter ", " and row delimiter "\r\n".


DelimitedFileExporter

public DelimitedFileExporter(java.lang.String columnDelim,
                             java.lang.String rowDelim)
Parameters:
columnDelim - String used to delimit items within a matrix row
rowDelim - String used to delimit rows of a matrix
Method Detail

export

public void export(TimeSeries series,
                   java.io.File file)
            throws java.io.IOException
Exports a TimeSeries with times in the first column and data from each dimension in subsequent columns.

Parameters:
series - TimeSeries to export
file - File to which to export the TimeSeries
Throws:
java.io.IOException

export

public void export(TimeSeries series,
                   java.io.File file,
                   float tau)
            throws java.io.IOException
Exports a TimeSeries as a matrix with times in the first column and data from each dimension in subsequent rows.

Parameters:
series - TimeSeries to export
file - File to which to export the TimeSeries
tau - Time constant with which to filter data
Throws:
java.io.IOException

export

public void export(SpikePattern pattern,
                   java.io.File file)
            throws java.io.IOException
Exports a SpikePattern as a matrix with spikes times of each neuron in a different row.

Parameters:
pattern - SpikePattern to export
file - File to which to export the SpikePattern
Throws:
java.io.IOException

export

public void export(float[][] matrix,
                   java.io.File file)
            throws java.io.IOException
Exports a matrix with rows and columns delimited as specified in the constructor.

Parameters:
matrix - The matrix to export
file - File to which to export the matrix
Throws:
java.io.IOException

importAsMatrix

public float[][] importAsMatrix(java.io.File file)
                         throws java.io.IOException
Imports a delimited file as a matrix. Assumes that rows are delimited as lines, and items in a row are delimited with one or more of the following: comma, colon, semicolon, space, tab.

Parameters:
file - File from which to load matrix
Returns:
Matrix from file
Throws:
java.io.IOException