Package ca.nengo.util

Examples of ca.nengo.util.TimeSeries


    TestUtil.assertClose(.4f, ts.getValues()[1][0], myTolerance);
    TestUtil.assertClose(1.3f, ts.getValues()[0][1], myTolerance);
  }

  public void testSubsample() {
    TimeSeries ts = DataUtils.subsample(myOriginalSeries, 2);
    assertEquals(5, ts.getTimes().length);
    TestUtil.assertClose(1, ts.getTimes()[0], myTolerance);
    TestUtil.assertClose(3, ts.getTimes()[1], myTolerance);
   
    assertEquals(5, ts.getValues().length);
    assertEquals(3, ts.getValues()[0].length);
    TestUtil.assertClose(.1f, ts.getValues()[0][0], myTolerance);
    TestUtil.assertClose(.3f, ts.getValues()[1][0], myTolerance);
    TestUtil.assertClose(1.1f, ts.getValues()[0][1], myTolerance);
  }
View Full Code Here


    } catch (SimulationException e) {} //exception is expected
   
    myRecorder.connect(new MockProbeable(1f), "x", true);
    myRecorder.collect(1);
   
    TimeSeries ts = myRecorder.getData();
    assertEquals(1, ts.getValues().length);
    assertTrue(ts.getValues()[0][0] > 0);
    assertEquals(Units.UNK, ts.getUnits()[0]);
   
    myRecorder.collect(1);
    assertEquals(2, myRecorder.getData().getValues().length);
   
    myRecorder.reset();
View Full Code Here

    myRecorder.collect(0f);
    myRecorder.collect(.005f);
    myRecorder.collect(.01f);
    myRecorder.collect(.015f);
   
    TimeSeries ts = myRecorder.getData();
    assertEquals(2, ts.getValues().length);   
  }
View Full Code Here

  public void testRetention() throws SimulationException {
    myRecorder.connect(new MockProbeable(1f), "x", true);
    myRecorder.collect(1);
    myRecorder.collect(2);
   
    TimeSeries ts = myRecorder.getData();
    assertEquals(2, ts.getValues().length);

    myRecorder.connect(new MockProbeable(1f), "x", false);
    myRecorder.collect(1);
    myRecorder.collect(2);
   
    ts = myRecorder.getData();
    assertEquals(1, ts.getValues().length);
  }
View Full Code Here

   * @param name Matlab variable name
   * @param data Data to be stored in Matlab variable
   * @param tau Time constant of filter to apply to data
   */
  public void add(String name, TimeSeries data, float tau) {
    TimeSeries filtered = Plotter.filter(data, tau);
    add(name+"_time", new float[][]{filtered.getTimes()});
    add(name+"_data", filtered.getValues());
  }
View Full Code Here

   * @param tauFilter Time constant of display filter (s)
   * @param title Plot title
   */
  public static void plot(TimeSeries ideal, TimeSeries actual, float tauFilter, String title) {
    //ideal = filter(ideal, tauFilter);
    final TimeSeries filtActual = filter(actual, tauFilter);
    getInstance().doPlot(ideal, filtActual, title);
  }
View Full Code Here

   * @param file File to which to export the TimeSeries
   * @param tau Time constant with which to filter data
   * @throws IOException if there's a problem writing to disk
   */
  public void export(TimeSeries series, File file, float tau) throws IOException {
    TimeSeries filtered = Plotter.filter(series, tau);

    float[][] values = MU.transpose(filtered.getValues());
    float[][] timesAndValues = new float[values.length + 1][];
    timesAndValues[0] = filtered.getTimes();
    System.arraycopy(values, 0, timesAndValues, 1, values.length);

    export(MU.transpose(timesAndValues), file);
  }
View Full Code Here

      long startTime = System.currentTimeMillis();
      simulator.run(0f, 1f, .0002f);
      System.out.println("Run time: " + ((System.currentTimeMillis() - startTime)/1000f) );
   
      TimeSeries integratorData = integratorRecorder.getData();
      integratorData.getLabels()[0] = "decoded output";
     
      Plotter.plot(inputRecorder.getData(), "Input");
      Plotter.plot(integratorData, .005f, "Integrator");
      Plotter.plot(neuronRecorder.getData(), "Neuron #0");
     
View Full Code Here

    };
   
    TimeSeries1D s1 = new TimeSeries1DImpl(times, v1, Units.UNK);   
    Plotter.plot(s1, "test1");
   
    TimeSeries s3 = new TimeSeriesImpl(times, v3, new Units[]{Units.UNK, Units.UNK, Units.UNK});
    Plotter.plot(s3, "test2");
  }
View Full Code Here

    impulse[input] = pulseHeight;
   
    float[] zero = new float[system.getInputDimension()];
    Units[] units = new Units[system.getInputDimension()];   
   
    TimeSeries pulse = integrator.integrate(system,
        new TimeSeriesImpl(new float[]{0f, pulseWidth}, new float[][]{impulse, impulse}, units));
    integral = integrate(pulse);   
   
    float decayTime = -10f / (float) eigRange[1];   
    TimeSeries decay = integrator.integrate(system,
        new TimeSeriesImpl(new float[]{0f, decayTime}, new float[][]{zero, zero}, units)); //time-invariant, so we can start at 0
    float[] increment = integrate(decay);
    integral = MU.sum(integral, increment);
 
    float stepTime = -.5f / (float) eigRange[1];
View Full Code Here

TOP

Related Classes of ca.nengo.util.TimeSeries

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.