24 void error(
char *errorstring, ...)
28 va_start(ap, errorstring);
29 fprintf(stderr,
"Error: ");
30 vfprintf(stderr, errorstring, ap);
31 fprintf(stderr,
"\n");
45 fprintf(stderr,
"Usage: %s [options] <input_file> \n\n", program);
47 "Reads an input parameter/data file <input_file> with parameters and \n" 48 "RTI data from a layered environment (3 layers: SR, SP, and SO of the \n" 49 "CA1 region of the hippocampus) and fits alpha, theta, and kappa of SP.\n" 50 "The input filename extension can be anything, but don't use \".dat\".\n" 51 "The output file has the same name as the input file but with the \n" 52 "extension \".dat\".\n\n" 54 fprintf(stderr,
"Options:\n" 55 "\t-h, --help print usage message\n" 56 "\t-v, --verbose be verbose\n" 57 "\t-g, --global_kappa use the same kappa in all layers (= kappa_sp)\n" 58 "\t--nr <nr> specify nr\n" 59 "\t--nz <nz> specify nz\n" 60 "\t--nt <nt> specify nt\n" 61 "\t--nt_scale <factor> specify scale factor for nt\n" 62 "\t--ez1 <ez1> specify z-position of bottom of cylinder (<0)\n" 63 "\t--ez2 <ez2> specify z-position of top of cylinder (>0)\n" 64 "\t--alpha_so <alpha_so> specify alpha_so\n" 65 "\t--alpha_sp <alpha_sp> specify initial alpha_sp\n" 66 "\t--alpha_sr <alpha_sr> specify alpha_sr\n" 67 "\t--theta_so <theta_so> specify theta_so\n" 68 "\t--theta_sp <theta_sp> specify initial theta_sp\n" 69 "\t--theta_sr <theta_sr> specify theta_sr\n" 70 "\t--kappa_so <kappa_so> specify kappa_so\n" 71 "\t--kappa_sp <kappa_sp> specify initial kappa_sp\n" 72 "\t--kappa_sr <kappa_sr> specify kappa_sr\n" 73 "\t--kappa_outside <k_out> specify kappa_outside (mutually excl. with -g)\n" 74 "\t--alpha_step <a_step> specify initial step in alpha_sp direction\n" 75 "\t--theta_step <t_step> specify initial step in theta_sp direction\n" 76 "\t--kappa_step <k_step> specify initial step in kappa_sp direction\n" 77 "\t--minalpha <minalpha> specify minimum value of alpha_sp\n" 78 "\t--maxalpha <maxalpha> specify maximum value of alpha_sp\n" 79 "\t--mintheta <mintheta> specify minimum value of theta_sp\n" 80 "\t--maxtheta <maxtheta> specify maximum value of theta_sp\n" 81 "\t--minkappa <minkappa> specify minimum value of kappa_sp\n" 82 "\t--maxkappa <maxkappa> specify maximum value of kappa_sp\n" 83 "\t--tmax <tmax> specify total duration of experiment\n" 84 "\t--fit_tol <fit_tol> specify stopping criterion (simplex size)\n" 85 "\t--itermax <itermax> specify stopping criterion (max iterations)\n" 86 "\t--outfile <outfile> specify output file (parameters and curves)\n" 87 "\t--pathfile <pathfile> specify simplex path output file (just \n" 88 "\t one vertex of the simplex per iteration)\n" 107 if (strlen(in) < (FILENAME_MAX - 4))
110 error(
"Filename length is too long");
129 a = (
double *)malloc(
sizeof(
double) * N);
131 error(
"Cannot allocate memory for %s array",
string);
158 strcpy(command,argv[0]);
159 strcat(command,
" ");
160 length=strlen(argv[0]) + 1;
161 for (i=1; i<argc; i++) {
162 length += strlen(argv[i]) + 1;
164 printf(
"Warning: length of command too long to put in struct \n");
165 strcat(command,
"...");
168 strcat(command, argv[i]);
169 strcat(command,
" ");