From c62bb4f9e95660a04e66bb9f8845504ec270073c Mon Sep 17 00:00:00 2001 From: Antonia Frank <antonia.frank@epfl.ch> Date: Tue, 18 Jun 2024 09:50:04 +0200 Subject: [PATCH] Remove ec_inputs from defaults of ec_data call --- matlab/TCV/gdat_tcv.m | 50 ++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index a6118f64..23f322d4 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -91,6 +91,7 @@ gdat_params.doplot = 0; gdat_params.liuqe = 1; gdat_params.nverbose = 1; gdat_params.trialindx = []; +gdat_params.ec_inputs = 0; % construct list of keywords from global set of keywords and specific TCV set % get data_request names from centralized table @@ -1571,33 +1572,42 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') data_fullpath = ''; ec_help = ''; % EC - + + if gdat_data.gdat_params.ec_inputs % fill ec_inputs from write_pgyro [~,time,pgyro,pgyro_ecrh,gyro2launcher,freq2launcher,~,~] = write_pgyro(shot,'doplots',0); - ec_inputs.pgyro.data = pgyro; - ec_inputs.pgyro.t = time; - ec_inputs.pgyro.units = 'W'; - ec_inputs.pgyro.label = 'Power injected per launcher ; last index is total'; - ec_inputs.pgyro.x = 1:numel(pgyro(1,:)); - ec_inputs.pgyro.dim = {ec_inputs.pgyro.x, ec_inputs.pgyro.t}; - launchers_label = cellfun(@num2str, num2cell(1:size(pgyro,2)-1),'UniformOutput',false); - launchers_label{end+1} = 'tot'; - ec_inputs.pgyro.dimunits = {launchers_label, 's'}; + ec_inputs.pgyro.data = pgyro; + ec_inputs.pgyro.t = time; + ec_inputs.pgyro.units = 'W'; + ec_inputs.pgyro.label = 'Power injected per launcher ; last index is total'; + ec_inputs.pgyro.x = 1:numel(pgyro(1,:)); + ec_inputs.pgyro.dim = {ec_inputs.pgyro.x, ec_inputs.pgyro.t}; + launchers_label = cellfun(@num2str, num2cell(1:size(pgyro,2)-1),'UniformOutput',false); + launchers_label{end+1} = 'tot'; + ec_inputs.pgyro.dimunits = {launchers_label, 's'}; - ec_inputs.launchers_active.data = zeros(numel(pgyro_ecrh),1); - for ii =1:numel(pgyro_ecrh) - if ~isempty(pgyro_ecrh{ii}.data); ec_inputs.launchers_active.data(ii) = 1; end - end - ec_inputs.launchers_active.label = 'Active launchers in the shot (1:active, 0:inactive)'; + ec_inputs.launchers_active.data = zeros(numel(pgyro_ecrh),1); + for ii =1:numel(pgyro_ecrh) + if ~isempty(pgyro_ecrh{ii}.data); ec_inputs.launchers_active.data(ii) = 1; end + end + ec_inputs.launchers_active.label = 'Active launchers in the shot (1:active, 0:inactive)'; - ec_inputs.gyro2launcher.data = gyro2launcher; - ec_inputs.gyro2launcher.label = 'Gyrotron connected to launcher'; + ec_inputs.gyro2launcher.data = gyro2launcher; + ec_inputs.gyro2launcher.label = 'Gyrotron connected to launcher'; - ec_inputs.freq2launcher.data = freq2launcher; - ec_inputs.freq2launcher.label = 'Frequency in launcher'; - ec_inputs.freq2launcher.units = 'Hz'; + ec_inputs.freq2launcher.data = freq2launcher; + ec_inputs.freq2launcher.label = 'Frequency in launcher'; + ec_inputs.freq2launcher.units = 'Hz'; + ec_inputs.comment = 'ec_inputs loaded from write_pyro(shot)'; + else + ec_inputs.pgyro = []; + ec_inputs.launchers_active = []; + ec_inputs.gyro2launcher = []; + ec_inputs.freq2launcher = []; + ec_inputs.comment = 'Run gdat with name-value pair (''ec_inputs'',1) for ec_input information from write_pgyro'; + end gdat_data.ec.ec_inputs = ec_inputs; % introduce flag to check whether ec_data could be retrieved successfully -- GitLab