FUNCTION monte_carlo_wien_t_fun, file_path, r_in_file, r_in_vari_file, b_out_file, $ b_out_vari_file, n_t_funs, seed ; Generates a monte carlo set of simplest transfer functions, then uses a signal to ; noise estimate from the set to generate a Wiener transfer function and return ; the aveage Wiener transfer function. ; ; Author: Robert Kessel ; Electro-Optics Technology Section ; Code 8123 ; Naval Research Laboratory ; Washington, D.C. 20375-5354 ; email: kessel@ncst.nrl.navy.mil ; ; This code was written for Bill Palya's and Don Walter's ; use at JSU. However, anyone else who finds it useful ; should feel free to use it, rewrite it, or whatever else, ; save charging any money, goods or services from any other ; person for the code or use thereof. ; 10/22/03 ; get data n_head = 0 n_sessions = 20 ndata = 256 times = 2000.*FINDGEN(ndata)/256. r_in = read_blk_ave_4_data_1024_v2(file_path, r_in_file, n_head) r_in_vari = read_blk_ave_4_data_1024_v2(file_path, r_in_vari_file, n_head) b_out = read_blk_ave_4_data_1024_v2(file_path, b_out_file, n_head) b_out_vari = read_blk_ave_4_data_1024_v2(file_path, b_out_vari_file, n_head) ; make reinforcement and response monte carlo ensembles r_in_monte_carlo = FLTARR(ndata, n_t_funs) FOR j=0,n_t_funs-1 DO BEGIN r_in_monte_carlo_temp = gen_monte_carlo_256(r_in, SQRT(r_in_vari/FLOAT(n_sessions)), seed) FOR i=0,255 DO r_in_monte_carlo[i,j] = r_in_monte_carlo_temp[i] ENDFOR ; b_out_monte_carlo = FLTARR(ndata, n_t_funs) FOR j=0,n_t_funs-1 DO BEGIN b_out_monte_carlo_temp = gen_monte_carlo_256(b_out, SQRT(b_out_vari/FLOAT(n_sessions)), seed) FOR i=0,255 DO b_out_monte_carlo[i,j] = b_out_monte_carlo_temp[i] ENDFOR ; generate the simplest transfer functions t_fun_monte_carlo = COMPLEXARR(ndata, n_t_funs) FOR j=0,n_t_funs-1 DO BEGIN t_fun_monte_carlo_temp = simple_t_fun(r_in_monte_carlo[*,j], b_out_monte_carlo[*,j]) FOR i=0,255 DO t_fun_monte_carlo[i,j] = t_fun_monte_carlo_temp[i] ENDFOR ; get average and signal to noise, then generate wiener tranfer function set and average init_ave_t_fun = ave_t_fun(t_fun_monte_carlo, n_t_funs, ndata, trial) snr = ABS(init_ave_t_fun[*,0])/ABS(init_ave_t_fun[*,1]) wiener_t_funs = COMPLEXARR(ndata, n_t_funs) alpha = 1. FOR j=0,n_t_funs-1 DO BEGIN wiener_t_funs_temp = wiener_t_fun(r_in_monte_carlo[*,j], b_out_monte_carlo[*,j], snr, alpha) FOR i=0,255 DO wiener_t_funs[i,j] = wiener_t_funs_temp[i] ENDFOR t_fun_monte_carlo_wien = ave_t_fun(wiener_t_funs, n_t_funs, ndata, trial) RETURN, t_fun_monte_carlo_wien[*,0] END