diff --git a/crpptbx/TCV/loadTCVdata.m b/crpptbx/TCV/loadTCVdata.m index 43ed4a747f8dc20fe23ca46a3c9d4414740ad01c..96517c1daeaf7ed339782120ae4b9068f9fb9bd1 100644 --- a/crpptbx/TCV/loadTCVdata.m +++ b/crpptbx/TCV/loadTCVdata.m @@ -38,6 +38,7 @@ % 'vtorfit'= Toroidal rotation of C fitted profile on (rho,t) % 'vpol'= Poloidal rotation of C raw profile on (rho,t). ADD error bars in .std, as well as time and rho error bars % 'vpolfit'= Poloidal rotation of C fitted profile on (rho,t) +% 'Ti' (or Tc), 'Tifit', 'ni' (or nC), 'nifit', 'zeffcxrs', 'zeffcxrsfit': similar to 'vtor' from CXRS % 'ece' = electron cyclotron emission % 'sxr' = soft x-ray emission % 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{4}!) @@ -208,16 +209,34 @@ if ~isempty(strmatch(data_type_eff_noext,[{'Vloop'} {'Vsurf'} {'vsurf'}],'exact' data_type_eff_noext='vloop'; end if ~isempty(strmatch(data_type_eff_noext,[{'vtor'} {'v_tor'} {'vi'} {'vc'} {'v_i'} {'v_c'} {'VTOR'} {'V_TOR'} {'VI'} {'VC'} {'V_I'} {'V_C'}],'exact')) - data_type_eff_noext='vtor'; + data_type_eff_noext='vi_tor'; end if ~isempty(strmatch(data_type_eff_noext,[{'vtorfit'} {'vtorft'} {'v_torfit'} {'vifit'} {'vcfit'} {'v_ifit'} {'v_cfit'} {'VTORfit'} {'V_TORfit'} {'VIfit'} {'VCfit'} {'V_Ifit'} {'V_Cfit'}],'exact')) - data_type_eff_noext='vtorfit'; + data_type_eff_noext='vi_torfit'; end if ~isempty(strmatch(data_type_eff_noext,[{'vpol'} {'v_pol'} {'VPOL'} {'V_POL'}],'exact')) - data_type_eff_noext='vpol'; + data_type_eff_noext='vi_pol'; end if ~isempty(strmatch(data_type_eff_noext,[{'vpolfit'} {'vpolft'} {'v_polfit'} {'VPOLfit'} {'V_POLfit'}],'exact')) - data_type_eff_noext='vpolfit'; + data_type_eff_noext='vi_polfit'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Ti'} {'ti'} {'TC'} {'tc'} {'T_C'} {'t_c'}],'exact')) + data_type_eff_noext='Ti'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Tifit'} {'tifit'} {'TCfit'} {'tcfit'} {'T_Cfit'} {'t_cfit'}],'exact')) + data_type_eff_noext='Tifit'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Ni'} {'ni'} {'NC'} {'nc'} {'N_C'} {'n_c'}],'exact')) + data_type_eff_noext='ni'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Nifit'} {'nifit'} {'NCfit'} {'ncfit'} {'N_Cfit'} {'n_cfit'}],'exact')) + data_type_eff_noext='nifit'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Zeffcxrs'} {'zeffcxrs'} {'Z_effcxrs'} {'z_effcxrs'} {'Zeff_cxrs'} {'zeff_cxrs'} {'Z_eff_cxrs'} {'z_eff_cxrs'}],'exact')) + data_type_eff_noext='zeffcxrs'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Zeffcxrsfit'} {'zeffcxrsfit'} {'Z_effcxrsfit'} {'z_effcxrsfit'} {'Zeff_cxrsfit'} {'zeff_cxrsfit'} {'Z_eff_cxrsfit'} {'z_eff_cxrsfit'}],'exact')) + data_type_eff_noext='zeffcxrsfit'; end % some defaults @@ -243,14 +262,14 @@ liuqeFBTE=[{'\results::i_p'} {'\results::z_axis'} {'\results::r_axis'} {'\result % keywords which do not have FBTE equivalence and are returned empty noFBTE=[{'ne'} {'te'} {'nerho'} {'terho'} {'ne_edge'} {'te_edge'} {'nerho_edge'} {'terho_edge'} {'nerhozshift'} {'terhozshift'} {'profnerho'} {'profterho'} ... {'neft'} {'neft:trial'} {'teft:trial'} {'neftav:trial'} {'teftav:trial'} {'sxr'} {'sxR'} {'ece'} {'MPX'} {'IOH'} {'vloop'} {'neint'} ... - {'vtor'} {'vtorfit'} {'vpol'} {'vpolfit'}]; + {'vi_tor'} {'vi_torfit'} {'vi_pol'} {'vi_polfit'} {'Ti'} {'Tifit'} {'ni'} {'nifit'} {'zeffcxrs'} {'zeffcxrsfit'}]; % all keywords and corresponding case to run below TCVkeywrdall=[{'Ip'} {'B0'} {'zmag'} {'rmag'} {'rcont'} {'zcont'} {'vol'} {'rhovol'} {'qrho'} {'q95'} {'kappa'} ... {'delta'} {'deltatop'} {'deltabot'} {'neint'} ... {'ne'} {'te'} {'nerho'} {'terho'} {'ne_edge'} {'te_edge'} {'nerho_edge'} {'terho_edge'} {'nerhozshift'} {'terhozshift'} {'profnerho'} {'profterho'} ... {'neft'} {'teft'} {'neftav'} {'teftav'} {'neft:trial'} {'teft:trial'} {'neftav:trial'} {'teftav:trial'} ... - {'sxr'} {'sxR'} {'ece'} {'MPX'} {'IOH'} {'vloop'} {'pgyro'} {'jtor'} {'vtor'} {'vtorfit'} {'vpol'} {'vpolfit'}]; + {'sxr'} {'sxR'} {'ece'} {'MPX'} {'IOH'} {'vloop'} {'pgyro'} {'jtor'} {'vi_tor'} {'vi_torfit'} {'vi_pol'} {'vi_polfit'} {'Ti'} {'Tifit'} {'ni'} {'nifit'} {'zeffcxrs'} {'zeffcxrsfit'}]; TCVsig.iip=strmatch('Ip',TCVkeywrdall,'exact'); TCVsig.iB0=strmatch('B0',TCVkeywrdall,'exact'); TCVsig.izmag=strmatch('zmag',TCVkeywrdall,'exact'); @@ -294,10 +313,16 @@ TCVsig.iIOH=strmatch('IOH',TCVkeywrdall,'exact'); TCVsig.ivloop=strmatch('vloop',TCVkeywrdall,'exact'); TCVsig.ipgyro=strmatch('pgyro',TCVkeywrdall,'exact'); TCVsig.ijtor=strmatch('jtor',TCVkeywrdall,'exact'); -TCVsig.ivtor=strmatch('vtor',TCVkeywrdall,'exact'); -TCVsig.ivtorfit=strmatch('vtorfit',TCVkeywrdall,'exact'); -TCVsig.ivpol=strmatch('vpol',TCVkeywrdall,'exact'); -TCVsig.ivpolfit=strmatch('vpolfit',TCVkeywrdall,'exact'); +TCVsig.ivi_tor=strmatch('vi_tor',TCVkeywrdall,'exact'); +TCVsig.ivi_torfit=strmatch('vi_torfit',TCVkeywrdall,'exact'); +TCVsig.ivi_pol=strmatch('vi_pol',TCVkeywrdall,'exact'); +TCVsig.ivi_polfit=strmatch('vi_polfit',TCVkeywrdall,'exact'); +TCVsig.iTi=strmatch('Ti',TCVkeywrdall,'exact'); +TCVsig.iTifit=strmatch('Tifit',TCVkeywrdall,'exact'); +TCVsig.ini=strmatch('ni',TCVkeywrdall,'exact'); +TCVsig.inifit=strmatch('nifit',TCVkeywrdall,'exact'); +TCVsig.izeffcxrs=strmatch('zeffcxrs',TCVkeywrdall,'exact'); +TCVsig.izeffcxrsfit=strmatch('zeffcxrsfit',TCVkeywrdall,'exact'); % For each keyword, specify which case to use. As most common is 'simpletdi', fill in with this and change % only indices needed. Usually use name of case same as keyword name @@ -331,10 +356,16 @@ TCVkeywrdcase(TCVsig.iIOH)=TCVkeywrdall(TCVsig.iIOH); TCVkeywrdcase(TCVsig.ivloop)=TCVkeywrdall(TCVsig.ivloop); TCVkeywrdcase(TCVsig.ipgyro)=TCVkeywrdall(TCVsig.ipgyro); TCVkeywrdcase(TCVsig.ijtor)=TCVkeywrdall(TCVsig.ijtor); -TCVkeywrdcase(TCVsig.ivtor)=TCVkeywrdall(TCVsig.ivtor); -TCVkeywrdcase(TCVsig.ivtorfit)=TCVkeywrdall(TCVsig.ivtorfit); -TCVkeywrdcase(TCVsig.ivpol)=TCVkeywrdall(TCVsig.ivpol); -TCVkeywrdcase(TCVsig.ivpolfit)=TCVkeywrdall(TCVsig.ivpolfit); +TCVkeywrdcase(TCVsig.ivi_tor)=TCVkeywrdall(TCVsig.ivi_tor); +TCVkeywrdcase(TCVsig.ivi_torfit)=TCVkeywrdall(TCVsig.ivi_torfit); +TCVkeywrdcase(TCVsig.ivi_pol)=TCVkeywrdall(TCVsig.ivi_pol); +TCVkeywrdcase(TCVsig.ivi_polfit)=TCVkeywrdall(TCVsig.ivi_polfit); +TCVkeywrdcase(TCVsig.iTi)=TCVkeywrdall(TCVsig.iTi); +TCVkeywrdcase(TCVsig.iTifit)=TCVkeywrdall(TCVsig.iTifit); +TCVkeywrdcase(TCVsig.ini)=TCVkeywrdall(TCVsig.ini); +TCVkeywrdcase(TCVsig.inifit)=TCVkeywrdall(TCVsig.inifit); +TCVkeywrdcase(TCVsig.izeffcxrs)=TCVkeywrdall(TCVsig.izeffcxrs); +TCVkeywrdcase(TCVsig.izeffcxrsfit)=TCVkeywrdall(TCVsig.izeffcxrsfit); % 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 @@ -1207,60 +1238,26 @@ switch TCVkeywrdcase{index} error=0; %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - case {'vtor'} - mdsopen(shot); - nodenameeff=[{'\results::cxrs:vi_tor'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.data=tracetdi.data; - trace.x=tracetdi.dim{1}; - trace.t=tracetdi.dim{2}; - trace.dim=tracetdi.dim; - trace.dimunits=tracetdi.dimunits; - % isfield does not work since tracetdi is not a 'struct' but a tdi object, thus isfield using isa does not work - if any(strcmp(fieldnames(tracetdi),'units')) - trace.units=tracetdi.units; + case {'vi_tor', 'vi_torfit', 'vi_pol', 'vi_polfit', 'Ti', 'Tifit', 'ni', 'nifit', 'zeffcxrs', 'zeffcxrsfit'} + proffit = ''; + kwd_eff = TCVkeywrdcase{index}; + ii=strfind(kwd_eff,'fit'); + if ~isempty(ii); + proffit = ':proffit'; + kwd_eff = kwd_eff(1:ii-1); end - trace.name=[num2str(shot) ';' nodenameeff]; - % add error bars - nodenameeff=[{'\results::cxrs:vi_tor:err'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.std = tracetdi.data; - trace.std_rho = tracetdi.dim{1}; - trace.std_t = tracetdi.dim{2}; - mdsclose; - error=0; - - %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - case {'vtorfit'} + if strcmp(kwd_eff,'zeffcxrs'); kwd_eff = 'zeff'; end mdsopen(shot); - nodenameeff=[{'\results::cxrs:proffit:vi_tor'} endstr]; - tracetdi=tdi(nodenameeff{:}); + eval(['nodenameeff=''\results::cxrs' proffit ':' kwd_eff endstr ''';']); + tracetdi=tdi(nodenameeff); trace.data=tracetdi.data; - trace.x=tracetdi.dim{1}; - trace.t=tracetdi.dim{2}; - trace.dim=tracetdi.dim; - trace.dimunits=tracetdi.dimunits; - % isfield does not work since tracetdi is not a 'struct' but a tdi object, thus isfield using isa does not work - if any(strcmp(fieldnames(tracetdi),'units')) - trace.units=tracetdi.units; + if length(tracetdi.dim)>1; + trace.x=tracetdi.dim{1}; + trace.t=tracetdi.dim{2}; + else + trace.x=[]; + trace.t=[]; end - trace.name=[num2str(shot) ';' nodenameeff]; - % add error bars - nodenameeff=[{'\results::cxrs:proffit:vi_tor:err'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.std = tracetdi.data; - trace.std_rho = tracetdi.dim{1}; - trace.std_t = tracetdi.dim{2}; - mdsclose; - error=0; - - case {'vpol'} - mdsopen(shot); - nodenameeff=[{'\results::cxrs:vi_pol'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.data=tracetdi.data; - trace.x=tracetdi.dim{1}; - trace.t=tracetdi.dim{2}; trace.dim=tracetdi.dim; trace.dimunits=tracetdi.dimunits; % isfield does not work since tracetdi is not a 'struct' but a tdi object, thus isfield using isa does not work @@ -1269,35 +1266,17 @@ switch TCVkeywrdcase{index} end trace.name=[num2str(shot) ';' nodenameeff]; % add error bars - nodenameeff=[{'\results::cxrs:vi_pol:err'} endstr]; + eval(['nodenameeff=''\results::cxrs' proffit ':' kwd_eff ':err' endstr ''';']); + nodenameeff=[{'\results::cxrs:vi_tor:err'} endstr]; tracetdi=tdi(nodenameeff{:}); trace.std = tracetdi.data; - trace.std_rho = tracetdi.dim{1}; - trace.std_t = tracetdi.dim{2}; - mdsclose; - error=0; - - %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& - case {'vpolfit'} - mdsopen(shot); - nodenameeff=[{'\results::cxrs:proffit:vi_pol'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.data=tracetdi.data; - trace.x=tracetdi.dim{1}; - trace.t=tracetdi.dim{2}; - trace.dim=tracetdi.dim; - trace.dimunits=tracetdi.dimunits; - % isfield does not work since tracetdi is not a 'struct' but a tdi object, thus isfield using isa does not work - if any(strcmp(fieldnames(tracetdi),'units')) - trace.units=tracetdi.units; + if length(tracetdi.dim)>2; + trace.std_rho = tracetdi.dim{1}; + trace.std_t = tracetdi.dim{2}; + else + trace.std_rho = []; + trace.std_t = []; end - trace.name=[num2str(shot) ';' nodenameeff]; - % add error bars - nodenameeff=[{'\results::cxrs:proffit:vi_pol:err'} endstr]; - tracetdi=tdi(nodenameeff{:}); - trace.std = tracetdi.data; - trace.std_rho = tracetdi.dim{1}; - trace.std_t = tracetdi.dim{2}; mdsclose; error=0; diff --git a/crpptbx/gdat.m b/crpptbx/gdat.m index e0cee02e54154e548625f15d9c28837305cb5846..597e04cb169912690330683036cba86a232c228d 100644 --- a/crpptbx/gdat.m +++ b/crpptbx/gdat.m @@ -43,6 +43,7 @@ function [trace,error,varargout] = gdat(shot,data_type,varargin) % 'vtorfit' = fitted toroidal rotation profiles (and error bars) % 'vpol' = poloidal rotation, raw data and arror bars % 'vpolfit' = fitted poloidal rotation profiles (and error bars) +% 'Ti' (or Tc), 'Tifit', 'ni' (or nC), 'nifit', 'zeffcxrs', 'zeffcxrsfit': similar to 'vtor' from CXRS % % JET % Special case compatible with old gdat.m allows (JET related): gdat(51994,'ppf','efit/xip',1)