Frequency Sweep Utilities
Dave Typinski, AJ4CO Observatory
March, 2014

EZNEC TFD Pattern Generator - converts EZNEC freq sweep file into a more compact CSV file

(********************************************************************************************)
(*                                                                                          *)
(*  User configuration section                                                              *)
(*                                                                                          *)
(*                                                                                          *)
(********************************************************************************************)

Print["Processing started "<>DateString[]]

(* Set directory for input -- contains one or more .sig Gage signal files *)
filebase="N:\\Documents\\0 RA\\Hardware\\Antennas\\TFD\\Beam Steering\\EZNEC Beam Shape\\TFD FF in Plane of Wires (0 degs model AZ) 10 to 40 MHz.txt";

test=Import[filebase,"Table"];

Dimensions[test];
test//MatrixForm;

(* data pitch 1811 records *)
test[[8,3]];
test[[14,1]];
test[[14,4]];

test[[1819,3]];
test[[1825,1]];
test[[1825,4]];

outdata=Table[0.,{e,0,901},{f,0,301}];

(* write frequency column headers *)
Do[
outdata[[1,f]]=10+0.1*(f-2);
,{f,2,302}
];

(* write elevation angle row headers *)
Do[
outdata[[e,1]]=0.1*(e-2);
,{e,2,902}
];

Do[ {

Do[ {

outdata[[elev+2,f+2]]=test[[(f*1811)+14+elev,4]];

},{elev,0.,900.}
];

},{f,0.,300.}
];

(* reverse row order in data portion of array to convert elevation to off-axis angle *)
outdata[[2;;902,2;;302]]=Reverse[outdata[[2;;902,2;;302]]];

Export["N:\\Documents\\0 RA\\Hardware\\Antennas\\TFD\\Beam Steering\\EZNEC Beam Shape\\TFD FF in Plane of Wires (0 degs model AZ) 10 to 40 MHz Off Axis Angle.csv",outdata,"csv"]

Print["Processing ended "<>DateString[]]