Exemple #1
0
/* starts the parsing of  pattern files as called in parse_squirm_conf
   creates a pattern_file, which includes a list of all patterns in conf_filename */
struct pattern_file *create_pattern_list (char *conf_filename)
{
    struct pattern_file *tmp;

    tmp = (struct pattern_file *)malloc(sizeof(struct pattern_file));
    if (tmp == NULL) {
        logprint(LOG_ERROR, "unable to allocate memory in create_pattern_list()\n");
        dodo_mode = 1;
        return NULL;
    }

    tmp->head = NULL;
    tmp->filename = safe_strdup(conf_filename);
    if (tmp->filename == NULL) {
        logprint(LOG_ERROR, "unable to allocate memory in create_pattern_list()\n");
        dodo_mode = 1;
        free(tmp);
        return NULL;
    }
    tmp->next = NULL;

    if (load_patterns(&(tmp->head), conf_filename) == -1) {
        return NULL;
    }

    return tmp;
}
Exemple #2
0
void StimulusGroup::init(string filename, StimulusGroupModeType stimulusmode, string outputfile, AurynFloat baserate)
{
	sys->register_spiking_group(this);
	ttl = new AurynTime [get_rank_size()];
	activity = new AurynFloat [get_rank_size()];
	set_baserate(baserate);
	poisson_gen.seed(162346*communicator->rank());
	

	mean_off_period = 1.0 ;
	mean_on_period = 0.2 ;
	stimulus_order = stimulusmode ;

	stimulus_active = false ;
	set_all( 0.0 ); 

	scale = 2.0;
	randomintervals = true;

	binary_patterns = false;

	if ( !outputfile.empty() ) 
	{
		tiserfile.open(outputfile.c_str(),ios::out);
		if (!tiserfile) {
		  stringstream oss;
		  oss << "StimulusGroup:: Can't open output file " << filename;
		  logger->msg(oss.str(),ERROR);
		  exit(1);
		}
		tiserfile.setf(ios::fixed);
		// tiserfile.precision(5); 
	}

	stringstream oss;
	oss << "StimulusGroup:: In mode " << stimulus_order;
	logger->msg(oss.str(),NOTIFICATION);

	cur_stim_index = 0;
	next_action_time = 0;
	active = true;
	off_pattern = -1;

	load_patterns(filename);
}
Exemple #3
0
int cli_main(int argc, char* argv[])
{
  const char* server_name = 0;
  const char* env;

  msg_debug_init();
  encr_start();
  prep_sender();
  service = argv[0];
  if (argc > 1
      && argv[1][0] != '-'
      && argv[1][0] != '+') {
    server_name = argv[1];
    ++argv;
    --argc;
  }
  if (argc > 1)
    load_patterns(argv + 1);

  if (server_name == 0
      && (server_name = getenv("SERVER")) == 0)
    die1(1, "Server address not named on command line nor in $SERVER");
  if (!resolve_ipv4name(server_name, &ip))
    die3(1, "Could not resolve '", server_name, "'");

  brandom_init();
  if ((env = getenv("KEYDIR")) != 0)
    keydir = env;
  load_keys(server_name);

  if ((env = getenv("PORT")) != 0)
    port = strtoul(env, 0, 10);
  if (port == 0)
    port = 11014;
  if ((sock = socket_udp()) == -1)
    die1sys(1, "Could not create UDP socket");
  if (!socket_connect4(sock, &ip, port))
    die1sys(1, "Could not bind socket");
  if (!str_ready(&packet, 65535)
      || !str_ready(&rpacket, 4+4+8+256*5))
    die1(1, "Out of memory");

  getenvu("ACK_TIMEOUT", &ack_timeout);
  getenvu("CID_TIMEOUT", &cid_timeout);
  getenvu("RETRANSMITS", &retransmits);
  getenvu("READWAIT", &readwait);
  getenvu("STARTLINES", &startlines);
  if (getenv("EXITONEOF") != 0)
    exitoneof = 1;

  if (getenv("NOFILES") == 0 && getenv("NOFILE") == 0)
    buffer = buffer_file_init();
  else
    buffer = buffer_nofile_init();

  sig_all_catch(sigfn);
  exitasap = 0;

  mainloop();
  return 0;
}
Exemple #4
0
PatternMonitor::PatternMonitor(SpikingGroup * source, string filename, string patfile, NeuronID maximum_patterns, AurynFloat binsize) : Monitor(filename)
{
	init(source,filename,maximum_patterns,binsize);
	load_patterns(patfile);
}