diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 2d06b8dbfe76a3534d077caa73e3143cd00ca4ce..06b3bf046be4c20cfa8b4f602516cb042f4139bd 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -2018,6 +2018,38 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.gdat_params.time_out = []; end + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + case {'nel'} + % line-averaged density + sources_avail = {'fir','fit'}; + if ~isfield(gdat_data.gdat_params,'source') || isempty(gdat_data.gdat_params.source) + gdat_data.gdat_params.source = 'fir'; + end + gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source); + if ~any(strmatch(gdat_data.gdat_params.source,sources_avail,'exact')) + error([gdat_data.gdat_params.source ' not defined, sources_avail = ' sources_avail]); + end + switch gdat_data.gdat_params.source + case 'fit' + psitbx01=psitbxtcv(gdat_data.shot,'01',psitbx_str); + neft = gdat_tcv(gdat_data.shot,'ne_rho','fit',1); + gdat_data.t = neft.fit.t; + gdat_data.dim{1} = gdat_data.t; + gdat_data.dimunits{1} = 's'; + gdat_data.units = 'particles/m^3'; + nel.dim{1} = neft.fit.t'; + nel.data = ones(size(nel.dim{1})); + gdat_data.r_center_chord = 0.903; + [ratio,fir_times,z_lineint]=fir_ratio_from_fits(neft.fit.data,neft.fit.x,psitbx01,nel,gdat_data.r_center_chord,gdat_data.t',1,1e3); + gdat_data.data = reshape(1./ratio./z_lineint,numel(ratio),1); + gdat_data.data_fullpath = ['line-averaged density from fit using ' neft.fit.data_fullpath]; + otherwise + gdat_data.gdat_params.data_request = '\results::fir:n_average'; + gdat_data = gdat_tcv(gdat_data.shot,gdat_data.gdat_params); + ab_index = gdat_tcv(gdat_data.shot,'\diagz::fir_array:center_chord'); + ab_r = gdat_tcv(gdat_data.shot,'\diagz::fir_array:radii'); + gdat_data.r_center_chord = ab_r.data(ab_index.data+1); + end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case {'ne_rho', 'te_rho', 'nete_rho'} % if nete_rho, do first ne, then Te later (so fir stuff already done) diff --git a/matlab/TCV/tcv_help_parameters.m b/matlab/TCV/tcv_help_parameters.m index e25c436b995eca28ba62f9cfeac9083bd55dc22e..2c6c74c0b91bc015c0558a43e33af1c0f98ec3c0 100644 --- a/matlab/TCV/tcv_help_parameters.m +++ b/matlab/TCV/tcv_help_parameters.m @@ -48,7 +48,8 @@ help_struct_all.source = sprintf('%s\n','cxrs: [1 2 3] (default systems);', ... 'rtc: defined, all, adcs', ... 'transp: source provides the netcdf file', ... 'icds: ''ec'', ''nbi'' ', ... - 'ids_names for request ''ids'' like magnetics, equilibrium, etc'); + 'ids_names: for request ''ids'' like magnetics, equilibrium, etc', ... + 'nel: ''fir'' (default) or ''fit'' to compute nel from fit'); help_struct_all.source_ec = sprintf('%s\n','toray (for toray nodes), no other source for eccd yet implemented'); help_struct_all.source_nbi = sprintf('%s\n','nbi_output_matfilename containing out structure, to be added astra nodes'); help_struct_all.error_bar = sprintf('%s\n','for ids: choice of nodes fill in and how:', ... diff --git a/matlab/TCV/tcv_requests_mapping.m b/matlab/TCV/tcv_requests_mapping.m index c850da916bb7644c2a82331d1a2cd93a89929959..80f32a3c9b82bfa499564a5e52ab6a866fc81686 100644 --- a/matlab/TCV/tcv_requests_mapping.m +++ b/matlab/TCV/tcv_requests_mapping.m @@ -228,7 +228,7 @@ switch lower(data_request) case 'nel' mapping.timedim = 1; mapping.label = 'line-averaged el. density'; - mapping.method = 'tdi'; + mapping.method = 'switchcase'; mapping.expression = '\results::fir:n_average'; case 'ne_rho' mapping.timedim = 2; diff --git a/matlab/gdat_plot.m b/matlab/gdat_plot.m index 464fd6c8ae14e3036e5dbd0499a22fc0bdc2a2c4..ada21523ed84691a1932bfc4781528fc6e1ea375 100644 --- a/matlab/gdat_plot.m +++ b/matlab/gdat_plot.m @@ -84,7 +84,7 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty( return end if ~isfield(gdat_data,'shot'); return; end % allows to plot if just .t and .data exist - if strcmp(get(gcf,'nextplot'),'add') + if doplot < 0 title([gdat_data.gdat_params.machine]); else title([gdat_data.gdat_params.machine ' #' num2str(gdat_data.shot)]);