Main Page | Data Structures | File List | Data Fields | Globals

/home/kevin/Documents/PYLikeC/all_spike_fit.c

Go to the documentation of this file.
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 //      spike_file_ptr = fopen("250_upt_all_spikes.txt", "r");
00024         
00025 //      spike_file_ptr = fopen("model_spike_times.txt", "r");
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 /*      i = 0;
00034         j = 0;
00035         done = 0;
00036         difference = 0;
00037         while (done == 0)
00038           {
00039              difference += fabs(modl_data[i] - exp_data[j]);
00040              if (i + 1 < length)
00041                i++;
00042              if (j + 1 < count)
00043                j++;
00044              if ((i + 1 >= length) && (j + 1 >= count))
00045                done = 1;
00046           }
00047         return -difference * abs(length - count);
00048  */
00049         /* return matrix_fit(modl_data, length, exp_data, count); */
00050         return spike_replace_fit(modl_data, length, exp_data, count);
00051      }
00052 }
00053 

Generated on Thu Mar 3 11:45:32 2005 for spga by  doxygen 1.3.9.1