diff --git a/matlab/TCV_IMAS/tcv_get_ids_bolometer.m b/matlab/TCV_IMAS/tcv_get_ids_bolometer.m new file mode 100644 index 0000000000000000000000000000000000000000..2d34f4b5e53925dbf645a541f4facad0c5d07525 --- /dev/null +++ b/matlab/TCV_IMAS/tcv_get_ids_bolometer.m @@ -0,0 +1,188 @@ +function [ids_bolometer,ids_bolometer_description] = ... + tcv_get_ids_bolometer(shot, ids_bolometer_empty, gdat_params,varargin) +% +% [ids_bolometer,ids_bolometer_description] = ... +% tcv_get_ids_bolometer(shot, ids_bolometer_empty,varargin); +% +% Get the bolometer diagnostics data +% +% ids_bolometer_empty should at least be the empty bolometer ids structure +% in input +% +% gdat_params: gdat_data.gdat_params to get all params passed from original +% call, in particular error_bar options +% +% Date: 20/09/24 +% Author: L. Simons + +% Initialise structure with default ids_properties +% shot=70777; gdat_params=[]; varargin={}; +% aa=gdat([],'ids','source','bolometer'); ids_bolometer_empty=aa.bolometer; +if exist('gdat_params') + [ids_bolometer, ~] = tcv_ids_headpart(shot, ids_bolometer_empty, ... + 'bolometer','homogeneous_time',1,'gdat_params',gdat_params, ... + varargin{:}); +else + [ids_bolometer, ~] = tcv_ids_headpart(shot,ids_bolometer_empty,'bolometer','homogeneous_time',0,varargin{:}); +end + +ids_bolometer_description = struct(); + +% Load the bolometer geometry +bolo_geom=bolou_load_geometry(); + + +params_eff.data_request='\tcv_shot::top.results.bolo_u.intensity'; +params_eff.trialindx=1; +params_eff.machine='tcv'; +params_eff.doplot=0; +bolo_u_intensity = gdat(shot,params_eff); +params_eff.data_request='\tcv_shot::top.results.bolo_u.prad'; +bolo_u_prad = gdat(shot,params_eff); +params_eff.data_request='\tcv_shot::top.results.bolo_u.prad_core'; +bolo_u_prad_core = gdat(shot,params_eff); +params_eff.data_request='\tcv_shot::top.results.bolo_u.confidence'; +bolo_u_confidence = gdat(shot,params_eff); + +status = ~ischar(bolo_u_intensity.data) & ~ischar(bolo_u_prad_core.data); +imas_version_number=getenv('IMAS_VERSION'); +if status + nchannel = numel(bolo_u_intensity.x); + ids_bolometer.channel(1:nchannel) = ids_bolometer.channel(1); + for ii = 1:nchannel + %% Fill geometry information + % Fill information from bolo_geom=bolou_load_geometry(); + ids_bolometer.channel{ii}.name = bolo_geom.channel{ii}.name; + if strcmp(imas_version_number(1),'3') + ids_bolometer.channel{ii}.identifier = bolo_geom.channel{ii}.identifier; + elseif strcmp(imas_version_number(1),'4') + ids_bolometer.channel{ii}.description = bolo_geom.channel{ii}.identifier; + end + ids_bolometer.channel{ii}.detector.geometry_type= bolo_geom.channel{ii}.detector.geometry_type; + ids_bolometer.channel{ii}.detector.centre.phi= bolo_geom.channel{ii}.detector.centre.phi; + ids_bolometer.channel{ii}.detector.centre.r= bolo_geom.channel{ii}.detector.centre.r; + ids_bolometer.channel{ii}.detector.centre.z= bolo_geom.channel{ii}.detector.centre.z; + ids_bolometer.channel{ii}.detector.x1_unit_vector.x= bolo_geom.channel{ii}.detector.x1_unit_vector.x; + ids_bolometer.channel{ii}.detector.x1_unit_vector.y= bolo_geom.channel{ii}.detector.x1_unit_vector.y; + ids_bolometer.channel{ii}.detector.x1_unit_vector.z= bolo_geom.channel{ii}.detector.x1_unit_vector.z; + ids_bolometer.channel{ii}.detector.x2_unit_vector.x= bolo_geom.channel{ii}.detector.x2_unit_vector.x; + ids_bolometer.channel{ii}.detector.x2_unit_vector.y= bolo_geom.channel{ii}.detector.x2_unit_vector.y; + ids_bolometer.channel{ii}.detector.x2_unit_vector.z= bolo_geom.channel{ii}.detector.x2_unit_vector.z; + ids_bolometer.channel{ii}.detector.x3_unit_vector.x= bolo_geom.channel{ii}.detector.x3_unit_vector.x; + ids_bolometer.channel{ii}.detector.x3_unit_vector.y= bolo_geom.channel{ii}.detector.x3_unit_vector.y; + ids_bolometer.channel{ii}.detector.x3_unit_vector.z= bolo_geom.channel{ii}.detector.x3_unit_vector.z; + ids_bolometer.channel{ii}.detector.x1_width= bolo_geom.channel{ii}.detector.x1_width; + ids_bolometer.channel{ii}.detector.x2_width= bolo_geom.channel{ii}.detector.x2_width; + ids_bolometer.channel{ii}.detector.surface= bolo_geom.channel{ii}.detector.surface; + + ids_bolometer.channel{ii}.aperture{1}.geometry_type= bolo_geom.channel{ii}.aperture{1}.geometry_type; + ids_bolometer.channel{ii}.aperture{1}.centre.r= bolo_geom.channel{ii}.aperture{1}.centre.r; + ids_bolometer.channel{ii}.aperture{1}.centre.z= bolo_geom.channel{ii}.aperture{1}.centre.z; + ids_bolometer.channel{ii}.aperture{1}.x1_unit_vector.x= bolo_geom.channel{ii}.aperture{1}.x1_unit_vector.x; + ids_bolometer.channel{ii}.aperture{1}.x1_unit_vector.y= bolo_geom.channel{ii}.aperture{1}.x1_unit_vector.y; + ids_bolometer.channel{ii}.aperture{1}.x1_unit_vector.z= bolo_geom.channel{ii}.aperture{1}.x1_unit_vector.z; + ids_bolometer.channel{ii}.aperture{1}.x2_unit_vector.x= bolo_geom.channel{ii}.aperture{1}.x2_unit_vector.x; + ids_bolometer.channel{ii}.aperture{1}.x2_unit_vector.y= bolo_geom.channel{ii}.aperture{1}.x2_unit_vector.y; + ids_bolometer.channel{ii}.aperture{1}.x2_unit_vector.z= bolo_geom.channel{ii}.aperture{1}.x2_unit_vector.z; + ids_bolometer.channel{ii}.aperture{1}.x3_unit_vector.x= bolo_geom.channel{ii}.aperture{1}.x3_unit_vector.x; + ids_bolometer.channel{ii}.aperture{1}.x3_unit_vector.y= bolo_geom.channel{ii}.aperture{1}.x3_unit_vector.y; + ids_bolometer.channel{ii}.aperture{1}.x3_unit_vector.z= bolo_geom.channel{ii}.aperture{1}.x3_unit_vector.z; + ids_bolometer.channel{ii}.aperture{1}.x1_width= bolo_geom.channel{ii}.aperture{1}.x1_width; + ids_bolometer.channel{ii}.aperture{1}.x2_width= bolo_geom.channel{ii}.aperture{1}.x2_width; + ids_bolometer.channel{ii}.aperture{1}.surface= bolo_geom.channel{ii}.aperture{1}.surface; + + ids_bolometer.channel{ii}.etendue = bolo_geom.channel{ii}.etendue; + ids_bolometer.channel{ii}.etendue_method.name = bolo_geom.channel{ii}.etendue_method.name; + ids_bolometer.channel{ii}.etendue_method.description = bolo_geom.channel{ii}.etendue_method.description; + + ids_bolometer.channel{ii}.line_of_sight.first_point.phi = bolo_geom.channel{ii}.line_of_sight.first_point.phi; + ids_bolometer.channel{ii}.line_of_sight.first_point.r = bolo_geom.channel{ii}.line_of_sight.first_point.r; + ids_bolometer.channel{ii}.line_of_sight.first_point.z = bolo_geom.channel{ii}.line_of_sight.first_point.z; + + ids_bolometer.channel{ii}.line_of_sight.second_point.phi = bolo_geom.channel{ii}.line_of_sight.second_point.phi; + ids_bolometer.channel{ii}.line_of_sight.second_point.r = bolo_geom.channel{ii}.line_of_sight.second_point.r; + ids_bolometer.channel{ii}.line_of_sight.second_point.z = bolo_geom.channel{ii}.line_of_sight.second_point.z; + + %% Fill measurement information + ids_bolometer.channel{ii}.power.data = bolo_u_intensity.data(ii,:); + ids_bolometer_description.channel{ii}.power.data = ... + ['From results.bolo_u.intensity data, Radiance measured by ' ... + 'each bolometer foil in units of [W/m^{2}sr]']; + ids_bolometer.channel{ii}.power.t = bolo_u_intensity.t; + ids_bolometer_description.channel{ii}.power.data = ... + ['From results.bolo_u.intensity dim{1}, time basis of radiance']; + ids_bolometer.channel{ii}.validity = 0; % FIXME: Always valid data + ids_bolometer.channel{ii}.power_radiated_total = bolo_u_prad.data; + ids_bolometer_description.channel{ii}.power_radiated_total = ... + ['From results.bolo_u.prad data, Total radiated power measured by ' ... + 'the bolometer system in units of [kW]']; +% ids_bolometer.channel{ii}.power_radiated_total_error_upper = ... +% 0.*bolo_u_prad.data; % FIXME: Zero error +% ids_bolometer.channel{ii}.power_radiated_total_error_lower = ... +% 0.*bolo_u_prad.data; % FIXME: Zero error + ids_bolometer.channel{ii}.power_radiated_inside_lcfs = ... + bolo_u_prad_core.data; + ids_bolometer_description.channel{ii}.power_radiated_inside_lcfs.data = ... + ['From results.bolo_u.prad_core data, Total radiated power ' ... + 'radiated from inside the last closed flux surface in units of [kW]']; +% ids_bolometer.channel{ii}.power_radiated_inside_lcfs_error_upper = ... +% 0.*bolo_u_prad_core.data; +% ids_bolometer.channel{ii}.power_radiated_inside_lcfs_error_lower = ... +% 0.*bolo_u_prad_core.data; + ids_bolometer.channel{ii}.power_radiated_validity = 0*bolo_u_prad.data; + + ids_bolometer.power_radiated_inside_lcfs = bolo_u_prad_core.data; + ids_bolometer.power_radiated_total = bolo_u_prad.data; + ids_bolometer.power_radiated_validity = 0*bolo_u_prad.data; + end + ids_bolometer.code.name = 'rc_gti_prep'; + ids_bolometer.code.description = ... + ['rc_gti_prep, RADCAM gitlab repo, calls GTI to generate emissivity profiles with liuqe.'] + ids_bolometer.code.commit=''; + ids_bolometer.code.version=''; + ids_bolometer.code.repository= ... + 'https://gitlab.epfl.ch/spc/tcv/diag/radcam/'; + ids_bolometer.code.parameters=['rc_gti_prep(shot,[0 2.2],''bolo'', 10, 1, 0.04, 30,', ... + 'false, false,false, [], ''automated'', 1)']; + + %% Code legacy for TCV_EQ; FBTE + % Call to gti: gti_get_disc + % Call to TCV_eq: temp=tdi('TCV_EQ("psi")',disc.s.equilsrc); + % https://spcwiki.epfl.ch/wiki/Tcv_eq + % a=gdat(shot,'TCV_EQ("psi")'); + ids_bolometer.code.library{1}.name = 'fbte'; + ids_bolometer.code.library{1}.description = 'Magnetic equilibrium'; + ids_bolometer.code.library{1}.commit = ''; + ids_bolometer.code.library{1}.version = ''; + ids_bolometer.code.library{1}.repository = ... + 'https://gitlab.epfl.ch/spc/tcv/tbx/meq'; + ids_bolometer.code.library{1}.parameters = 'TCV_EQ("psi")'; + + + %% Code legacy for GTI + ids_bolometer.code.library{2}.name = 'GTI'; + ids_bolometer.code.library{2}.description = ... + 'General Tomographic Inversion'; + ids_bolometer.code.library{2}.commit = ''; + [a1,a2]=unix('git rev-parse --verify HEAD'); + [b1,b2]=unix('git rev-parse --abbrev-ref HEAD'); + ids_bolometer.code.library{2}.version = sprintf('%s_branch_%s',strtrim(a2),strtrim(b2)); + ids_bolometer.code.library{2}.repository = ... + 'https://gitlab.epfl.ch/spc/tcv/analysis/gti'; + ids_bolometer.code.library{2}.parameters = ''; + + + % Translate bolo_u_confidence values to ids_bolometer.code.output_flag values + if bolo_u_confidence.data == 0 + ids_bolometer.code.output_flag=1; + elseif bolo_u_confidence.data == 1 + ids_bolometer.code.output_flag=0; + else + ids_bolometer.code.output_flag=-abs(bolo_u_confidence.data); + end + ids_bolometer.time = bolo_u_intensity.t; +else + warning('Failed to load data for shot %d',shot); +end + +end diff --git a/matlab/TCV_IMAS/tcv_get_ids_pf_passive.m b/matlab/TCV_IMAS/tcv_get_ids_pf_passive.m new file mode 100644 index 0000000000000000000000000000000000000000..c95518dce9741b4ebb630f56503004e5df02eeac --- /dev/null +++ b/matlab/TCV_IMAS/tcv_get_ids_pf_passive.m @@ -0,0 +1,85 @@ +function [ids_pf_passive,ids_pf_passive_description,varargout] = tcv_get_ids_pf_passive(shot, ids_pf_passive_empty, gdat_params, varargin) +% +% gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar options +% + +% Input pharser +if exist('gdat_params','var') + [ids_pf_passive, params_pf_passive] = tcv_ids_headpart(shot, ids_pf_passive_empty,'pf_passive','homogeneous_time',0,'gdat_params',gdat_params,varargin{:}); +else + [ids_pf_passive, params_pf_passive] = tcv_ids_headpart(shot, ids_pf_passive_empty,'pf_passive','homogeneous_time',0,varargin{:}); + aa=gdat_tcv; + gdat_params = aa.gdat_params; % to get default params +end +params_eff_ref = gdat_params; params_eff_ref.doplot=0; +try params_eff_ref=rmfield(params_eff_ref,'source');catch;end % make sure no source (from ids def) + + +% Get subfield + +G.rv = gdat(shot, 'STATIC("R_V")'); % Vessel radial coord 256x1 +G.wv = gdat(shot, 'STATIC("A_V")'); % Vessel conductor width 256x1 +G.zv = gdat(shot, 'STATIC("Z_V")'); % Vessel vert. coord 256x1 +G.hv = gdat(shot, 'STATIC("B_V")'); % Vessel conductor heigth 256x1 +G.Rv = gdat(shot, 'STATIC("RES_V")'); % Vessel resistivity 1 in 256x1 in ohm +G.res = gdat(shot, 'STATIC("RHO_V")'); % Vessel resistance 1 in ohm*m +G.dimv = gdat(shot, 'STATIC("N_V")'); % Number of turns + +Uf = gdat(shot, 'TCV_IDEALLOOP("VLOOP")'); % Flux loop voltage +Tvs = gdat(shot, 'STATIC("T_V_S")'); % Transfer matrix segments to vessel elements +Rs = gdat(shot, 'STATIC("RES_S")'); % Resistance of each segment + +Is = -Uf.data./Rs.data'; % Measured current in each segment +Iv = Tvs.data*Is'; % Mapped to each vessel element + +%ids_core_profiles.profiles_1d{1}.ion{1}.state = {}; +%ids_core_profiles.profiles_1d{1}.neutral{1}.state = {}; +%ids_core_profiles.profiles_1d(1:length(ids_core_profiles.time)) = ids_core_profiles.profiles_1d(1); + +loop_template = ids_pf_passive.loop{1}; + +for ii=1:G.dimv.data + % Duplicate loop substructure + ids_pf_passive.loop{ii} = loop_template; + + ids_pf_passive.loop{ii}.element{1}.geometry.geometry_type = 3; + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.r = G.rv.data(ii)-G.wv.data(ii)/2; + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.z = G.zv.data(ii)-G.hv.data(ii)/2; + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.length_alpha = G.wv.data(ii); + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.length_beta = G.hv.data(ii); + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.alpha = 0; + ids_pf_passive.loop{ii}.element{1}.geometry.oblique.beta = 0; + ids_pf_passive.loop{ii}.element{1}.turns_with_sign = 1; + + ids_pf_passive.loop{ii}.element{1}.name = num2str(ii); + ids_pf_passive.loop{ii}.name = num2str(ii); % might not be correct + + ids_pf_passive.loop{ii}.resistivity = G.Rv.data(ii)/2/pi/G.rv.data(ii)*G.wv.data(ii)*G.hv.data(ii); + ids_pf_passive.loop{ii}.resistance = G.res.data; + ids_pf_passive.loop{ii}.current = Iv(ii,:); + ids_pf_passive.loop{ii}.time = Uf.t; + +end + +%% Code + +if nargin <= 2 + ids_pf_passive.code.name = ['tcv_get_ids_pf_passive, within gdat, with shot= ' num2str(params_pf_passive.shot) ]; +else + ids_pf_passive.code.name = ['tcv_get_ids_pf_passive, within gdat, with shot= ' num2str(params_pf_passive.shot) '; varargin: ' varargin{:}]; +end +ids_pf_passive_description.code.name = ids_pf_passive.code.name; + +ids_pf_passive.code.output_flag = zeros(size(ids_pf_passive.time)); + + + +% Not sure about this, copied from active but might need changes +% cocos automatic transform +if exist('ids_generic_cocos_nodes_transformation_symbolic','file') + [ids_pf_passive,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(ids_pf_passive,'pf_passive',gdat_params.cocos_in, ... + gdat_params.cocos_out,gdat_params.ipsign_out,gdat_params.b0sign_out,gdat_params.ipsign_in,gdat_params.b0sign_in, ... + gdat_params.error_bar,gdat_params.nverbose); + +end + diff --git a/matlab/TCV_IMAS/tcv_get_ids_soft_x_rays.m b/matlab/TCV_IMAS/tcv_get_ids_soft_x_rays.m new file mode 100644 index 0000000000000000000000000000000000000000..22538ebaaf386abcf92def4fccfba7ce4619fc29 --- /dev/null +++ b/matlab/TCV_IMAS/tcv_get_ids_soft_x_rays.m @@ -0,0 +1,139 @@ +function [ids_soft_x_rays,ids_soft_x_rays_description] = ... + tcv_get_ids_soft_x_rays(shot, ids_soft_x_rays_empty, gdat_params,varargin) +% +% [ids_soft_x_rays,ids_soft_x_rays_description] = ... +% tcv_get_ids_soft_x_rays(shot, ids_soft_x_rays_empty,varargin); +% +% Get the RADCAM Soft X-Ray (SXR) diagnostics data +% +% ids_soft_x_rays_empty should at least be the empty Soft X-Ray ids +% structure in input +% +% gdat_params: gdat_data.gdat_params to get all params passed from original +% call, in particular error_bar options +% +% Date: 20/09/24 +% Author: L. Simons + +% Initialise structure with default ids_properties +% shot=70777; gdat_params=[]; varargin={}; +% aa=gdat([],'ids','source','soft_x_rays'); +% ids_soft_x_rays_empty=aa.soft_x_rays; +if exist('gdat_params') + [ids_soft_x_rays, ~] = tcv_ids_headpart(shot, ids_soft_x_rays_empty, ... + 'soft_x_rays','homogeneous_time',1,'gdat_params',gdat_params, ... + 'comment','RADCAM Soft X-Ray 47um Be filered optodiode AXUV20ELGDS diodes ', ... + varargin{:}); +else + [ids_soft_x_rays, ~] = tcv_ids_headpart(shot, ids_soft_x_rays_empty, ... + 'soft_x_rays','homogeneous_time',0, ... + 'comment','RADCAM Soft X-Ray 47um Be filered optodiode AXUV20ELGDS diodes', ... + varargin{:}); +end + +ids_soft_x_rays_description = struct(); + +% Load the soft_x_rays geometry +sxr_geom=sxr_load_geometry(); +sxr_data=rc_load_diodes(shot,'diag_name','sxr'); +status=numel(sxr_data.data)>0; + +%get gdat version, FIXME: Need to write function +%radcam_repo_version=imas_get_code_version(); + +if status + nchannel = sum(rc_n_chn(shot,'sxr')); + ids_soft_x_rays.channel(1:nchannel) = ids_soft_x_rays.channel(1); + for ii = 1:nchannel + + ids_soft_x_rays.channel{ii}.name = sxr_geom.channel{ii}.name; + ids_soft_x_rays_description.channel{ii}.name = ... + ['RADCAM Soft X-Ray (SXR) detector name, from camera labels and ' ... + 'number VT: Vertical Top, UL: Upper Lateral, ML: Middle Lateral, ' ... + 'DIV: Divertor, VB: Vertical bottom. Matches cabling.']; + + ids_soft_x_rays.channel{ii}.identifier = ... + sxr_geom.channel{ii}.identifier; + ids_soft_x_rays_description.channel{ii}.identifier = ... + ['RADCAM Soft X-Ray (SXR) system, global index from clock-wise ' ... + 'ordering from inboard side']; + + %ids_soft_x_rays_description.channel{ii}.description = ... + % [sprintf('SXR Diode detector %d, %s Line of Sight %d',ii,,)]; + + ids_soft_x_rays.channel{ii}.detector.geometry_type= sxr_geom.channel{ii}.detector.geometry_type; + ids_soft_x_rays.channel{ii}.detector.centre.phi= sxr_geom.channel{ii}.detector.centre.phi; + ids_soft_x_rays.channel{ii}.detector.centre.r= sxr_geom.channel{ii}.detector.centre.r; + ids_soft_x_rays.channel{ii}.detector.centre.z= sxr_geom.channel{ii}.detector.centre.z; + ids_soft_x_rays.channel{ii}.detector.x1_unit_vector.x= sxr_geom.channel{ii}.detector.x1_unit_vector.x; + ids_soft_x_rays.channel{ii}.detector.x1_unit_vector.y= sxr_geom.channel{ii}.detector.x1_unit_vector.y; + ids_soft_x_rays.channel{ii}.detector.x1_unit_vector.z= sxr_geom.channel{ii}.detector.x1_unit_vector.z; + ids_soft_x_rays.channel{ii}.detector.x2_unit_vector.x= sxr_geom.channel{ii}.detector.x2_unit_vector.x; + ids_soft_x_rays.channel{ii}.detector.x2_unit_vector.y= sxr_geom.channel{ii}.detector.x2_unit_vector.y; + ids_soft_x_rays.channel{ii}.detector.x2_unit_vector.z= sxr_geom.channel{ii}.detector.x2_unit_vector.z; + ids_soft_x_rays.channel{ii}.detector.x3_unit_vector.x= sxr_geom.channel{ii}.detector.x3_unit_vector.x; + ids_soft_x_rays.channel{ii}.detector.x3_unit_vector.y= sxr_geom.channel{ii}.detector.x3_unit_vector.y; + ids_soft_x_rays.channel{ii}.detector.x3_unit_vector.z= sxr_geom.channel{ii}.detector.x3_unit_vector.z; + ids_soft_x_rays.channel{ii}.detector.x1_width= sxr_geom.channel{ii}.detector.x1_width; + ids_soft_x_rays.channel{ii}.detector.x2_width= sxr_geom.channel{ii}.detector.x2_width; + ids_soft_x_rays.channel{ii}.detector.surface= sxr_geom.channel{ii}.detector.surface; + + ids_soft_x_rays.channel{ii}.aperture{1}.geometry_type= sxr_geom.channel{ii}.aperture{1}.geometry_type; + ids_soft_x_rays.channel{ii}.aperture{1}.centre.r= sxr_geom.channel{ii}.aperture{1}.centre.r; + ids_soft_x_rays.channel{ii}.aperture{1}.centre.z= sxr_geom.channel{ii}.aperture{1}.centre.z; + ids_soft_x_rays.channel{ii}.aperture{1}.x1_unit_vector.x= sxr_geom.channel{ii}.aperture{1}.x1_unit_vector.x; + ids_soft_x_rays.channel{ii}.aperture{1}.x1_unit_vector.y= sxr_geom.channel{ii}.aperture{1}.x1_unit_vector.y; + ids_soft_x_rays.channel{ii}.aperture{1}.x1_unit_vector.z= sxr_geom.channel{ii}.aperture{1}.x1_unit_vector.z; + ids_soft_x_rays.channel{ii}.aperture{1}.x2_unit_vector.x= sxr_geom.channel{ii}.aperture{1}.x2_unit_vector.x; + ids_soft_x_rays.channel{ii}.aperture{1}.x2_unit_vector.y= sxr_geom.channel{ii}.aperture{1}.x2_unit_vector.y; + ids_soft_x_rays.channel{ii}.aperture{1}.x2_unit_vector.z= sxr_geom.channel{ii}.aperture{1}.x2_unit_vector.z; + ids_soft_x_rays.channel{ii}.aperture{1}.x3_unit_vector.x= sxr_geom.channel{ii}.aperture{1}.x3_unit_vector.x; + ids_soft_x_rays.channel{ii}.aperture{1}.x3_unit_vector.y= sxr_geom.channel{ii}.aperture{1}.x3_unit_vector.y; + ids_soft_x_rays.channel{ii}.aperture{1}.x3_unit_vector.z= sxr_geom.channel{ii}.aperture{1}.x3_unit_vector.z; + ids_soft_x_rays.channel{ii}.aperture{1}.x1_width= sxr_geom.channel{ii}.aperture{1}.x1_width; + ids_soft_x_rays.channel{ii}.aperture{1}.x2_width= sxr_geom.channel{ii}.aperture{1}.x2_width; + ids_soft_x_rays.channel{ii}.aperture{1}.surface= sxr_geom.channel{ii}.aperture{1}.surface; + + ids_soft_x_rays.channel{ii}.etendue = sxr_geom.channel{ii}.etendue; + ids_soft_x_rays.channel{ii}.etendue_method.name = sxr_geom.channel{ii}.etendue_method.name; + ids_soft_x_rays.channel{ii}.etendue_method.description = sxr_geom.channel{ii}.etendue_method.description; + + ids_soft_x_rays.channel{ii}.filter_window{1}.identifier = 1; + ids_soft_x_rays.channel{ii}.filter_window{1}.material.name = 'Be'; + ids_soft_x_rays.channel{ii}.filter_window{1}.material.index = 10; + ids_soft_x_rays.channel{ii}.filter_window{1}.material.description = ''; + ids_soft_x_rays.channel{ii}.filter_window{1}.thickness = '47e-6'; + + ids_soft_x_rays.channel{ii}.line_of_sight.first_point.phi = sxr_geom.channel{ii}.line_of_sight.first_point.phi; + ids_soft_x_rays.channel{ii}.line_of_sight.first_point.r = sxr_geom.channel{ii}.line_of_sight.first_point.r; + ids_soft_x_rays.channel{ii}.line_of_sight.first_point.z = sxr_geom.channel{ii}.line_of_sight.first_point.z; + + ids_soft_x_rays.channel{ii}.line_of_sight.second_point.phi = sxr_geom.channel{ii}.line_of_sight.second_point.phi; + ids_soft_x_rays.channel{ii}.line_of_sight.second_point.r = sxr_geom.channel{ii}.line_of_sight.second_point.r; + ids_soft_x_rays.channel{ii}.line_of_sight.second_point.z = sxr_geom.channel{ii}.line_of_sight.second_point.z; + + ids_soft_x_rays.channel{ii}.brightness.data = sxr_data.data(ii,:); + ids_soft_x_rays.channel{ii}.brightness.time = sxr_data.time; + ids_soft_x_rays_description.channel{ii}.brightness.data = ... + ['From ATLAS::SYSTEM:SXR:CHANNEL_ data, Radiance measured by ' ... + 'Each SXR diode in arbitrary units of [counts]']; + + ids_soft_x_rays.channel{ii}.validity = 0; % FIXME: Always valid data + ids_soft_x_rays.channel{ii}.validity = 0*ones(1,nchannel); + + ids_soft_x_rays.code.name = 'rc_load_diodes'; + ids_soft_x_rays.code.description = ['rc_load_diodes, RADCAM gitlab repo, loads' ... + 'the signal from the SXR diodes in arbitrary units.']; + ids_soft_x_rays.code.commit=''; + ids_soft_x_rays.code.version=''; + ids_soft_x_rays.code.repository= ... + 'https://gitlab.epfl.ch/spc/tcv/diag/radcam/'; + ids_soft_x_rays.code.parameters='''diag_name'',''sxr'''; + end + + ids_soft_x_rays.time = sxr_data.time; +else + warning('Failed to load data for shot %d',shot); +end + +end