test_iaf_psc_exp.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // #include "debug.hpp"
  2. #include "simloop.hpp"
  3. #include "vconnection.hpp"
  4. #include "layer.hpp"
  5. #include "layer/iaf_psc_exp.h"
  6. #include "layerfactory.hpp"
  7. #include <sys/stat.h>
  8. #include <fstream>
  9. #include <iostream>
  10. #include <stdlib.h>
  11. using namespace std;
  12. int main(int argc, char** argv)
  13. {
  14. cout << "Hallo world!!" << endl;
  15. cout << "argc=" << argc << endl;
  16. float start = 100;
  17. float stop = 110;
  18. float current = 2.0;
  19. if (argc>=2)
  20. start = atof(argv[1]);
  21. if (argc>=3)
  22. stop = atof(argv[2]);
  23. if (argc>=4)
  24. current = atof(argv[3]);
  25. layer* MyLayer = createLayer(1, NMType_iaf_psc_exp, NPType_Excitatory);
  26. MyLayer->SetName("MyLayer");
  27. // MyLayer->SetupPositions(InputNx, InputNy, true);
  28. float* ExInput = MyLayer->GetInputPointer(csimInputChannel_Membrane);
  29. std::fstream f("output.txt", ios_base::out);
  30. float dt = MyLayer->GetDeltaT();
  31. int i_start = floor(start/dt);
  32. int i_stop = floor(stop/dt);
  33. iaf_psc_exp* MyNestLayer = dynamic_cast<iaf_psc_exp*>(MyLayer);
  34. for (int i=0; i<900;++i)
  35. {
  36. if (i >= i_start && i < i_stop) {
  37. ExInput[0] += current;
  38. }
  39. MyLayer->proceede(i);
  40. f << MyNestLayer->pS_[0].V_m_ << "\n";
  41. }
  42. f.close();
  43. return 0;
  44. }