0001 function [flag,EC_out] = load_EC_tsbase_yp(shotnum,certif,shotime,tmin,tmax,basestr);
0002
0003
0004
0005
0006
0007
0008 method = 'spline';
0009 flag = 1;
0010
0011 if strcmp(basestr,'TS'),
0012
0013 shotnum = str2num(shotnum) + certif/10;
0014
0015
0016
0017 [xika1,tbad] = tsbase(shotnum,'sika1');
0018 [xHAUTTOR,tHAUTTOR] = tsbase(shotnum,'SHAUTTOR');
0019 if ~isempty(xika1) & ~isempty(xHAUTTOR)
0020 [prxA1,tA1] = tsbase(shotnum,'spia1');
0021 [prxA2,tA2] = tsbase(shotnum,'spia2');
0022 [sonde,tsonde] = tsbase(shotnum,'sonderf');
0023 [xHAUTPOL,tHAUTPOL] = tsbase(shotnum,'SHAUTPOL');
0024 [xMILTOR,tMILTOR] = tsbase(shotnum,'SMILTOR');
0025 [xMILPOL,tMILPOL] = tsbase(shotnum,'SMILPOL');
0026
0027
0028
0029 factA1 = 1;
0030 factA2 = 1;
0031 PA1 = max(0,1e6*prxA1/factA1);
0032 PA2 = max(0,1e6*prxA2/factA2);
0033 Ptot = PA1 + PA2;
0034
0035
0036
0037 EC_out.RA2 = 3.5300;
0038 EC_out.RA1 = 3.5300;
0039 EC_out.ZA2 = 0;
0040 EC_out.ZA1 = 0.2000;
0041
0042
0043
0044 PA1_tmin = interp_tprof_time_fxdrg(tA1,PA1,tmin,method);
0045 PA1_tmax = interp_tprof_time_fxdrg(tA1,PA1,tmax,method);
0046 dt_PA1 = [tmin;tA1(find((tA1 > tmin).*(tA1 < tmax)));tmax];
0047 EC_out.PA1 = mean([PA1_tmin;PA1(find((tA1 > tmin).*(tA1 < tmax)),:);PA1_tmax]);
0048
0049 phiA1_tmin = interp_tprof_time_fxdrg(tHAUTTOR,xHAUTTOR,tmin,method);
0050 phiA1_tmax = interp_tprof_time_fxdrg(tHAUTTOR,xHAUTTOR,tmax,method);
0051 dt_phiA1 = [tmin;tHAUTTOR(find((tHAUTTOR > tmin).*(tHAUTTOR < tmax)));tmax];
0052 EC_out.phiA1 = mean([phiA1_tmin;xHAUTTOR(find((tHAUTTOR > tmin).*(tHAUTTOR < tmax)),:);phiA1_tmax]);
0053
0054 thetaA1_tmin = interp_tprof_time_fxdrg(tHAUTPOL,xHAUTPOL,tmin,method);
0055 thetaA1_tmax = interp_tprof_time_fxdrg(tHAUTPOL,xHAUTPOL,tmax,method);
0056 dt_thetaA1 = [tmin;tHAUTPOL(find((tHAUTPOL > tmin).*(tHAUTPOL < tmax)));tmax];
0057 EC_out.thetaA1 = mean([thetaA1_tmin;xHAUTPOL(find((tHAUTPOL > tmin).*(tHAUTPOL < tmax)),:);thetaA1_tmax]);
0058
0059 PA2_tmin = interp_tprof_time_fxdrg(tA2,PA2,tmin,method);
0060 PA2_tmax = interp_tprof_time_fxdrg(tA2,PA2,tmax,method);
0061 dt_PA2 = [tmin;tA2(find((tA2 > tmin).*(tA2 < tmax)));tmax];
0062 EC_out.PA2 = mean([PA2_tmin;PA2(find((tA2 > tmin).*(tA2 < tmax)),:);PA2_tmax]);
0063
0064 phiA2_tmin = interp_tprof_time_fxdrg(tMILTOR,xMILTOR,tmin,method);
0065 phiA2_tmax = interp_tprof_time_fxdrg(tMILTOR,xMILTOR,tmax,method);
0066 dt_phiA2 = [tmin;tMILTOR(find((tMILTOR > tmin).*(tMILTOR < tmax)));tmax];
0067 EC_out.phiA2 = mean([phiA2_tmin;xMILTOR(find((tMILTOR > tmin).*(tMILTOR < tmax)),:);phiA2_tmax]);
0068
0069 thetaA2_tmin = interp_tprof_time_fxdrg(tMILPOL,xMILPOL,tmin,method);
0070 thetaA2_tmax = interp_tprof_time_fxdrg(tMILPOL,xMILPOL,tmax,method);
0071 dt_thetaA2 = [tmin;tMILPOL(find((tMILPOL > tmin).*(tMILPOL < tmax)));tmax];
0072 EC_out.thetaA2 = mean([thetaA2_tmin;xMILPOL(find((tMILPOL > tmin).*(tMILPOL < tmax)),:);thetaA2_tmax]);
0073 else
0074 EC_out.RA2 = 3.5300;
0075 EC_out.RA1 = 3.5300;
0076 EC_out.ZA2 = 0;
0077 EC_out.ZA1 = 0.2000;
0078 EC_out.PA1 = '';
0079 EC_out.phiA1 = '';
0080 EC_out.thetaA1 = '';
0081 EC_out.PA2 = '';
0082 EC_out.phiA2 = '';
0083 EC_out.thetaA2 = '';
0084 flag = 0;
0085 end
0086 else
0087 disp('Not yet implemented for this machine.')
0088 return
0089 end
0090