comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » SOS with Idl
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
SOS with Idl [message #55477] Tue, 21 August 2007 08:54
anaisgcristal@gmail.c is currently offline  anaisgcristal@gmail.c
Messages: 3
Registered: August 2007
Junior Member
Hi, I just learnig programming with Idl, and I've been trying to
modifided a file to print a array 4X27 (matriz), but I can't print
this array in a file! I suposse the problems it's some definition or
something similar, but I didn't found it. It's posible that someone
can check the code and help me to found the bug?
Thanks a lot

Quote:
pro p
fname = "/home/iquique/anais/Codigos/Gadget/resultados/w_066/
powerspec_004.txt"
openr, 1, fname


Time = 0.0
Bins = 0L
readf, 1, Time
readf, 1, Bins
da1= fltarr(10, bins)
readf, 1, da1
readf, 1, Time
readf, 1, Bins
da2= fltarr(10, bins)
matriz = fltarr(2, 27)
readf, 1, da2
close,1


K_A = da1(0,*)
Delta2_A = da1(1,*)
Shot_A = da1(2,*)
ModePow_A = da1(3,*)
ModeCount_A = da1(4,*)
Delta2Uncorrected_A = da1(5,*)
ModePowUncorrected_A = da1(6,*)
Specshape_A = da1(7,*)
SumPower_A = da1(8,*)
ConvFac_A = da1(9,*)

K_B = da2(0,*)
Delta2_B = da2(1,*)
Shot_B = da2(2,*)
ModePow_B = da2(3,*)
ModeCount_B = da2(4,*)
Delta2Uncorrected_B = da2(5,*)
ModePowUncorrected_B = da2(6,*)
Specshape_B = da2(7,*)
SumPower_B = da2(8,*)
ConvFac_B = da2(9,*)


; we will do a band averaging of the finely binned points,
; subject to two conditions:
; We want enough modes per bin in order to reduce the variance in a
bin,
; and simultaneously, for large k, we don't want the bins become too
narrow.
;
; The first condition is set by "MinModeCount",
; the second by "TargetBinNummer", which is used to compute a minimum
; logarithmic bin-size.


MinModeCount = 20
TargetBinNummer = 60

MinDlogK = (alog10(max(K_A)) - alog10(min(K_A)))/TargetbinNummer


istart=0
ind=[istart]
k_list_A = [0]
Delta2_list_A = [0]
count_list_A = [0]
for j = 0, 27-1 do begin
repeat begin
count = total(modecount_a(ind))
deltak = (alog10(max(K_A(ind))) - alog10(min(K_A(ind))))

if (deltak ge mindlogk) and (count ge MinModeCount) then begin
d2 = total(SumPower_A(ind))/total(ModeCount_A(ind))
b = fix(total(double(ind)*ModeCount_A(ind))/total(ModeCount_A(in d)))
kk = K_A(b)
d2 = ConvFac_A(b)*d2*Specshape_A(b)
k_list_A = [k_list_A, kk]
Delta2_list_A = [Delta2_list_A, d2]
count_list_A = [count_list_A, total(ModeCount_A(ind))]
istart = istart + 1
ind = [istart]
endif else begin
istart = istart + 1
ind = [ind, istart]
endelse
endrep until istart ge Bins
K_list_A = k_list_A(1:*)
Delta2_list_A = delta2_list_A(1:*)
Count_list_A = count_list_A(1:*)
[b]matriz(0, j) = Delta2_list_A
matriz(1,j) = Delta2_list_B
end
openw, 5, 'mypk.dat'
for j= 0, 27 -1 do begin
printf, 5, matriz(*, j)
print, matriz(*, j)
end
close, 5
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Tuesday Morning Musings
Next Topic: seg fault with simple tv or tvrd()

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:51:23 PDT 2025

Total time taken to generate the page: 0.00464 seconds