diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index a33fbad9b38106317babc7c7a2814fe3b0d44b02..2caee8958739117456197378dbec07eb883a1727 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -3343,6 +3343,16 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') num2str(time_interval(1)) ',' num2str(time_interval(2)) ']' char(10)]) end end + % at this stage 2 option for freq, raw data (fast, default), 10kHz or similar (slow) + freq_opt = 1; + if ~isfield(gdat_data.gdat_params,'freq') + gdat_data.gdat_params.freq = 'fast'; + end + if strcmp(gdat_data.gdat_params.freq,'slow'); freq_opt = 0; end + % fit_tension for smoothing on slow timescale (radcam for example) + if ~isfield(gdat_data.gdat_params,'fit_tension') || isempty(gdat_data.gdat_params.fit_tension) + gdat_data.gdat_params.fit_tension = -1e2; + end switch lower(gdat_data.gdat_params.source) case {'radcam'} gdat_data.gdat_params.source = 'radcam'; @@ -3377,7 +3387,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end else if isnumeric(gdat_data.gdat_params.channel) - gdat_data.gdat_params.channel{1} = gdat_data.gdat_params.channel; + gdat_data.gdat_params.channel = {gdat_data.gdat_params.channel}; end if numel(gdat_data.gdat_params.camera) ~= numel(gdat_data.gdat_params.channel) gdat_data.gdat_params @@ -3403,7 +3413,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') disp('***************************************************************************') gdat_data.gdat_params.camera = camera; end - if ~isequal(sort(cell2mat(channel)),sort(cell2mat(gdat_data.gdat_params.channel))) + if ~isequal(sort(cell2mat(channel)),sort(cell2mat(gdat_data.gdat_params.channel))) || ... + numel(gdat_data.gdat_params.channel) ~= numel(channel) warning(sprintf('channel nbs and channel did not match, channel chosen adapted')); gdat_data.gdat_params.channel = channel; end @@ -3417,11 +3428,21 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.x(end+1:end+numel(gdat_data.(gdat_data.gdat_params.camera{i}).x)) = gdat_data.(gdat_data.gdat_params.camera{i}).x; end sxr = rc_load_diodes(shot,'diag_name',"sxr",'channels',gdat_data.x); % since all cameras with different channel number - gdat_data.data = sxr.data(:,[sxr.channels==gdat_data.x])'; - gdat_data.t = sxr.time; - + if freq_opt == 1 + gdat_data.data = sxr.data'; + gdat_data.t = sxr.time; + else + gdat_data.t = linspace(sxr.time(1),sxr.time(end),round((sxr.time(end)-sxr.time(1))/1e-4)); + for i=1:size(sxr.data,2) + gdat_data.data(i,:) = interpos(sxr.time,sxr.data(:,i),gdat_data.t,gdat_data.gdat_params.fit_tension); + end + end gdat_data.r_x = sxr.geometry.xchord(gdat_data.x,:); gdat_data.z_x = sxr.geometry.ychord(gdat_data.x,:); + gdat_data.r_at_z0 = gdat_data.r_x(:,1) + ... + diff(gdat_data.r_x(:,:)')' .* (0-gdat_data.z_x(:,1))./(gdat_data.z_x(:,2)-gdat_data.z_x(:,1)); + gdat_data.z_at_r09 = gdat_data.z_x(:,1) + ... + diff(gdat_data.z_x(:,:)')' .* (0.9-gdat_data.r_x(:,1))./(gdat_data.r_x(:,2)-gdat_data.r_x(:,1)); gdat_data.good_channels = sxr.good_channels; gdat_data.data_fullpath = ['using rc_load_diodes(shot,''diag_name'',"sxr",...) with params in gdat_data.gdat_params']; gdat_data.units = 'au'; @@ -3430,10 +3451,12 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.label = strtrim(sprintf('radcam %s %s %s %s %s',gdat_data.gdat_params.camera{:})); for i=1:numel(gdat_data.gdat_params.camera) ij = iround_os(sxr.channels,gdat_data.(gdat_data.gdat_params.camera{i}).x); - gdat_data.(gdat_data.gdat_params.camera{i}).data = sxr.data(:,ij)'; - gdat_data.(gdat_data.gdat_params.camera{i}).t = sxr.time; + gdat_data.(gdat_data.gdat_params.camera{i}).data = gdat_data.data(:,ij)'; + gdat_data.(gdat_data.gdat_params.camera{i}).t = gdat_data.t; gdat_data.(gdat_data.gdat_params.camera{i}).r_x = sxr.geometry.xchord(gdat_data.(gdat_data.gdat_params.camera{i}).x,:); gdat_data.(gdat_data.gdat_params.camera{i}).z_x = sxr.geometry.ychord(gdat_data.(gdat_data.gdat_params.camera{i}).x,:); + gdat_data.(gdat_data.gdat_params.camera{i}).r_at_z0 = gdat_data.r_at_z0(ij); + gdat_data.(gdat_data.gdat_params.camera{i}).z_at_r09 = gdat_data.z_at_r09(ij); gdat_data.(gdat_data.gdat_params.camera{i}).good_channels = intersect(gdat_data.(gdat_data.gdat_params.camera{i}).x,sxr.good_channels); gdat_data.(gdat_data.gdat_params.camera{i}).label = sprintf('radcam %s nb chords: %d', ... gdat_data.gdat_params.camera{i},numel(gdat_data.(gdat_data.gdat_params.camera{i}).x)); @@ -3452,11 +3475,6 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end return end - freq_opt = 0; - if ~isfield(gdat_data.gdat_params,'freq') - gdat_data.gdat_params.freq = 'slow'; - end - if strcmp(gdat_data.gdat_params.freq,'fast'); freq_opt = 1; end t_int = [0 10]; % starts from 0 otherwise mpxdata gives data from t<0 if ~isempty(time_interval); t_int = time_interval; end gdat_data.top.data = []; diff --git a/matlab/TCV/tcv_help_parameters.m b/matlab/TCV/tcv_help_parameters.m index 79d5de588ab223239faa89bb88af97f6a1aac83c..15de8984169996ffdd2c5f1ea0e1b99a310aaa33 100644 --- a/matlab/TCV/tcv_help_parameters.m +++ b/matlab/TCV/tcv_help_parameters.m @@ -29,7 +29,8 @@ help_struct_all.cxrs_time_interval = ['cxrs: (time_interval can have several nbs ' as well']; help_struct_all.fit_tension = ['smoothing value used in interpos fitting routine, -30 means ''30 times default value'', thus -1 often a' ... ' good value' char(10) ... - 'cxrs: if numeric, default for all cases, if structure, default for non given fields']; + 'cxrs: if numeric, default for all cases, if structure, default for non given fields' char(10) ... + 'radcam: tension for interpos smoothing of data to have lower time samples']; help_struct_all.time = 'eqdsk: time(s) value(s) requested, by default time=1.0s (see time_out for other requests)'; help_struct_all.time_out = ['requested time for output: data points within interval if time_out=[t1 t2], otherwise assumes series of points, uses linear interpolation in that case (default [-Inf Inf])'... char(10) 'for sxr, mpx: only time interval provided in time_out is relevant']; @@ -62,7 +63,7 @@ help_struct_all.camera = sprintf('%s\n%s\n%s', ... ' for XTOMO: ''central'' (a central chord only), defaults if empty, [1 3 5] if only camera 1, 3 and 5 are desired'); help_struct_all.channel = sprintf('%s\n%s\n%s', ... 'radcam: chord to choose within camera interval, or simply chords, then it is re-distributed to correct camera'); -help_struct_all.freq = '''slow'', default, lower sampling; ''fast'' full samples for both mpx and xtomo'; +help_struct_all.freq = '''slow'', default, lower sampling (for radcam smoothing on dt=0.1ms); ''fast'' full samples for radcam, mpx and xtomo'; help_struct_all.max_adcs = 'rtc: source=''adcs'' maximum nb of adc channels loaded for each board in each active node'; help_struct_all.nfft = '512 (default) changes time resolution in spectrogram in gdat_plot for ''mhd'' request'; help_struct_all.map_eqdsk_psirz = 'eqdsk: if time array provided, maps all psi(R,Z,t) on same R,Zmesh in .data (1) or not (0, default)';