Package ca.nengo.util.impl

Examples of ca.nengo.util.impl.TimeSeries1DImpl


      }
      result = new TimeSeriesImpl(new float[]{myTime},
          new float[][]{jointCoordinates}, Units.uniform(Units.M, definition.length));
    } else if (stateName.matches("p\\d+")) {
      int coord = Integer.parseInt(stateName.substring(1));
      result = new TimeSeries1DImpl(new float[]{myTime}, new float[]{myDynamics.getState()[coord]}, Units.UNK);
    } else {
      throw new SimulationException("The state " + stateName + " is unknown");
    }

    return result;
View Full Code Here


   * @see ca.nengo.model.Node#run(float, float)
   */
  public void run(float startTime, float endTime) throws SimulationException {
    myTermination.run(startTime, endTime);
    myActivationHistory = myTermination.getOutput();
    myLengthHistory = new TimeSeries1DImpl(new float[]{startTime}, new float[]{myLength}, Units.M);

    float[][] activation = myActivationHistory.getValues();
    float[][] input = new float[activation.length][];
//    for (float[] element : input) {
//
View Full Code Here

    public TimeSeries getHistory(String stateName) throws SimulationException {
      if (!stateName.equals("x")) {
        throw new SimulationException("No such state");
      }
     
      return new TimeSeries1DImpl(new float[myConstantValues.length], myConstantValues, Units.UNK);
    }
View Full Code Here

        for (int i = 0; i < x.length; i++) {
            x[i] = i*dx;
            y[i] = f.map(new float[]{x[i]});
        }

        TimeSeries1D approx = new TimeSeries1DImpl(x, y, Units.UNK);
        TimeSeries1D actual = new TimeSeries1DImpl(examplex, exampley, Units.UNK);
        Plotter.plot(approx, actual, "polynomial");
    }
View Full Code Here

   */
  public TimeSeries getHistory(String stateName) throws SimulationException {
    TimeSeries1D result = null;

    if (stateName.equals("V")) {
      result = new TimeSeries1DImpl(myTime, myVoltageHistory, Units.AVU);
    } else {
      throw new SimulationException("The state name " + stateName + " is unknown.");
    }

    return result;
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();
   
    float[] times = new float[]{0f, 1f};
    float[] values = new float[]{1.1f, 2.1f};   
    myTimeSeries = new TimeSeries1DImpl(times, values, Units.UNK);
  }
View Full Code Here

    assertEquals(Units.UNK, myTimeSeries.getUnits1D());
  }
 
  public void testConstructor() {
    try {
      new TimeSeries1DImpl(new float[]{0f}, new float[]{0f, 1f}, Units.UNK);
      fail("Should have thrown exception because of unequal times and values length");
    } catch (IllegalArgumentException e) {} //exception is expected
  }
View Full Code Here

    public TimeSeries getHistory(String stateName) throws SimulationException {
      if (!stateName.equals("x")) {
        throw new SimulationException("No such state");
      }
     
      return new TimeSeries1DImpl(new float[]{0}, new float[]{myConstantValue}, Units.UNK);
    }
View Full Code Here

    if (dim < 0 || dim >= series.getDimension()) {
      throw new IllegalArgumentException("Dimension " + dim
          + " is out of range; should be between 0 and " + (series.getDimension()-1));
    }
   
    return new TimeSeries1DImpl(series.getTimes(), MU.transpose(series.getValues())[dim], series.getUnits()[dim]);
  }
View Full Code Here

      new float[]{3f, 4f, 5f},
      new float[]{2f, 3f, 4f},
      new float[]{1f, 2f, 3f}     
    };
   
    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

TOP

Related Classes of ca.nengo.util.impl.TimeSeries1DImpl

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.