diff --git a/crpptbx/AUG/loadAUGdata.m b/crpptbx/AUG/loadAUGdata.m index d7a4d91d71c0be7508e7bc82c0e36ea92e131383..fb06957a26fed94df02b3f0e72393043ce011f46 100644 --- a/crpptbx/AUG/loadAUGdata.m +++ b/crpptbx/AUG/loadAUGdata.m @@ -19,7 +19,7 @@ function [trace,error,varargout]=loadAUGdata(shot,data_type,varargin) % % examples: % data_type='SXR/B', 'TOT/beta_N', 'SXB/J_053', 'SXB' -% data_type='POT/ELMa-Han', 'MOD/OddNAmp', 'MOD/EvenNAmp', 'TOT/PNBI_TOT' +% data_type='POT/ELMa-Han', 'MOD/OddNAmp', 'MOD/EvenNAmp', 'TOT/PNBI_TOT', 'TOT/P_TOT' % % Meaning of varargin depends on data_type: % @@ -142,6 +142,12 @@ if size(data_type_eff,1)==1 if ~isempty(strmatch(data_type_eff_noext,[{'equil_FPP'}],'exact')) data_type_eff_noext='equil_fpp'; end + if ~isempty(strmatch(lower(data_type_eff_noext),[{'equil_eqm'}],'exact')) + data_type_eff_noext='equil_eqm'; + end + if ~isempty(strmatch(lower(data_type_eff_noext),[{'equil_eqr'}],'exact')) + data_type_eff_noext='equil_eqr'; + end if ~isempty(strmatch(data_type_eff_noext,[{'Rmag'}],'exact')) data_type_eff_noext='rmag'; end @@ -163,6 +169,12 @@ if size(data_type_eff,1)==1 if ~isempty(strmatch(data_type_eff_noext,[{'Ha'} {'ha'} {'Halpha'} {'halpha'}],'exact')) data_type_eff_noext='Halpha'; end + if ~isempty(strmatch(lower(data_type_eff_noext),[{'pgyro'} {'pec'} {'pech'} {'pecrh'} {'p_ec'} {'p_gyro'}],'exact')) + data_type_eff_noext='pgyro'; + end + if ~isempty(strmatch(lower(data_type_eff_noext),[{'powers'} {'ptot'} {'ptots'}],'exact')) + data_type_eff_noext='powers'; + end else i_ext=length(data_type_eff{2})+1; name_ext=''; @@ -171,9 +183,9 @@ end % all keywords and corresponding case to run below AUGkeywrdall=[{'Ip'} {'b0'} {'zmag'} {'rmag'} {'rgeo'} {'zgeo'} {'rcont'} {'zcont'} {'vol'} {'qrho'} {'qrho_fpp'} {'q0'} {'q95'} {'kappa'} ... - {'delta'} {'deltatop'} {'deltabot'} {'neint'} ... - {'ne'} {'te'} {'nerho'} {'neterho'} {'terho'} {'cxrs'} {'cxrs_rho'} {'equil'} {'equil_fpp'} ... - {'sxr'} {'sxR'} {'sxb'} {'ece'} {'eced'} {'Halpha'}]; + {'delta'} {'deltatop'} {'deltabot'} {'neint'} {'ne'} {'te'} ... + {'nerho'} {'neterho'} {'terho'} {'cxrs'} {'cxrs_rho'} {'equil'} {'equil_fpp'} {'equil_eqm'} ... + {'equil_eqr'} {'sxr'} {'sxR'} {'sxb'} {'ece'} {'eced'} {'Halpha'} {'pgyro'} {'powers'}]; AUGsig.iip=strmatch('Ip',AUGkeywrdall,'exact'); AUGsig.ib0=strmatch('b0',AUGkeywrdall,'exact'); AUGsig.izmag=strmatch('zmag',AUGkeywrdall,'exact'); @@ -187,6 +199,8 @@ AUGsig.iqrho=strmatch('qrho',AUGkeywrdall,'exact'); AUGsig.iqrho_fpp=strmatch('qrho_fpp',AUGkeywrdall,'exact'); AUGsig.iequil=strmatch('equil',AUGkeywrdall,'exact'); AUGsig.iequil_fpp=strmatch('equil_fpp',AUGkeywrdall,'exact'); +AUGsig.iequil_eqm=strmatch('equil_eqm',AUGkeywrdall,'exact'); +AUGsig.iequil_eqr=strmatch('equil_eqr',AUGkeywrdall,'exact'); AUGsig.iq0=strmatch('q0',AUGkeywrdall,'exact'); AUGsig.iq95=strmatch('q95',AUGkeywrdall,'exact'); AUGsig.ikappa=strmatch('kappa',AUGkeywrdall,'exact'); @@ -207,6 +221,8 @@ AUGsig.isxb=strmatch('sxb',AUGkeywrdall,'exact'); AUGsig.iece=strmatch('ece',AUGkeywrdall,'exact'); AUGsig.ieced=strmatch('eced',AUGkeywrdall,'exact'); AUGsig.iHalpha=strmatch('Halpha',AUGkeywrdall,'exact'); +AUGsig.ipgyro=strmatch('pgyro',AUGkeywrdall,'exact'); +AUGsig.ipowers=strmatch('powers',AUGkeywrdall,'exact'); % For each keyword, specify which case to use. As most common is 'simplereaddata', fill in with this and change % only indices needed. Usually use name of case same as keyword name @@ -216,6 +232,8 @@ AUGkeywrdcase(AUGsig.iqrho)=AUGkeywrdall(AUGsig.iqrho); % special as efit q on p AUGkeywrdcase(AUGsig.iqrho_fpp)=AUGkeywrdall(AUGsig.iqrho_fpp); % special as efit q on psi AUGkeywrdcase(AUGsig.iequil)=AUGkeywrdall(AUGsig.iequil); % special as efit q on psi AUGkeywrdcase(AUGsig.iequil_fpp)=AUGkeywrdall(AUGsig.iequil_fpp); % special as efit q on psi +AUGkeywrdcase(AUGsig.iequil_eqm)=AUGkeywrdall(AUGsig.iequil_eqm); % special as efit q on psi +AUGkeywrdcase(AUGsig.iequil_eqr)=AUGkeywrdall(AUGsig.iequil_eqr); % special as efit q on psi %AUGkeywrdcase(AUGsig.idelta)=AUGkeywrdall(AUGsig.idelta); % special as average of triu and tril AUGkeywrdcase(AUGsig.ine)=AUGkeywrdall(AUGsig.ine); % special as adds error bars AUGkeywrdcase(AUGsig.ite)=AUGkeywrdall(AUGsig.ite); % idem @@ -228,6 +246,8 @@ AUGkeywrdcase(AUGsig.isxb)=AUGkeywrdall(AUGsig.isxb); %AUGkeywrdcase(AUGsig.iece)=AUGkeywrdall(AUGsig.iece); AUGkeywrdcase(AUGsig.icxrs)=AUGkeywrdall(AUGsig.icxrs); AUGkeywrdcase(AUGsig.icxrs_rho)=AUGkeywrdall(AUGsig.icxrs_rho); +AUGkeywrdcase(AUGsig.ipgyro)=AUGkeywrdall(AUGsig.ipgyro); % idem +AUGkeywrdcase(AUGsig.ipowers)=AUGkeywrdall(AUGsig.ipowers); % idem % Information about which dimension has time, always return 2D data as (x,t) array % as most are 1D arrays with time as first index, fill in with ones and change only those needed @@ -752,12 +772,16 @@ switch AUGkeywrdcase{index} trace.dimunits{1} = a.area.name ; trace.dimunits{2} = a.time_aug.unit; - case {'equil', 'equil_fpp', 'qrho', 'qrho_fpp'} + case {'equil', 'equil_fpp', 'equil_eqm', 'equil_eqr', 'qrho', 'qrho_fpp'} shotfile_exp_eff = AUGexplocation{index}; if strcmp(AUGkeywrdcase{index},'equil_fpp') || strcmp(AUGkeywrdcase{index},'qrho_fpp') DIAG = 'FPP'; + elseif strcmp(AUGkeywrdcase{index},'equil_eqm') + DIAG = 'EQM'; + elseif strcmp(AUGkeywrdcase{index},'equil_eqr') + DIAG = 'EQR'; else DIAG = 'EQI'; end @@ -847,6 +871,167 @@ switch AUGkeywrdcase{index} trace.dimunits{1} = ''; trace.dimunits{2} = 's'; + %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + case {'pgyro'} + % LOAD MULTI CHANNEL DATA ECS + % powers, frequencies, etc + + shotfile_exp_eff = AUGexplocation{index}; + + trace.t=[]; + trace.x=[]; + ppftype='ECS'; + % pgyro tot in index=9 + [a,e]=rdaAUG_eff(shot,ppftype,'PECRH',shotfile_exp_eff); + if isempty(a) || e~=0 + trace_all = struct([]); + else + nb_timepoints = length(a.time_aug.value); + trace_all.pgyro = NaN*ones(nb_timepoints,9); + trace_all.freq_ech = NaN*ones(1,8); + trace_all.pgyro(:,9) = reshape(a.data,nb_timepoints,1); + trace_all.t = a.time_aug.value; + end + for i=1:4 + % "old" ECRH1 gyrotrons: gyro 1 to 4 in pgyro + tracename_eff = ['PG' num2str(i)]; + [a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.ecrh1(i) = a; + trace_all.pgyro(:,i) = reshape(a.data,nb_timepoints,1); + end + tracename_eff = ['f-G' num2str(i)]; + [a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.freq_ecrh1(i) = a; + trace_all.freq_ech(i) = a.data(1); + end + % "new" ECRH2 gyrotrons: gyro 5 to 8 in pgyro + tracename_eff = ['PG' num2str(i) 'N']; + [a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.ecrh2(i) = a; + trace_all.pgyro(:,i+4) = reshape(a.data,nb_timepoints,1); + end + tracename_eff = ['f-G' num2str(i) 'N']; + [a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.freq_ecrh2(i) = a; + trace_all.freq_ech(i+4) = a.data(1); + end + end + if ~isempty(trace_all) + trace_all.dim=[{trace_all.t} {[1:9]}]; + trace_all.data = trace_all.pgyro; + trace = trace_all; + trace.x=trace.dim{2}; + trace.dimunits=[{'time [s]'} {'ECRH1(1:4) ECRH2(1:4) ECtot'}]; + trace.units='W'; + trace.freq_ech_units = 'GHz'; + trace.name=[num2str(shot) '/' ppftype '/' 'PGi and PGiN']; + else + trace.data = []; + trace.dim = []; + trace.dimunits = []; + trace.x = []; + trace.t = []; + trace.units = []; + trace.freq_ech_units =[]'; + trace.name=[num2str(shot) '/' ppftype '/' 'PGi and PGiN']; + end + + %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + case {'powers'} + % load powers from TOT timebase as well + % + + shotfile_exp_eff = AUGexplocation{index}; + + trace.t=[]; + trace.x=[]; + ppftype='TOT'; + % P ohmic + [a,e]=rdaAUG_eff(shot,ppftype,'P_OH',shotfile_exp_eff); + if isempty(a) || e~=0 + trace_all = struct([]); + else + nb_timepoints = length(a.time_aug.value); + trace_all.powers = NaN*ones(nb_timepoints,5); + trace_all.powers(:,1) = reshape(a.data,nb_timepoints,1); + trace_all.power_names{1} = [ppftype '/P_OH']; + trace_all.pohmic = a; + trace_all.t = a.time_aug.value; + end + % P NBI + [a,e]=rdaAUG_eff(shot,ppftype,'PNBI_TOT',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.powers(:,2) = reshape(a.data,nb_timepoints,1); + trace_all.power_names{2} = [ppftype '/PNBI_TOT']; + trace_all.pnbi = a; + end + % P ECRH + [a,e]=rdaAUG_eff(shot,ppftype,'PECR_TOT',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.powers(:,3) = reshape(a.data,nb_timepoints,1); + trace_all.power_names{3} = [ppftype '/PECR_TOT']; + trace_all.pecrh = a; + end + % P ICRH + [a,e]=rdaAUG_eff(shot,ppftype,'PICR_TOT',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.powers(:,4) = reshape(a.data,nb_timepoints,1); + trace_all.power_names{4} = [ppftype '/PICR_TOT']; + trace_all.picrh = a; + end + trace_all.powers(:,5) = trace_all.powers(:,1) + trace_all.powers(:,2) + trace_all.powers(:,3) + trace_all.powers(:,4); + % tau_tot + [a,e]=rdaAUG_eff(shot,ppftype,'tau_tot',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.tau_tot = a; + ij=find(~isnan(trace_all.tau_tot.value)); + trace_all.tau_tot_spline=interpos(trace_all.t(ij),trace_all.tau_tot.value(ij),trace_all.t,-1e3); + trace_all.tau_tot_spline = max(trace_all.tau_tot_spline,0.); + end + % betaN + [a,e]=rdaAUG_eff(shot,ppftype,'beta_N',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.betan = a; + end + % betaNthermal + [a,e]=rdaAUG_eff(shot,ppftype,'beta_Nth',shotfile_exp_eff); + if isempty(a) || e~=0 + else + trace_all.betan_thermal = a; + end + % + if ~isempty(trace_all) + trace_all.dim=[{trace_all.t} {[1:5]}]; + trace_all.data = trace_all.powers; + trace = trace_all; + trace.x=trace.dim{2}; + trace.dimunits=[{'time [s]'} {'Pohmic Pnbi Pecrh Picrh Ptot'}]; + trace.units='W'; + trace.name=[num2str(shot) '/' ppftype '/' 'P_OH, PNBI_TOT, PECR_TOT, PICR_TOT']; + else + trace.data = []; + trace.dim = []; + trace.dimunits = []; + trace.x = []; + trace.t = []; + trace.units = []; + trace.freq_ech_units =[]'; + trace.name=[num2str(shot) '/' ppftype '/' 'P_OH, PNBI_TOT, PECR_TOT, PICR_TOT']; + end + otherwise disp('case not yet defined')