#include <math.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include "ipc.h"
#include "cmdparam.h"
#include "lissom.h"
#include "kernel.h"
#include "globals.h"
#include "vgen.h"
#include "tilt.h"
#include "ppm_draw.h"
#include "fit_gauss.h"
#include "file_io.h"
#include "analyze.h"
Include dependency graph for analyze.c:

Go to the source code of this file.
Compounds | |
| struct | cmdobj_analyze_bubblewidth |
| struct | cmdobj_connection_statistics |
| struct | cmdobj_copy_network |
| struct | cmdobj_find_bubblewidth |
| struct | cmdobj_kurtosis_contrast |
| struct | cmdobj_measure_od_pref |
| struct | cmdobj_measure_or_pref |
| struct | cmdobj_OD_features |
| struct | cmdobj_OR_features |
| struct | cmdobj_orientation_contrast |
| struct | cmdobj_plot_od_pref |
| struct | cmdobj_plot_or_pref |
| struct | cmdobj_restore_network |
| struct | cmdobj_SP_features |
| struct | cmdobj_spatial_contrast |
| struct | cmdobj_visualize |
| struct | Map_Feature |
Defines | |
| #define | SAVE_OR_PPM_ONLY |
| If defined don't create filebase.iter.or or filebase.iter.sp files, just .ppm. More... | |
| #define | SAVE_WTS_PPM_ONLY |
| If defined don't create maple or mathematica weights plots, just .ppm. More... | |
| #define | MAPLE 1 |
| #define | MATH 2 |
| #define | OR_INPUT_RESPONSE 0 |
| #define | OR_GAUSSFIT 1 |
| #define | OR_MAX_METHOD 1 |
| #define | NMAP_FEATURES 50 |
| #define | NSELECTIVITIES 10 |
| #define | NUM_BUBBLE_AREAS 2 |
| Defined as 2, for within bubble radius and outside. More... | |
| #define | ORF_MIN 0 |
| #define | ORF_MAX 1 |
| #define | NUM_OR_FEATURE_TYPES 2 |
| #define | GAUSSIAN_LEN 7.0 |
| Length of measuring stimulus. More... | |
| #define | GAUSSIAN_WIDTH 1.5 |
| Width of the measuring stimulus. More... | |
| #define | ACTIVE_RN (RN-2*retina_edge_buffer) |
| The formula used in ACTIVE_RN is due to Joseph Sirosh; its derivation is unknown but it appears to scale the frequency to a range that has a reasonable chance at stimulating a neuron, giving the size allowed for receptive fields. More... | |
| #define | NUMBER_TO_FREQ(freqnumber) ((double)(2*rf_radius+1)/(double)ACTIVE_RN * sp_min_frequency * M_PI/(double)ACTIVE_RN * (double)(sp_num_frequencies/(double)(freqnumber))) |
| #define | NUMBER_TO_PHASE(phasenumber) ((((double)(phasenumber))/sp_num_phases ) * 2.0 * M_PI) |
| #define | PHASE_TO_NUMBER(phase) ((int)((phase)*sp_num_phases/(2.0*M_PI))) |
| #define | TRUNCATE_EXAMPLES_TO_SPACE_AVAIL(ui,uj,uk,ul,examples) |
Functions | |
| cmdstat | cmd_analyze_bubblewidth ( int argc, const char *argv[] ) |
| Only define this if absolutely necessary, since it will take a lot of extra memory. More... | |
| cmdstat | cmd_connection_statistics ( int argc, const char *argv[] ) |
| cmdstat | cmd_copy_network ( int argc, const char *argv[] ) |
| cmdstat | cmd_find_bubblewidth ( int argc, const char *argv[] ) |
| Sets the iterations between which to find widths. More... | |
| cmdstat | cmd_kurtosis_contrast ( int argc, const char *argv[] ) |
| cmdstat | cmd_measure_od_pref ( int argc, const char *argv[] ) |
| Currently supports measuring the entire cortex only, but can plot a smaller portion. More... | |
| cmdstat | cmd_measure_or_pref ( int argc, const char *argv[] ) |
| cmdstat | cmd_OD_features ( int argc, const char *argv[] ) |
| This function dumps the weights of the significant features in the orientation map, such as regions of lowest and highest OD values. More... | |
| cmdstat | cmd_OR_features ( int argc, const char *argv[] ) |
| cmdstat | cmd_orientation_contrast ( int argc, const char *argv[] ) |
| Measure the change in neural response with contrast for input activity and settled activity. More... | |
| cmdstat | cmd_plot_od_pref ( int argc, const char *argv[] ) |
| cmdstat | cmd_plot_or_pref ( int argc, const char *argv[] ) |
| cmdstat | cmd_restore_network ( int argc, const char *argv[] ) |
| cmdstat | cmd_SP_features ( int argc, const char *argv[] ) |
| cmdstat | cmd_spatial_contrast ( int argc, const char *argv[] ) |
| cmdstat | cmd_visualize ( int argc, const char *argv[] ) |
| void | compute_mexhat (int i, int j) |
| Compute Mexican hat for neuron (i,j). More... | |
| void | find_max (double *max_or_select, double *max_od, int low_index, int high_index) |
| Find maximum selectivity and ocular dominance in the given region of the network. More... | |
| int | find_OD_maxmin (int *nexamples, int low, int high) |
| int | find_OR_maxmin (int *nexamples, int low, int high) |
| Determines regions of highest and lowest orientation selectivity. More... | |
| void | find_peak_aff_wts (int low,int high) |
| int | find_sp_maxmin (int *nexamples, int low, int high) |
| double | gauss_2d (double x, double y, double r, double theta, double cx, double cy, double sigmax, double sigmay) |
| void | gaussfit_preferences (Neuron nmap[NMAX][NMAX], int low, int high) |
| void | graph_histo (int sel, double or_division) |
| void | graph_od (int ui, int uj, int output_routine) |
| void | graph_wts (int ui, int uj, int output_routine) |
| void | input_response (Neuron nmap[NMAX][NMAX], double response[MAX_NUM_EYES][NROWS][NMAX], int eye, int input_eye, int low, int high, double peak_scale) |
| Compute response to data in the given input_eye for the weights of the given eye. More... | |
| void | input_response_ij (Neuron nmap[NMAX][NMAX], double response[MAX_NUM_EYES][NMAX][NMAX], int eye, int ui, int uj) |
| Compute response to data in retina 0 for the given eye. More... | |
| void | kurtosis (double map_act[NMAX][NMAX], double *input_v, int lowk, int lowl, int highk, int highl, double *kurt_act, double *kurt_inp) |
| Routines for calculating Kurtosis of activity in a 1D array. More... | |
| void | maple (FILE *fp, l_weight *weights, int radius, int ui, int uj, const char *title, const char *zaxis) |
| void | mathematica (FILE *fp, l_weight *weights, int radius, int ui, int uj) |
| void | measure_rf (int ui, int uj) |
| Routine to measure the dynamic receptive field. More... | |
| void | moment (double *data, int n, double sum, double *ave, double *adev, double *sdev, double *svar, double *curt) |
| moment() from 'Numerical Recipes in C', slightly modified. More... | |
| void | or_preferences (Neuron nmap[NMAX][NMAX], int low, int high) |
| OR Pref is estimated for each eye using sinusoidal gratings of different phases and frequencies and orientations. More... | |
| void | or_selectivity (int low, int high) |
| Orientation selectivity is determined using previously saved maximum responses. More... | |
| void | oriented_rfinput (double angle, double sigmax, double sigmay, int c_1, int c_2, double scale) |
| void | plot_afferent_wts (int output_routine, FILE *fp, int ui, int uj, char *title, const char *zaxis) |
| void | save_ascii_or_pref_file (void) |
| void | sine_grating_input (int eye, double freq, double phase, double angle) |
| Draws a sine wave grating in the retina of the given eye. More... | |
| void | analyze_init_hook ( void ) |
| void | od_preferences (double pref[NMAX][NMAX], Neuron nmap[NMAX][NMAX]) |
| Calculate ocular dominance preference. More... | |
Variables | |
| int | save_images_from_measure_or_pref = 0 |
| int | or_pref_method = Uninitialized |
| double | sp_min_frequency = 10 |
| int | sp_num_frequencies = Uninitialized |
| int | sp_num_phases = Uninitialized |
| int | sp_random_phases = False |
| int | end_dynamic = MAXITERATION |
| Iteration to stop calculating drfs. More... | |
| double | final_bubblewidth = 0.0 |
| The average final bubble width. More... | |
| double | gaussfit_array [RNMAX][RNMAX] |
| The weight values. More... | |
| double | gaussian [RNMAX][RNMAX] |
| The return values. More... | |
| double | init_bubblewidth = 0.0 |
| The average initial bubble width. More... | |
| int | lesion_radius |
| Radius of retinal lesion. More... | |
| double | max_resp [EYE_ARRAY_SIZE][NROWS][NMAX] |
| double | max_resp_angle [EYE_ARRAY_SIZE][NROWS][NMAX][MAX_NUM_ANGLES] |
| double | od_pref [NMAX][NMAX] |
| Array of od preferences. More... | |
| int | od_dumped = Uninitialized |
| Last iteration at which OD was dumped. More... | |
| int | or_dumped = Uninitialized |
| Last iteration at which OR was dumped. More... | |
| Map_Feature | or_features [NUM_OR_FEATURE_TYPES][NMAP_FEATURES] |
| double | or_select [EYE_ARRAY_SIZE][NMAX][NMAX] |
| int | or_pref [EYE_ARRAY_SIZE][NMAX][NMAX] |
| A value from 0 to 1. More... | |
| Histo | OR_histo [NSELECTIVITIES][NUM_BUBBLE_AREAS][MAX_NUM_ANGLES][MAX_NUM_ANGLES] |
| FILE* | peakfile |
| double | peak_aff_wt [MAX_NUM_EYES][NROWS][NMAX] |
| Peak afferent weight. More... | |
| double | rf_threshold = 0.0 |
| activity thresh, for inclusion in drf. More... | |
| int | rf_i = 0 |
| int | rf_j = 0 |
| Neuron whose rf is to be visualized. More... | |
| int | sp_freq [EYE_ARRAY_SIZE][NMAX][NMAX] |
| Spatial frequencies, as integers. More... | |
| int | sp_phase [EYE_ARRAY_SIZE][NMAX][NMAX] |
| int | start_dynamic = MAXITERATION |
| Iteration to start calculating drfs. More... | |
| Wts | temp_wts |
| int | ui_dynamic |
| Unit on which to measure dynamic rfs. More... | |
| int | uj_dynamic |
| int | width_analysis_end = MAXITERATION |
| Iterations between which to analyze. More... | |
| int | width_analysis_start = MAXITERATION |
| activity bubble widths. More... | |
Definition in file analyze.c.
|
|
The formula used in ACTIVE_RN is due to Joseph Sirosh; its derivation is unknown but it appears to scale the frequency to a range that has a reasonable chance at stimulating a neuron, giving the size allowed for receptive fields. The parameter sp_min_frequency was originally hardcoded to 1.5, but when the number of frequencies is low, it's better to be able to set this value explicitly. Assording to Joseph's comments, the minimum freq is Pi/2RN, and the maximum is PI/2RN*sp_num_frequencies. That doesn't seem to match the formula, though. 981002 James A. Bednar |
|
|
Length of measuring stimulus.
|
|
|
Width of the measuring stimulus.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Defined as 2, for within bubble radius and outside.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If defined don't create filebase.iter.or or filebase.iter.sp files, just .ppm.
|
|
|
If defined don't create maple or mathematica weights plots, just .ppm.
|
|
|
Initializer: \
{ \
const int max_examples = MIN( (uk-ui+1)*(ul-uj+1), NMAP_FEATURES ); \
if (examples > max_examples) { \
ipc_notify(IPC_ALL,IPC_CAUTION,"Not enough neurons in region (%d,%d) to (%d,%d) to find %d examples; will look for at most %d", ui,uj,uk,ul,*nexamples,max_examples); \
examples = max_examples; \
} \
} |
|
|
|
|
|
This function dumps the weights of the significant features in the orientation map, such as regions of lowest and highest OD values.
|
|
|
|
|
|
|
|
|
Only define this if absolutely necessary, since it will take a lot of extra memory.
|
|
|
|
|
|
|
|
|
Sets the iterations between which to find widths.
|
|
|
|
|
|
Currently supports measuring the entire cortex only, but can plot a smaller portion.
|
|
|
|
|
|
Measure the change in neural response with contrast for input activity and settled activity. Use gaussians of various widths. Subtract gaussians from mean. Multiply receptive field with half the peak wt subtracted with the gaussian to get the input response. Multiply the input response with various values and get the map response after lateral interaction. Store the response of this neuron for all these values of contrast. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compute Mexican hat for neuron (i,j). The exc and inh wts have already been scaled by gammaexc*5 and gammainh*5. The hat is returned in the inh wts. |
|
|
|
|
|
Determines regions of highest and lowest orientation selectivity.
|
|
|
Find maximum selectivity and ocular dominance in the given region of the network. Must be called only after or_select and od_pref have been collected from each PE. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compute response to data in the given input_eye for the weights of the given eye.
|
|
|
Compute response to data in retina 0 for the given eye.
|
|
|
Routines for calculating Kurtosis of activity in a 1D array. 1. Kurtosis is evaluated for data points in a 1D array of double. 2. I have a simple interface function for evaluating activity in a part of the 2D map_activity array, and for the input_vector. |
|
|
|
|
|
|
|
|
Routine to measure the dynamic receptive field. The optimal orientation for the neuron is determined from the orientation preferences array. Gaussian training inputs are presented at all locations of the cell's receptive field at this optimal orientation. The response at each location after lateral interaction is saved as the cells' dynamic RF. In the display routine, this response is plotted by a color code. |
|
|
moment() from 'Numerical Recipes in C', slightly modified.
Definition at line 994 of file analyze.c. Referenced by kurtosis(). |
|
|
Calculate ocular dominance preference. pref is a value from 0 to 1, 1 being a complete preference for the left eye (index 0) relative to the right eye(s). This is presumably meaningful only with two eyes; with one eye it should always be 1.0, and with more a preference should be calculated for each of the eyes, not just the left one. |
|
|
OR Pref is estimated for each eye using sinusoidal gratings of different phases and frequencies and orientations. For each cell, for each spatial frequency, for each spatial phase, for each orientation, the response is computed and compared with current maximum. The spatial frequency, phase, and orientation for which the cell responds best is saved as its preference. These parameters are estimated separately for each eye, so that any disparity selectivity can be detected immediately. Originally, Joseph had input_response subtract half the peak weight from the afferent weights before multiplying by the sinusoid, but that is either a very bad idea or had a very bad bug, since it results in a tiled pattern of the retina being displayed all across the network, one for every retinal input unit. Without that it works fine. To calculate orientation selectivity, the maximum response for each angle at any spatial freq and phase are also saved. |
|
|
Orientation selectivity is determined using previously saved maximum responses. For orientations of 0..PI of the preferred grating, the input response is determined, and a vector sum of the responses V_sum is calculated. The OR selectivity is then the ratio |V_sum|/or_num_angles to the mean length of the or_num_angles vectors. |
|
|
|
|
|
|
|
|
|
|
|
Draws a sine wave grating in the retina of the given eye. Every processor calculates the same sine input. |
|
|
|
|
|
Iteration to stop calculating drfs.
|
|
|
The average final bubble width.
|
|
|
The weight values.
|
|
|
The return values.
|
|
|
The average initial bubble width.
|
|
|
Radius of retinal lesion.
|
|
|
|
|
|
|
|
|
Last iteration at which OD was dumped.
|
|
|
Array of od preferences.
|
|
|
Last iteration at which OR was dumped.
|
|
|
|
|
|
A value from 0 to 1.
|
|
|
|
|
|
|
|
|
Peak afferent weight.
|
|
|
|
|
|
|
|
|
Neuron whose rf is to be visualized.
|
|
|
activity thresh, for inclusion in drf.
|
|
|
|
|
|
Spatial frequencies, as integers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Iteration to start calculating drfs.
|
|
|
|
|
|
Unit on which to measure dynamic rfs.
|
|
|
|
|
|
Iterations between which to analyze.
|
|
|
activity bubble widths.
|
1.2.1 written by Dimitri van Heesch,
© 1997-2000