diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m index 23c36b372bbf7423626dfa2e76d1660bdbd06023..04d9b944ceb3cf4a69c8817b5a5f8b98ba572d2c 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m +++ b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m @@ -372,6 +372,7 @@ if ~isempty(temp_1d.cxrs_rho.data) end else data_fullpath_fit = ['Ti from fit in CONF node, from call ', temp_1d_desc.ti_conf_rho]; + data_fullpath_raw = ['Experimental raw data not available']; end temp_1d.ti.fit = temp_1d.ti_conf_rho; @@ -397,17 +398,21 @@ catch temp_1d_desc.cxrs_rho = ['Problem with gdat ' params_eff_fit1.data_request ' ; no data']; end -% Extract sources to find integration time for each data -mask_sources = zeros(size(temp_1d.cxrs_rho.ti.raw.data)); - -% Retrive the source for each datapoint -for isource = all_sources - try - params_eff_fit1.source = [isource]; - temp_1d.cxrs_rho_partial = gdat(params_cores_profiles.shot,params_eff_fit1); - [isCommon, idxA] = ismember(temp_1d.cxrs_rho.ti.raw.data, temp_1d.cxrs_rho_partial.ti.raw.data); - isCommon = isource*isCommon; - mask_sources(isCommon ~= 0) = isCommon(isCommon ~= 0); +if isfield(temp_1d.cxrs_rho, 'ti') + if isfield(temp_1d.cxrs_rho.ti.raw, 'data') + % Extract sources to find integration time for each data + mask_sources = zeros(size(temp_1d.cxrs_rho.ti.raw.data)); + + % Retrive the source for each datapoint + for isource = all_sources + try + params_eff_fit1.source = [isource]; + temp_1d.cxrs_rho_partial = gdat(params_cores_profiles.shot,params_eff_fit1); + [isCommon, idxA] = ismember(temp_1d.cxrs_rho.ti.raw.data, temp_1d.cxrs_rho_partial.ti.raw.data); + isCommon = isource*isCommon; + mask_sources(isCommon ~= 0) = isCommon(isCommon ~= 0); + end + end end end @@ -433,10 +438,14 @@ for ii = 1:12 end end -% Assign widths of integration time -widths = zeros(size(temp_1d.cxrs_rho.ti.raw.data)); -for isource = all_sources - widths(mask_sources == isource) = times_cxrs_integration(isource); +% Assign widths of integration time +if isfield(temp_1d.cxrs_rho, 'ti') + if isfield(temp_1d.cxrs_rho.ti.raw, 'data') + widths = zeros(size(temp_1d.cxrs_rho.ti.raw.data)); + for isource = all_sources + widths(mask_sources == isource) = times_cxrs_integration(isource); + end + end end params_eff_fit1.data_request = 'results.conf:ni'; @@ -455,6 +464,7 @@ if ~isempty(temp_1d.cxrs_rho.data) end else data_fullpath_fit = ['ni from fit in CONF node, from call ', temp_1d_desc.ni_conf_rho]; + data_fullpath_raw = ['Experimental raw data not available']; end temp_1d_desc.ni.raw = data_fullpath_fit; temp_1d.ni.fit = temp_1d.ni_conf_rho;