diff --git a/matlab/TCV_IMAS/tcv_get_ids_ec_antennas.m b/matlab/TCV_IMAS/tcv_get_ids_ec_antennas.m index 4aadc7dd6a94de3247e6179158e80990b26517fb..261619c717363b15530a7c112a681495f18925e8 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_ec_antennas.m +++ b/matlab/TCV_IMAS/tcv_get_ids_ec_antennas.m @@ -15,14 +15,21 @@ function [ids_ec_antennas,ids_ec_antennas_description,varargout] = tcv_get_ids_e pow=gdat_tcv(shot,'powers'); -if shot>=63000 - warning('not sure if set-up correct for new launchers, beams, gyrotrons. Check with O. Sauter') +if isempty(pow.ec.t) || isempty(pow.ec.data) || max(pow.ec.data(:,end))<1e-10 + ids_ec_antennas_description.comment = 'no power'; return end -nb_antennas = 9; % at this stage keep same numbering as standard TCV launchers before mid-2019 +nb_antennas = size(pow.ec.data,2)-1; % at this stage keep same numbering as standard TCV launchers before mid-2019 ids_ec_antennas.antenna(1:nb_antennas) = ids_ec_antennas.antenna(1); % copy empty structure for all units, then fill in +ids_ec_antennas_description.comment = ['assume ' num2str(nb_antennas) ' launchers']; + +if shot>=63000 + warning('not sure if set-up correct for new launchers, beams, gyrotrons. Check with O. Sauter') + % return +end + % $$$ ids_ec_antennas.time = pow.ec.t; if homogeneous time % $$$ ids_ec_antennas_description.time = 'time from power'; [r_phi0,z_phi0,r1,z1,rc,zc,thetphi_L,thetphi_tor,raysbylauncher,powers,fname,z_axis,launch_params] = ... diff --git a/matlab/TCV_IMAS/tcv_get_ids_nbi.m b/matlab/TCV_IMAS/tcv_get_ids_nbi.m index 9d788474db144bd417db1409f0394b777454d7d6..5515cf928901f1767c9f93d35dd3cb49f42f5c8a 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_nbi.m +++ b/matlab/TCV_IMAS/tcv_get_ids_nbi.m @@ -72,11 +72,16 @@ for iunit=1:nb_units ids_nbi_description.unit{iunit}.energy = ['from \results::' results_subname{iunit} ':energy']; %% power & current fractions p_frac=gdat(shot,['\results::' results_subname{iunit} ':fraction']); - ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data(:,1:3)*0.01; ids_nbi.unit{iunit}.beam_power_fraction.time = p_frac.t; ids_nbi_description.unit{iunit}.beam_power_fraction = ['from \results::' results_subname{iunit} ':fraction']; - i_frac = p_frac.data(:,1:3).*repmat([1 2 3],size(p_frac.data,1),1); % to be compatible with older matlab version .*[1 2 3] not ok - i_frac = i_frac.*1./repmat(sum(i_frac),size(p_frac.data,1),1); + if ~isempty(p_frac.data) && size(p_frac.data,2)>=3 + ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data(:,1:3)*0.01; + i_frac = p_frac.data(:,1:3).*repmat([1 2 3],size(p_frac.data,1),1); % to be compatible with older matlab version .*[1 2 3] not ok + i_frac = i_frac.*1./repmat(sum(i_frac),size(p_frac.data,1),1); + else + ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data; + i_frac = p_frac.data; + end ids_nbi.unit{iunit}.beam_current_fraction.data = i_frac; ids_nbi.unit{iunit}.beam_current_fraction.time = p_frac.t; %% species