/* ufh script to pad traces based on the PrRcNm and PrTrNm, Scott Michell. August 21, 2000 - Original version Run by: edit script to change ntr in Begin part of script ufh [ufhscript] < [input] | utop -rnum -O [output] getval -N [output] -ne 1 -T RecNum | wc -l to get the number of records when done. of course this can be put into a script to do automatically Odd Things: the padded trace has a negative PrRcNm and PrTrNm the padded trace has StaCorr set to 30000 the padded trace has the other headers set to the last trace you must know the number of traces per record that you want and put into the ufh script under ntr in the Begin section The padded trace (or record) is put in the proper place assuming PrRcNm and PrTrNm increments by one. If it doesn't the script will need to be hacked. You may get bad things if the increment is not 1 If the PrRcNm and PrTrNm are zero the trace is not passed. If one is zero it will be passed, but be ware This script has worked one time. It is not tested so it may do unexpected things to the next data set Needed Mods: Put the PrRcNm and PrTrNm increments in the Begin part of the script I do copy the trace in several places that I don't really need to. This is for clarity of the code (at least it seems that way at the time!!!). This may reduce speed, so if speed is a factor then I may rewrite to avid this. Careful - loops use one of the traces while the header of the otherone is modified */ func Begin(){ ntr = 1280; /* desierd number of traces/record */ flag = 0; /* start flag for record and trace 1 */ trct = 1; /* trace counter */ } func OnLineHeader(){ lastrec = LH.NumRec; LH.NumRec = 9999; LH.NumTrc = ntr; nsamp= LH.NumSmp - 1; output(LH); } func OnTrace() { if((Tr.PrRcNm != 0) && (Tr.PrTrNm !=0)) /* if both are zero the trace is not passed */ { if ( flag == 0 ) /* if flag == 0 then it is the first trace. Set variables up */ { trct = Tr.PrTrNm; rnum = Tr.PrRcNm; flag = 1; if ( Tr.PrTrNm != 1 ) /* if first trace != 1 fill in before first trace */ { Te = Tr; Tr.Series[0:nsamp] = 0.0; Tr.StaCor=30000; Tr.PrRcNm= -1; Tr.PrTrNm= -1; for(i=1;i