diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m index c03c33ed226d7902ec624ca78ca7450d28dc3daa..c11a752b88155051fcd69fa7a1e4513207c885fc 100644 --- a/crpptbx/TCV/gdat_tcv.m +++ b/crpptbx/TCV/gdat_tcv.m @@ -1099,7 +1099,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') disp('check substructure gdat_params.source_available for an ids list'); end ids_gen_ok = exist('ids_gen'); - equil_empty = struct([]); + ids_empty = struct([]); if ids_gen_ok ~= 2 ids_struct_saved = '/home/sauter/matlab/gdat_develop/crpptbx/TCV_IMAS/ids_structures_20190312.mat'; if ~exist(ids_struct_saved,'file') @@ -1108,7 +1108,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') else eval(['load ' ids_struct_saved]) if isfield(ids_structures,ids_top_name) - equil_empty = ids_structures.(ids_top_name); + ids_empty = ids_structures.(ids_top_name); else if ~isempty(ids_top_name); warning(['ids ''' ids_top_name ''' does not exist in ids_structures saved in ' ids_struct_saved]); @@ -1118,22 +1118,22 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end end else - equil_empty = ids_gen(ids_top_name); + ids_empty = ids_gen(ids_top_name); end try if ~isempty(shot) - eval(['[ids_top,ids_top_description]=tcv_get_ids_' ids_top_name '(shot,equil_empty);']) + eval(['[ids_top,ids_top_description]=tcv_get_ids_' ids_top_name '(shot,ids_empty,gdat_data.gdat_params);']) gdat_data.(ids_top_name) = ids_top; gdat_data.([ids_top_name '_description']) = ids_top_description; else - gdat_data.(ids_top_name) = equil_empty; + gdat_data.(ids_top_name) = ids_empty; gdat_data.([ids_top_name '_description']) = ['shot empty so return default empty structure for ' ids_top_name]; end catch ME_tcv_get_ids getReport(ME_tcv_get_ids) disp(['there is a problem with: tcv_get_ids_' ids_top_name ... ' , may be check if it exists in your path or test it by itself']) - gdat_data.(ids_top_name) = equil_empty; + gdat_data.(ids_top_name) = ids_empty; gdat_data.([ids_top_name '_description']) = getReport(ME_tcv_get_ids); end diff --git a/crpptbx/TCV_IMAS/tcv2ids.m b/crpptbx/TCV_IMAS/tcv2ids.m index 1e6ea138c928c9f83236703418982d26891b3179..69df85e4b1f42577e231a41cca9fcd4dbf7b868a 100644 --- a/crpptbx/TCV_IMAS/tcv2ids.m +++ b/crpptbx/TCV_IMAS/tcv2ids.m @@ -80,7 +80,7 @@ end for i=1:length(params_tcv2ids.ids_names) ids_to_get = params_tcv2ids.ids_names{i}; - tmp = gdat(shot,'ids','source',ids_to_get,'machine','tcv'); + tmp = gdat(shot,'ids','source',ids_to_get,'machine','tcv','error_bar','added'); ids_from_tcv.(ids_to_get) = tmp.(ids_to_get); ids_from_tcv.([ids_to_get '_description']) = tmp.([ids_to_get '_description']); end diff --git a/crpptbx/TCV_IMAS/tcv2ids2database.m b/crpptbx/TCV_IMAS/tcv2ids2database.m index 677a4ea2666e19ec024b593e644c4e164192ee2c..791edd519dbda97ac0696ee1bf629880f6183568 100644 --- a/crpptbx/TCV_IMAS/tcv2ids2database.m +++ b/crpptbx/TCV_IMAS/tcv2ids2database.m @@ -10,7 +10,7 @@ end shot=40000; shot=62745; -run_out=1; +run_out=2; occurence=0; ids2get = {'equilibrium', 'magnetics', 'pf_active','wall','core_profiles'}; % default will load all defined so far diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m b/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m index 92a5cae65803cb21ca8130bc75c295a1ae5c7b3f..13edd4f99c819d7c8f74fc083eedbefd2d1bdbf0 100644 --- a/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m +++ b/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m @@ -9,7 +9,7 @@ function [ids_pf_active,ids_description,varargout] = tcv_get_ids_pf_active(shot, % Get subfield [ids_pf_active.coil]= tcv_ids_coil(params.shot, ids_pf_active.coil(1)); [ids_pf_active.circuit]= tcv_ids_circuit(params.shot, ids_pf_active.circuit(1)); -[ids_pf_active.supply]= tcv_get_ids_supply(params.shot, ids_pf_active.supply(1)); +[ids_pf_active.supply]= tcv_ids_supply(params.shot, ids_pf_active.supply(1)); % make arrays not filled in empty: not the case for magnetics ids_pf_active.vertical_force = {}; diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_wall.m b/crpptbx/TCV_IMAS/tcv_get_ids_wall.m index 2196f69dba15b5b1a36b5b163b489f43bbe05c6e..c65f0e285ee57c13067e9947eae3a44796600057 100644 --- a/crpptbx/TCV_IMAS/tcv_get_ids_wall.m +++ b/crpptbx/TCV_IMAS/tcv_get_ids_wall.m @@ -1,4 +1,4 @@ -function [ids_wall,ids_description,varargout] = tcv_get_ids_wall(shot, ids_wall_empty, gdat_params, varargin) +function [ids_wall,ids_wall_description,varargout] = tcv_get_ids_wall(shot, ids_wall_empty, gdat_params, varargin) % % % gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar options @@ -8,7 +8,7 @@ function [ids_wall,ids_description,varargout] = tcv_get_ids_wall(shot, ids_wall_ [ids_wall, params] = tcv_ids_headpart(shot, ids_wall_empty,'wall','homogeneous_time',0,varargin{:}); % Get data of outline -[ids_wall.description_2d]= tcv_ids_wall_description_2d(params.shot, ids_wall.description_2d(1)); +[ids_wall.description_2d,ids_wall_description.description_2d]= tcv_ids_wall_description_2d(params.shot, ids_wall.description_2d(1)); % make arrays not filled in empty: not the case for magnetics ids_wall.global_quantities.neutral = {}; % wall does not work with Antoine's addpath diff --git a/crpptbx/TCV_IMAS/tcv_ids_bpol_probe.m b/crpptbx/TCV_IMAS/tcv_ids_bpol_probe.m index 73af32fcd36af7147d06d849cdf05e30508b305d..16e07c445e75e6923b2ce1cb856f5e1706bbd928 100644 --- a/crpptbx/TCV_IMAS/tcv_ids_bpol_probe.m +++ b/crpptbx/TCV_IMAS/tcv_ids_bpol_probe.m @@ -5,11 +5,12 @@ function [sub_ids_struct_out,sub_ids_struct_out_description, varargout] = tcv_i % Get magnetics.bpol_probe % % error_bar: from gdat_params.error_bar -% 'relative' (default): value to be added -% 'added': value already added to data: data +- error_bar +% 'delta' (default): error_bar to be added inserted in "upper" only as mentioned in description +% 'delta_with_lower' : error_bar (abs) inserted in both lower and upper +% 'added': value already added to data: upper/lower = data +/- error_bar % -error_bar = 'relative'; +error_bar = 'delta'; if exist('gdat_params') && isfield(gdat_params,'error_bar') && ~isempty(gdat_params.error_bar) error_bar = gdat_params.error_bar; end @@ -45,12 +46,19 @@ end fixed_error = 0.009999999776483; switch error_bar - case 'relative' + case 'delta' for ii=1:Nprobes sub_ids_struct_out{ii}.field.data_error_upper = fixed_error.*ones(size(sub_ids_struct_out{ii}.field.data));% TO BE FOUND; sub_ids_struct_out_description{ii}.field_data_error_upper = ['from fixed error value in case ' error_bar]; sub_ids_struct_out_description{ii}.field_data_error_lower = ['not provided since symmetric']; end + case 'delta_with_lower' + for ii=1:Nprobes + sub_ids_struct_out{ii}.field.data_error_upper = fixed_error.*ones(size(sub_ids_struct_out{ii}.field.data)); + sub_ids_struct_out{ii}.field.data_error_lower = sub_ids_struct_out{ii}.field.data_error_upper; + sub_ids_struct_out_description{ii}.field_data_error_upper = ['from fixed error value in case ' error_bar]; + sub_ids_struct_out_description{ii}.field_data_error_lower = ['from fixed error value in case ' error_bar]; + end case 'added' for ii=1:Nprobes sub_ids_struct_out{ii}.field.data_error_upper = sub_ids_struct_out{ii}.field.data + fixed_error.*ones(size(sub_ids_struct_out{ii}.field.data)); diff --git a/crpptbx/TCV_IMAS/tcv_ids_flux_loop.m b/crpptbx/TCV_IMAS/tcv_ids_flux_loop.m index ffb338de3b1e8bd3d32fce2b3aea5b00f3cb1c23..a108da40df1ed8472c4370954fde7f357d7d5bf7 100644 --- a/crpptbx/TCV_IMAS/tcv_ids_flux_loop.m +++ b/crpptbx/TCV_IMAS/tcv_ids_flux_loop.m @@ -5,11 +5,12 @@ function [sub_ids_struct_out,sub_ids_struct_out_description] = tcv_ids_flux_loop % Get ids field magnetics.flux_loop % % error_bar: from gdat_params.error_bar -% 'relative' (default): value to be added -% 'added': value already added to data: data +- error_bar +% 'delta' (default): error_bar to be added inserted in "upper" only as mentioned in description +% 'delta_with_lower' : error_bar (abs) inserted in both lower and upper +% 'added': value already added to data: upper/lower = data +/- error_bar % -error_bar = 'relative'; +error_bar = 'delta'; if exist('gdat_params') && isfield(gdat_params,'error_bar') && ~isempty(gdat_params.error_bar) error_bar = gdat_params.error_bar; end @@ -34,17 +35,26 @@ for ii=1:Nprobes sub_ids_struct_out_description{ii}.position_z = ['from ''STATIC("Z_F" )[' sub_ids_struct_out{ii}.name ']''']; sub_ids_struct_out{ii}.flux.data = data(:,ii); sub_ids_struct_out_description{ii}.flux_data = 'from ''tcv_idealloop("FLUX")'''; + sub_ids_struct_out{ii}.flux.time = time; % sub_ids_struct_out{ii}.position.phi = 0; % TO BE FOUND end switch error_bar - case 'relative' + case 'delta' for ii=1:Nprobes sub_ids_struct_out{ii}.flux.data_error_upper = 0.001200000056997.*ones(size(sub_ids_struct_out{ii}.flux.data)); sub_ids_struct_out_description{ii}.flux_data_error_upper = ['from fixed error value in case ' error_bar]; sub_ids_struct_out_description{ii}.flux_data_error_lower = ['not provided since symmetric']; %(not filled if symmetric) sub_ids_struct_out{ii}.flux.data_error_lower = 0.0012;%.*ones(size(sub_ids_struct_out{ii}.flux.data)); end + case 'delta_with_lower' + for ii=1:Nprobes + sub_ids_struct_out{ii}.flux.data_error_upper = 0.001200000056997.*ones(size(sub_ids_struct_out{ii}.flux.data)); + sub_ids_struct_out{ii}.flux.data_error_lower = sub_ids_struct_out{ii}.flux.data_error_upper; + sub_ids_struct_out_description{ii}.flux_data_error_upper = ['from fixed error value in case ' error_bar]; + sub_ids_struct_out_description{ii}.flux_data_error_lower = ['from fixed error value in case ' error_bar]; + %(not filled if symmetric) sub_ids_struct_out{ii}.flux.data_error_lower = 0.0012;%.*ones(size(sub_ids_struct_out{ii}.flux.data)); + end case 'added' for ii=1:Nprobes sub_ids_struct_out{ii}.flux_data_error_upper = sub_ids_struct_out{ii}.flux.data + 0.001200000056997.*ones(size(sub_ids_struct_out{ii}.flux.data)); diff --git a/crpptbx/TCV_IMAS/tcv_ids_ip.m b/crpptbx/TCV_IMAS/tcv_ids_ip.m index 90b3f0036f10a7dcbec550f06dd33c2e56afe76e..e53f5322b3e73eac8ca36ccfaa73f3b47acd5e39 100644 --- a/crpptbx/TCV_IMAS/tcv_ids_ip.m +++ b/crpptbx/TCV_IMAS/tcv_ids_ip.m @@ -5,8 +5,9 @@ function [ids_struct_out,ids_struct_out_description] = tcv_ids_ip(shot, ids_stru % Get magnetics.method{1}.ip % % error_bar: from gdat_params.error_bar -% 'relative' (default): value to be added -% 'added': value already added to data: data +- error_bar +% 'delta' (default): error_bar to be added inserted in "upper" only as mentioned in description +% 'delta_with_lower' : error_bar (abs) inserted in both lower and upper +% 'added': value already added to data: upper/lower = data +/- error_bar % error_bar = 'relative'; diff --git a/crpptbx/TCV_IMAS/tcv_ids_wall_description.m b/crpptbx/TCV_IMAS/tcv_ids_wall_description_2d.m similarity index 53% rename from crpptbx/TCV_IMAS/tcv_ids_wall_description.m rename to crpptbx/TCV_IMAS/tcv_ids_wall_description_2d.m index 80c403ca6d582aa34009634497bb32b478731268..ae069ced388ed97c28b5480b546b5a9229f2bfa9 100644 --- a/crpptbx/TCV_IMAS/tcv_ids_wall_description.m +++ b/crpptbx/TCV_IMAS/tcv_ids_wall_description_2d.m @@ -1,6 +1,5 @@ -function [ids_struct_out] = tcv_get_ids_descprition_2d(shot, ids_structures) +function [ids_struct_out,ids_struct_out_description] = tcv_ids_wall_description_2d(shot, ids_structures) -mdsopen(shot) %% r_l = mdsdata('STATIC("R_T")'); z_l = mdsdata('STATIC("Z_T")'); @@ -8,12 +7,12 @@ z_l = mdsdata('STATIC("Z_T")'); % There might be many 2d descriptions ids_struct_out = ids_structures; ids_struct_out{1}.limiter.unit{1}.outline.r = r_l; +ids_struct_out_description{1}.limiter.unit{1}.outline_r = ['from ''STATIC("R_T")']; ids_struct_out{1}.limiter.unit{1}.outline.z = z_l; +ids_struct_out_description{1}.limiter.unit{1}.outline_z = ['from ''STATIC("Z_T")']; %% TODO Add the other description of the wall and the input pharser -end -