00001 #define _GNU_SOURCE
00002 #include <math.h>
00003 #include <stdio.h>
00004 #include "pga.h"
00005 #include "currents.h"
00006
00007 double all_spike_fit(double modl_data[], int length)
00008 {
00009 FILE *spike_file_ptr;
00010 double exp_data[MAX_SPIKES];
00011 int count;
00012 double difference;
00013 int i, j, done;
00014
00015 if (length < 2 )
00016 {
00017 fprintf(stderr, "too few spikes %i\n", length);
00018 return -INFINITY;
00019 }
00020 else
00021 {
00022
00023
00024
00025
00026
00027 spike_file_ptr = fopen("model_spike_times_random.txt", "r");
00028
00029 count = 0;
00030 while((fscanf(spike_file_ptr, "%lf", &exp_data[count]) == 1) && (count < MAX_SPIKES))
00031 count++;
00032 fclose(spike_file_ptr);
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 return spike_replace_fit(modl_data, length, exp_data, count);
00051 }
00052 }
00053