On Aug 12, 4:03 pm, "steve.kaeppler" <steve.kaepp...@gmail.com> wrote:
> Hi Everyone-
>
> I am still learning all sorts of new tricks in IDL, but I am running
> into some trouble with IDL. I am running version 6.4, which may be
> useful. I am getting an error in my code that says "Program code area
> full." I will say I am running a fairly beefy code with respect to a
> lot of while loops, if statements and creation of arrays to be
> printed to text documents. I am more than willing to put up the code
> if it is helpful, but for now, I just want to understand what exactly
> this means and if there is some way to basically by-pass this error?
>
> If someone could help me, I would be very grateful!
>
> Kindest Regards,
> Steve Kaeppler
Actually, I will attach the code.
The problem happens when I uncomment ;c_av = reform(c_dot_calc,[1,47])
&$ or print, c_dot_calc As soon as I do that, I get this "Program
code Area is full" I do not, for the life of me, understand why it is
doing that? Is something undefined? Is too much memory being taken
up?
Also any streamlining suggestions are always appreciated!
Thanks all!
Steve
the code:
;;; process for real mag pa
base_dir = '/data0/rocket/aces_21139/outfiles/' ;##################
user define
srk_dir = '/home/srk/aces_data/'
; this file is meant to be a fast way to get the correct files needed
to create the chi squared
.com '/home/srk/aces_data/eepaa/eepaa_read_cdf_flight.pro'
.com '/home/srk/aces_data/eepaa/plot_image_colorbar.pro'
outname = '21139_EEPAA_Electron' ;################## user define
cdf_file = srk_dir+'eepaa/'+outname+'.cdf'
data = eepaa_read_cdf_flight(cdf_file)
;help, data, /st
device, decompose=0
file1 = srk_dir+'/eepaa/spectrogram/outfiles/ref_10_20.dat' ; usr
definied
openw, lun1, file1, /get_lun
file3 = srk_dir+'/eepaa/spectrogram/outfiles/
ACES_Low_data_plot_stats.dat' ; usr definied
openw, lun2, file3, /get_lun
file2 = srk_dir+'/eepaa/spectrogram/chi_sq_results_july2009.csv'
corr_fact = read_ascii(file2,delimiter=',',data_start=2); chi squared
correction factor
help, corr_fact, /st
neg_hun = fltarr([1,47])
neg_hun[0:46] = -100.
acq_time = data.acq_time * 1.e-3 ; convert to seconds
dt_ex = data.dead_time*1.e-9
A = reform(fltarr(50), [1,50])
zero_47 = reform(fltarr(47))
zero_47[0:46] = 0
c_dot_calc = fltarr(47)
i = 0 ; selects channel of interest
j = long(0)
num_rec = data.total_num
c_dot_1 = fltarr(47)
c_dot_2 = fltarr(47)
c_dot_3 = fltarr(47)
chi_1 = fltarr(47)
chi_2 = fltarr(47)
chi_3 = fltarr(47)
tmp_av = fltarr(47)
; nom pa
;while(t lt 24) do begin &$
pa_high =45. &$
pa_low =35. &$
print, '1' &$
while(j lt num_rec) do begin &$ ; over all records
;if(max(data.time[*,*,j]) gt 250.) then begin &$
;print, where( (data.measured_pa[*,*,j] ge pa_low) and
(data.measured_pa[*,*,j] le pa_high) ) &$
q = where( (data.measured_pa[*,*,j] ge pa_low) and (data.measured_pa
[*,*,j] le pa_high) ) &$
if(q[0] eq -1) then begin &$
;print, [-1, j] &$
; this will give us the locations where we have no data values - no
hit mag hits
time_ = max(data.time[*,*,j]) &$
A = [A,reform([j,time_, 'NaN', reform(neg_hun, [47])], [1,50]) ] &$
endif else begin &$
; this is where I will need to average and all that
;print, [q, j] &$
n = n_elements(q) &$
if( n eq 1) then begin &$
;print, '1' &$
while( k lt 47 ) do begin &$
if(data.dac_sweep[0,k,j] ne 0) then begin &$
c_dot_1[k] = (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j])/(acq_time
- (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j]*dt_ex[i] ) ) &$
;c_dot_calc = reform(c_dot_calc,[47]) &$
endif else begin &$
c_dot_1[k] = -100. &$
endelse &$
k++ &$
endwhile &$
c_dot_calc = c_dot_1 &$
mean_pa = data.measured_pa[q[0],*,j] &$
endif &$
k =0 &$
if( n eq 2) then begin &$
;print, '2' &$
while( k lt 47 ) do begin &$
if(data.dac_sweep[0,k,j] ne 0) then begin &$
c_dot_1[k] = (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j])/(acq_time
- (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j]*dt_ex[q[0]] ) ) &$
c_dot_2[k] = (corr_fact.field01[q[1]]*data.eepaa1[q[1],k,j])/(acq_time
- (corr_fact.field01[q[1]]*data.eepaa1[q[1],k,j]*dt_ex[q[1]] ) ) &$
;c_dot_calc = reform(c_dot_calc,[47]) &$
endif else begin &$
c_dot_1[k] = -100. &$
c_dot_2[k] = -100. &$
endelse &$
k++ &$
endwhile &$
k =0 &$
while(k lt 47) do begin &$
;c_dot_calc[k] = 0. &$
c_dot_calc[k] = mean([c_dot_1[k],c_dot_2[k]]) &$
mean_pa = mean([data.measured_pa[q[0],*,j],data.measured_pa[q
[1],*,j] ]) &$
if(c_dot_1[k] ne 0.) then begin &$
chi_1[k] = ( (c_dot_1[k] - c_dot_calc[k])*(c_dot_1[k] - c_dot_calc
[k]) )/c_dot_1[k]&$
endif &$
if(c_dot_2[k] ne 0.) then begin&$
chi_2[k] = ( (c_dot_2[k] - c_dot_calc[k])*(c_dot_2[k] - c_dot_calc
[k]) )/c_dot_2[k] &$
endif &$
k++ &$
endwhile &$
endif &$
k =0 &$
if( n eq 3) then begin &$
;print, '3' &$
while( k lt 47 ) do begin &$
if(data.dac_sweep[0,k,j] ne 0) then begin &$
c_dot_1[k] = (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j])/(acq_time
- (corr_fact.field01[q[0]]*data.eepaa1[q[0],k,j]*dt_ex[q[0]] ) ) &$
c_dot_2[k] = (corr_fact.field01[q[1]]*data.eepaa1[q[1],k,j])/(acq_time
- (corr_fact.field01[q[1]]*data.eepaa1[q[1],k,j]*dt_ex[q[1]] ) ) &$
c_dot_3[k] = (corr_fact.field01[q[2]]*data.eepaa1[q[2],k,j])/(acq_time
- (corr_fact.field01[q[2]]*data.eepaa1[q[2],k,j]*dt_ex[q[2]] ) ) &$
;c_dot_calc = reform(c_dot_calc,[47]) &$
endif else begin &$
c_dot_1[k] = -100. &$
c_dot_2[k] = -100. &$
c_dot_3[k] = -100. &$
endelse &$
k++ &$
endwhile &$
k=0 &$
while(k lt 47) do begin &$
c_dot_calc[k] = (c_dot_1[k]+c_dot_2[k]+ c_dot_3[k])/3. &$
mean_pa = mean([data.measured_pa[q[0],*,j],data.measured_pa[q
[1],*,j],data.measured_pa[q[2],*,j] ]) &$
if(c_dot_1[k] ne 0.) then begin &$
chi_1[k] = ( (c_dot_1[k] - c_dot_calc[k])*(c_dot_1[k] - c_dot_calc
[k]) )/c_dot_1[k]&$
endif &$
if(c_dot_2[k] ne 0.) then begin&$
chi_2[k] = ( (c_dot_2[k] - c_dot_calc[k])*(c_dot_2[k] - c_dot_calc
[k]) )/c_dot_2[k] &$
endif &$
if(c_dot_3[k] ne 0.) then begin&$
chi_2[k] = ( (c_dot_3[k] - c_dot_calc[k])*(c_dot_3[k] - c_dot_calc
[k]) )/c_dot_3[k] &$
endif &$
k++ &$
endwhile &$
endif &$
k =0 &$
time_ = max(data.time[*,*,j]) &$
A = [A,reform([j,time_, mean_pa, c_dot_calc], [1,50]) ] &$
print, c_dot_calc &$
;n =0 &$
;help, c_av, /st &$
;help, c_dot_calc &$
c1 = reform(c_dot_1, [1,47]) &$
c2 = reform(c_dot_2, [1,47]) &$
c3 = reform(c_dot_3, [1,47]) &$
;c_av = reform(c_dot_calc,[1,47]) &$
endelse &$ ; close out mag pitch angle
printf, lun2, 'Record: ', j &$
printf, lun2, 'Time: ', time_ &$
printf, lun2, 'Number Channels overlap: ', n &$
printf, lun2, 'Channels Overlap: ', q &$
printf, lun2, 'C1, C2, C3, Cave, Chi_1, Chi_2, Chi_3' &$
printf, lun2, [c1, c2, c3]&$
printf, lun2,
'----------------------------------------------------------- -----' &$
; diagnostic print statments
;printf, lun1, j,time_, mean_pa, [c_dot_calc] &$;
[data.measured_energy[0,*,j], data.dac_sweep[0,*,j] ] &$;
[data.measured_pa[i,*,j],
;printf, lun1, '---------------------------------------------------' &
$
q = 0 &$
n =0 &$
c_dot_calc = zero_47 &$
c_dot_1 = zero_47 &$
c_dot_2 = zero_47 &$
c_dot_3 = zero_47 &$
chi_1 = zero_47 &$
chi_2 = zero_47 &$
chi_3 = zero_47 &$
mean_pa = 0 &$
j++ &$
endwhile &$
print, 'end 1' &$
A = A[1:*,*]
plot_time = A[*,1] &$
plot_energy = (data.cal_energy/1000.) &$
plot_cdot = A[*,3:49] &$
loadct, 39
set_plot,'ps'
device,/color,bits=8, filename = '/home/srk/aces_data/eepaa/
spectrogram/outfiles/aces_low_spectrogram_pa_test.ps'
title = 'ACES LOW(21.139) Spectrogram'+' '+ strcompress(string
(pa_low)) +' < '+'PA'+' < ' + strcompress(string(pa_high)) &$
plot_image_colorbar, plot_cdot, plot_time,
plot_energy,title=title,xrange=[100,400], xtitle='Time', ytitle='Energy
(keV)',/ylog, position=pos_img, grey_value = -100.0 &$
;print, t &$
;t++ &$
device, /close
set_plot, 'X'
free_lun, lun1
free_lun, lun2
|