Skip to content
Snippets Groups Projects
Commit 96add5db authored by Olivier Sauter's avatar Olivier Sauter
Browse files

Merge branch 'master' into add_multi_shot

parents acbc3829 fe7d7d16
No related branches found
No related tags found
1 merge request!153Add multi shot
Pipeline #196216 passed
Showing
with 4114 additions and 4121 deletions
......@@ -81,7 +81,7 @@ for i=1:length(ij)
it_cxrs = find(cxrs.t>=t1(i) & cxrs.t<t2(i));
it_cmz = find(cmz.t>=t1(i) & cmz.t<t2(i));
% construct 1D array with data from both cxrs, cmz
rhotor_data_tofit = [];
rhotor_data_tofit = [];
tidata_tofit = [];
vrotdata_tofit = [];
tierr_tofit = [];
......@@ -90,11 +90,11 @@ for i=1:length(ij)
for it=1:length(it_cxrs)
idata = find(cxrs.ti.data(:,it_cxrs(it))>0 & cxrs.rhotornorm(:,it_cxrs(it))<1.01);
if length(idata)>0
rhotor_data_tofit(end+1:end+length(idata)) = cxrs.rhotornorm(idata,it_cxrs(it));
tidata_tofit(end+1:end+length(idata)) = cxrs.ti.data(idata,it_cxrs(it));
vrotdata_tofit(end+1:end+length(idata)) = cxrs.vrot.data(idata,it_cxrs(it));
tierr_tofit(end+1:end+length(idata)) = cxrs.ti.error_bar(idata,it_cxrs(it))./ticoeff_err_cxrs;
vroterr_tofit(end+1:end+length(idata)) = cxrs.vrot.error_bar(idata,it_cxrs(it))./vrotcoeff_err_cxrs;
rhotor_data_tofit(end+1:end+length(idata)) = cxrs.rhotornorm(idata,it_cxrs(it));
tidata_tofit(end+1:end+length(idata)) = cxrs.ti.data(idata,it_cxrs(it));
vrotdata_tofit(end+1:end+length(idata)) = cxrs.vrot.data(idata,it_cxrs(it));
tierr_tofit(end+1:end+length(idata)) = cxrs.ti.error_bar(idata,it_cxrs(it))./ticoeff_err_cxrs;
vroterr_tofit(end+1:end+length(idata)) = cxrs.vrot.error_bar(idata,it_cxrs(it))./vrotcoeff_err_cxrs;
end
end
end
......@@ -102,11 +102,11 @@ for i=1:length(ij)
for it=1:length(it_cmz)
idata = find(cmz.ti.data(:,it_cmz(it))>0 & cmz.rhotornorm(:,it_cmz(it))<1.01);
if length(idata)>0
rhotor_data_tofit(end+1:end+length(idata)) = cmz.rhotornorm(idata,it_cmz(it));
tidata_tofit(end+1:end+length(idata)) = cmz.ti.data(idata,it_cmz(it));
vrotdata_tofit(end+1:end+length(idata)) = cmz.vrot.data(idata,it_cmz(it));
tierr_tofit(end+1:end+length(idata)) = cmz.ti.error_bar(idata,it_cmz(it))./ticoeff_err_cmz;
vroterr_tofit(end+1:end+length(idata)) = cmz.vrot.error_bar(idata,it_cmz(it))./vrotcoeff_err_cmz;
rhotor_data_tofit(end+1:end+length(idata)) = cmz.rhotornorm(idata,it_cmz(it));
tidata_tofit(end+1:end+length(idata)) = cmz.ti.data(idata,it_cmz(it));
vrotdata_tofit(end+1:end+length(idata)) = cmz.vrot.data(idata,it_cmz(it));
tierr_tofit(end+1:end+length(idata)) = cmz.ti.error_bar(idata,it_cmz(it))./ticoeff_err_cmz;
vroterr_tofit(end+1:end+length(idata)) = cmz.vrot.error_bar(idata,it_cmz(it))./vrotcoeff_err_cmz;
end
end
rhotor_data_tofit_cmz = cmz.rhotornorm(:,it_cmz);
......@@ -166,4 +166,3 @@ cez_cmz_fit.vrotcoeff_err_cmz = vrotcoeff_err_cmz;
cez_cmz_data.shot = shot;
eval(['save ' filename_withfits ' cez_cmz_fit cez_cmz_data'])
......@@ -5,22 +5,22 @@ function help_struct = aug_help_parameters(parameter_list)
%
% return the whole help structure if parameter_list empty or not provided
%
% do:
% do:
% help_struct = aug_help_parameters(fieldnames(gdat_data.gdat_params));
%
%
% to get relevant help description
%
% Defaults
help_struct_all = struct(...
'data_request', ['automatically filled in by gdat, name of request used in gdat call.' char(10) ...
'contains current list of keywords if gdat called with no arguments: aa=gdat;' char(10) ...
'Note shot value should not be in params so params can be used to load same data from another shot'] ...
,'machine', 'machine name like ''TCV'', ''AUG'', case insensitive' ...
,'doplot', '0 (default), if 1 calls gdat_plot for a new figure, -1 plot over current figure with hold all, see gdat_plot for details' ...
,'liuqe','liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. or -1 for model values' ...
,'nverbose','1 (default) displays warnings, 0: only errors, >=3: displays all extra information' ...
);
'data_request', ['automatically filled in by gdat, name of request used in gdat call.' char(10) ...
'contains current list of keywords if gdat called with no arguments: aa=gdat;' char(10) ...
'Note shot value should not be in params so params can be used to load same data from another shot'] ...
,'machine', 'machine name like ''TCV'', ''AUG'', case insensitive' ...
,'doplot', '0 (default), if 1 calls gdat_plot for a new figure, -1 plot over current figure with hold all, see gdat_plot for details' ...
,'liuqe','liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. or -1 for model values' ...
,'nverbose','1 (default) displays warnings, 0: only errors, >=3: displays all extra information' ...
);
% AUG related
% $$$ help_struct_all.cxrs_plot = '0 (default) no plots, 1 get plots from CXRS_get_profiles see ''help CXRS_get_profiles'' for k_plot values';
......@@ -31,7 +31,7 @@ help_struct_all.extra_arg_sf2sig = 'extra parameters given to sf2sig type of cal
help_struct_all.special_signal = 'specific parameter,area-base,param-set,time-base signal, can be provided as 4th signal in data_request if explicit. Example: ''special_signal'',''param:gyro_freq''';
help_struct_all.fit_tension = ['smoothing value used in interpos fitting routine, -30 means ''30 times default value'', thus -1 often a' ...
' good value' char(10) ...
'cxrs, nete: if numeric, default for all cases, if structure, default for non given fields'];
'cxrs, nete: if numeric, default for all cases, if structure, default for non given fields'];
help_struct_all.time = 'time(s) value(s) if relevant, for example eqdsk is provided by default only for time=1.0s';
% $$$ help_struct_all.zshift = 'vertical shift of equilibrium, either for eqdsk (1 to shift to zaxis=0) or for mapping measurements on to rho surfaces [m]';
help_struct_all.cocos = ['cocos value desired in output, uses eqdsk_cocos_transform. Note should use latter if a specific Ip and/or B0 sign' ...
......@@ -41,8 +41,8 @@ help_struct_all.fit = '0, no fit profiles, 1 (default) if fit profiles desired a
help_struct_all.fit_type = 'type of fits ''std'' (default) uses diagnostic error bars, ''pedestal'', uses manual error bars with smaller values outside 0.8';
help_struct_all.fit_nb_rho_points = 'nb of points for the radial mesh over which the fits are evaluated for the fitted profiles, it uses an equidistant mesh at this stage';
help_struct_all.source = ['sxr: ''G'' (default, with ssx), camera name ''J'', ''G'', ...[F-M], case insensitive;' char(10) ...
'cxrs: ''CEZ'' (default), ''CMZ'',''CUZ'',''COZ'',''all'';' char(10) ...
'raptor: ''observer'', ''predictive'' (or ''obs'', ''pre'') to restrict the ouput to these signals'];
'cxrs: ''CEZ'' (default), ''CMZ'',''CUZ'',''COZ'',''all'';' char(10) ...
'raptor: ''observer'', ''predictive'' (or ''obs'', ''pre'') to restrict the ouput to these signals'];
help_struct_all.source_exp_name = ['ne_rho, te_rho, nete_rho for fit from TRA source typically or IDA when expname not the same as formain signal'];
help_struct_all.camera = ['[] (default, all), [i1 i2 ...] chord nbs ([1 3 5] if only chords 1, 3 and 5 are desired), ''central'' uses J_049'];
help_struct_all.freq = '''slow'', default (means ssx, 500kHz), lower sampling; ''fast'' full samples 2MHz; integer value nn for downsampling every nn''th points';
......
This diff is collapsed.
This diff is collapsed.
......@@ -28,7 +28,7 @@ if nargin >= 2
h_for_waitfor=figure;
global field_chosen
h1=uicontrol('Style','listbox','string',tb_fields,'pos',[20 20 200 300],'Max',20, ...
'callback', ['global field_chosen;field_chosen=get(gcbo,''value'') ;']);
'callback', ['global field_chosen;field_chosen=get(gcbo,''value'') ;']);
h2=uicontrol('Style','text','pos',[20 330 200 30],'string','choose fields to plot (ctrl-enter for multiple choices) then quit');
h3=uicontrol('Style','pushbutton','string','quit','pos',[300 20 30 20],'callback', ['close gcf;']);
waitfor(h_for_waitfor);
......
......@@ -90,15 +90,15 @@ time_base=false;
time_base_name=[];
time_base_dimof=[];
if nargin_eff>=7 && ~isempty(varargin_eff{3}) && ischar(varargin_eff{3}) ...
&& length(varargin_eff{3})>=7 && strcmp(lower(varargin_eff{3}(1:6)),'param:')
&& length(varargin_eff{3})>=7 && strcmp(lower(varargin_eff{3}(1:6)),'param:')
param_name=varargin_eff{3}(7:end);
end
if nargin_eff>=7 && ~isempty(varargin_eff{3}) && ischar(varargin_eff{3}) ...
&& length(varargin_eff{3})>=11 && strcmp(lower(varargin_eff{3}(1:10)),'param-set:')
&& length(varargin_eff{3})>=11 && strcmp(lower(varargin_eff{3}(1:10)),'param-set:')
param_set_name=varargin_eff{3}(11:end);
end
if nargin_eff>=7 && ~isempty(varargin_eff{3}) && ischar(varargin_eff{3}) ...
&& length(varargin_eff{3})>=9 && strcmp(lower(varargin_eff{3}(1:9)),'area-base')
&& length(varargin_eff{3})>=9 && strcmp(lower(varargin_eff{3}(1:9)),'area-base')
area_base = true;
ij=findstr(varargin_eff{3},':');
if length(ij)==2
......@@ -109,7 +109,7 @@ if nargin_eff>=7 && ~isempty(varargin_eff{3}) && ischar(varargin_eff{3}) ...
end
end
if nargin_eff>=7 && ~isempty(varargin_eff{3}) && ischar(varargin_eff{3}) ...
&& length(varargin_eff{3})>=9 && strcmp(lower(varargin_eff{3}(1:9)),'time-base')
&& length(varargin_eff{3})>=9 && strcmp(lower(varargin_eff{3}(1:9)),'time-base')
time_base = true;
ij=findstr(varargin_eff{3},':');
if length(ij)==2
......@@ -166,7 +166,7 @@ if usemdsplus
if isempty(param_name) && isempty(param_set_name) && ~area_base && ~time_base
% use augsignal to get effective layout as in ISIS and sf2sig, for example for EQI/PFM
eval(['[data,error]=mdsvalue(''_rdaeff' user diagname '=augsignal(' num2str(shot) ',"' diagname '","' sigtype '","' shotfile_exp ...
'",' ed_number ',' tstart ',' tend ',_oshot' user diagname ',_oed' user diagname ',' ask_raw ')'');']);
'",' ed_number ',' tstart ',' tend ',_oshot' user diagname ',_oed' user diagname ',' ask_raw ')'');']);
if isnumeric(data)
data=double(data);
end
......@@ -242,42 +242,42 @@ if usemdsplus
if prod(ss)==length(data); nbofdim=1; end
nbofdim=max(nbofdim,1);
switch nbofdim
case 1
adata.data=reshape(adata.data,1,length(adata.data));
idim0 = 0;
eval(['time=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim0) ')'');']);
if numel(time) ~= numel(adata.data)
idim0 = 1;
case 1
adata.data=reshape(adata.data,1,length(adata.data));
idim0 = 0;
eval(['time=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim0) ')'');']);
if numel(time) ~= numel(adata.data) && (ischar(adata.data) && isempty(strfind(lower(adata.data),'abort')))
warning(['problem with dim for: ' diagname ', ' sigtype])
if numel(time) ~= numel(adata.data)
idim0 = 1;
eval(['time=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim0) ')'');']);
if numel(time) ~= numel(adata.data) && (ischar(adata.data) && isempty(strfind(lower(adata.data),'abort')))
warning(['problem with dim for: ' diagname ', ' sigtype])
end
end
end
time = reshape(time,1,length(time));
x=[];
adata.dim = {time};
eval(['tunits=mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim0) '))'');']);
adata.dimunits = {tunits};
case 2
if strcmp(upper(diagname),'IDA') && ~usemdsplus
% rho, time in original dimension, so do not transpose (seems different with mdsplus... to check)
idim_x = 0;
idim_t = 1;
else
adata.data = adata.data';
did_transpose = 1;
idim_x = 1;
idim_t = 0;
end
% transposed because of C relation and backward compatibility with sf2sig part
eval(['x=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim_x) ')'');']);
if prod(size(x))==length(x); x = reshape(x,1,length(x)); end
eval(['time=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim_t) ')'');']);
time = reshape(time,1,length(time));
adata.dim = {x, time};
eval(['xunits=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim_x) '))''));']);
eval(['tunits=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim_t) '))''));']);
adata.dimunits = {xunits, tunits};
time = reshape(time,1,length(time));
x=[];
adata.dim = {time};
eval(['tunits=mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim0) '))'');']);
adata.dimunits = {tunits};
case 2
if strcmp(upper(diagname),'IDA') && ~usemdsplus
% rho, time in original dimension, so do not transpose (seems different with mdsplus... to check)
idim_x = 0;
idim_t = 1;
else
adata.data = adata.data';
did_transpose = 1;
idim_x = 1;
idim_t = 0;
end
% transposed because of C relation and backward compatibility with sf2sig part
eval(['x=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim_x) ')'');']);
if prod(size(x))==length(x); x = reshape(x,1,length(x)); end
eval(['time=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(idim_t) ')'');']);
time = reshape(time,1,length(time));
adata.dim = {x, time};
eval(['xunits=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim_x) '))''));']);
eval(['tunits=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(idim_t) '))''));']);
adata.dimunits = {xunits, tunits};
% $$$ case 3
% $$$ eval(['x=mdsvalue(''dim_of(_rdaeff' user diagname ',0)'');']);
......@@ -307,20 +307,20 @@ if usemdsplus
% $$$ hsigunits = adata.dimunits{ihsig};
% $$$ adata.dimunits = {xunits, tunits, hsigunits};
otherwise
itime = 1; % default
for i=1:nbofdim
eval(['dimarray=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(i-1) ')'');']);
if prod(size(dimarray)) == length(dimarray)
eval(['adata.dim{' num2str(i) '}=reshape(dimarray,1,length(dimarray));']);
else
otherwise
itime = 1; % default
for i=1:nbofdim
eval(['dimarray=mdsvalue(''dim_of(_rdaeff' user diagname ',' num2str(i-1) ')'');']);
if prod(size(dimarray)) == length(dimarray)
eval(['adata.dim{' num2str(i) '}=reshape(dimarray,1,length(dimarray));']);
else
eval(['adata.dim{' num2str(i) '} = dimarray;']);
end
eval(['adata.dimunits{' num2str(i) '}=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(i-1) '))''));']);
if strcmp(adata.dimunits{i},'s'); itime = i; end
end
eval(['adata.dimunits{' num2str(i) '}=deblank(mdsvalue(''units_of(dim_of(_rdaeff' user diagname ',' num2str(i-1) '))''));']);
if strcmp(adata.dimunits{i},'s'); itime = i; end
end
x = adata.dim{min(setdiff([1:2],itime))};
time = adata.dim{itime};
x = adata.dim{min(setdiff([1:2],itime))};
time = adata.dim{itime};
end
adata.value = adata.data; % for backward compatibility might need to keep .value, to be checked later, .data for sure
......@@ -346,7 +346,7 @@ else
else
[adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype,'-exp',shotfile_exp);
end
adata.data = adata.value; % at this stage keep both but try to work only on .data
adata.data = adata.value; % at this stage keep both but try to work only on .data
catch ME
throw(ME)
end
......@@ -358,7 +358,7 @@ else
else
[adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype,[time_int(1);time_int(end)],'-exp',shotfile_exp);
end
adata.data = adata.value; % at this stage keep both but try to work only on .data (for adata which can be from sf2.. or mds)
adata.data = adata.value; % at this stage keep both but try to work only on .data (for adata which can be from sf2.. or mds)
catch ME
throw(ME)
end
......@@ -444,13 +444,13 @@ else
end
end
adata.units = adata.unit;
elseif isempty(param_set_name) && ~area_base && ~time_base
elseif isempty(param_set_name) && ~area_base && ~time_base
% use sf2par
try
if ~isempty(extra_arg_sf2sig) && ~strcmp(extra_arg_sf2sig,'[]')
eval(['[adata]=sf2par(diagname,shot,param_name,sigtype,''-exp'',shotfile_exp,' extra_arg_sf2sig ');']);
eval(['[adata]=sf2par(diagname,shot,param_name,sigtype,''-exp'',shotfile_exp,' extra_arg_sf2sig ');']);
else
eval(['[adata]=sf2par(diagname,shot,param_name,sigtype,''-exp'',shotfile_exp);']);
eval(['[adata]=sf2par(diagname,shot,param_name,sigtype,''-exp'',shotfile_exp);']);
end
adata.data = adata.value;
catch ME
......@@ -460,9 +460,9 @@ elseif isempty(param_set_name) && ~area_base && ~time_base
% use sf2ps
try
if ~isempty(extra_arg_sf2sig) && ~strcmp(extra_arg_sf2sig,'[]')
eval(['[adata]=sf2ps(diagname,shot,param_set_name,sigtype,''-exp'',shotfile_exp,' extra_arg_sf2sig ');']);
eval(['[adata]=sf2ps(diagname,shot,param_set_name,sigtype,''-exp'',shotfile_exp,' extra_arg_sf2sig ');']);
else
eval(['[adata]=sf2ps(diagname,shot,param_set_name,sigtype,''-exp'',shotfile_exp);']);
eval(['[adata]=sf2ps(diagname,shot,param_set_name,sigtype,''-exp'',shotfile_exp);']);
end
adata.data = adata.value;
catch ME
......
......@@ -4,7 +4,7 @@ function [torbeam_out_struct, file_out_prefix]=run_torbeam_fullshot(shot,varargi
%
% Run tbdemo, using line command execution of TORBEAM, to run torbeam acroos full shot on reduced time axis
%
% shot: shot number for which to run Torbeam.
% shot: shot number for which to run Torbeam.
% If empty or not given, ask for it
% if negative, assume output file exists, do not re-run TORBEAM and just reads data into structure torbeam_out_struct
%
......@@ -32,13 +32,13 @@ if nargin>=3 && mod(length(varargin),2)==0
for i=1:2:length(varargin)-1
if ~isempty(varargin{i}) && ~isempty(varargin{i+1})
switch lower(varargin{i})
case {'time'}
time_array = varargin{i+1};
case {'file_prefix'}
file_out_prefix = varargin{i+1};
otherwise
disp(['case ' lower(varargin{i}) ' not yet implemented, ask Olivier.Sauter@epfl.ch'])
return
case {'time'}
time_array = varargin{i+1};
case {'file_prefix'}
file_out_prefix = varargin{i+1};
otherwise
disp(['case ' lower(varargin{i}) ' not yet implemented, ask Olivier.Sauter@epfl.ch'])
return
end
end
end
......@@ -74,7 +74,7 @@ if shot>0
else
disp('do not use IDA since shotfile does not seem to exist')
end
for igyro=1:8
filename=[file_out_prefix num2str(igyro) '.dat'];
unix(['rm ' filename ' >& /dev/null']); % since cannot write over an existing file by default
......@@ -84,14 +84,14 @@ if shot>0
if ~isempty(itt)
itt_tok=find(time_array>=pgyro.t(itt(1)) & time_array<=pgyro.t(itt(end)));
if ~isempty(itt_tok)
pgyro_tok=interp1(pgyro.data(itt,igyro),time_array(itt_tok));
disp(['running system ' num2str(igyro) '...']);
for j=1:length(itt_tok)
if pgyro_tok(j)>1e5
[a,b]=unix(['~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm ' dousedcr ' ' dousebetapol ' -eqdiag EQI -usemirror -cdrive 1 >> ' ['.' filename]]); % -exp AUGE
end
end
[a,b]=unix(['egrep -e ''^Shot''' ' .' filename ' > ' filename]);
pgyro_tok=interp1(pgyro.data(itt,igyro),time_array(itt_tok));
disp(['running system ' num2str(igyro) '...']);
for j=1:length(itt_tok)
if pgyro_tok(j)>1e5
[a,b]=unix(['~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm ' dousedcr ' ' dousebetapol ' -eqdiag EQI -usemirror -cdrive 1 >> ' ['.' filename]]); % -exp AUGE
end
end
[a,b]=unix(['egrep -e ''^Shot''' ' .' filename ' > ' filename]);
end
end
end
......@@ -100,16 +100,16 @@ end
for igyro=1:8
try
eval(['[shot_tbnam,tbout{igyro}.shot,time_tbnam,tbout{igyro}.time,gyro_tbnam,tbout{igyro}.gyro,pol_tbnam,tbout{igyro}.pol,tor_tbnam,tbout{igyro}.tor,' ...
'pow_tbnam,tbout{igyro}.pow,r_tbnam,tbout{igyro}.r,z_tbnam,tbout{igyro}.z,rho_tbnam,tbout{igyro}.rhopol_dep,pwr_dep_tbnam,tbout{igyro}.rhopol_pwr_dep,rhopol_cd_dep_tbnam,tbout{igyro}.rhopol_cd_dep,pdens_peak_tbnam,' ...
'tbout{igyro}.pdens_peak,rhopol_pdens_wid_tbnam,tbout{igyro}.rhopol_pdens_width,jcd_peak_tbnam,tbout{igyro}.jcd_peak,rhopol_c_wid_tbnam,tbout{igyro}.rhopol_jcd_width,pni_tbnam,tbout{igyro}.pni,picr_tbnam,tbout{igyro}.picr,prad_tbnam,tbout{igyro}.prad,' ...
'betan_tbnam,tbout{igyro}.betan,ipl_tbnam,tbout{igyro}.ipl,bt_tbnam,tbout{igyro}.bt,a1_tbnam,tbout{igyro}.ampN1,a2_tbnam,tbout{igyro}.ampN2,rhopolntm_tbnam,tbout{igyro}.rhopolntm]=' ...
'textread(''' file_out_prefix num2str(igyro) '.dat'',''%s%d%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f'');']);
'pow_tbnam,tbout{igyro}.pow,r_tbnam,tbout{igyro}.r,z_tbnam,tbout{igyro}.z,rho_tbnam,tbout{igyro}.rhopol_dep,pwr_dep_tbnam,tbout{igyro}.rhopol_pwr_dep,rhopol_cd_dep_tbnam,tbout{igyro}.rhopol_cd_dep,pdens_peak_tbnam,' ...
'tbout{igyro}.pdens_peak,rhopol_pdens_wid_tbnam,tbout{igyro}.rhopol_pdens_width,jcd_peak_tbnam,tbout{igyro}.jcd_peak,rhopol_c_wid_tbnam,tbout{igyro}.rhopol_jcd_width,pni_tbnam,tbout{igyro}.pni,picr_tbnam,tbout{igyro}.picr,prad_tbnam,tbout{igyro}.prad,' ...
'betan_tbnam,tbout{igyro}.betan,ipl_tbnam,tbout{igyro}.ipl,bt_tbnam,tbout{igyro}.bt,a1_tbnam,tbout{igyro}.ampN1,a2_tbnam,tbout{igyro}.ampN2,rhopolntm_tbnam,tbout{igyro}.rhopolntm]=' ...
'textread(''' file_out_prefix num2str(igyro) '.dat'',''%s%d%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f'');']);
% eval(['[gyro_tbnam,tbout{igyro}.gyro,shot_tbnam,tbout{igyro}.shot,time_tbnam,tbout{igyro}.time,pol_tbnam,tbout{igyro}.pol,tor_tbnam,tbout{igyro}.tor,' ...
% 'pow_tbnam,tbout{igyro}.pow,r_tbnam,tbout{igyro}.r,z_tbnam,tbout{igyro}.z,pwr_dep_tbnam,tbout{igyro}.rhopol_pwr_dep,rhopol_cd_dep_tbnam,tbout{igyro}.rhopol_cd_dep,jcd_peak_tbnam,' ...
% 'tbout{igyro}.jcd_peak,rhopol_c_wid_tbnam,tbout{igyro}.rhopol_c_wid,pni_tbnam,tbout{igyro}.pni,picr_tbnam,tbout{igyro}.picr,prad_tbnam,tbout{igyro}.prad,' ...
% 'betan_tbnam,tbout{igyro}.betan,ipl_tbnam,tbout{igyro}.ipl,bt_tbnam,tbout{igyro}.bt,a1_tbnam,tbout{igyro}.a1,a2_tbnam,tbout{igyro}.a2,rhopolntm_tbnam,tbout{igyro}.rhopolntm]=' ...
% 'textread(''' file_out_prefix num2str(igyro) '.dat'',''%s%d%s%d%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f'');']);
% 'betan_tbnam,tbout{igyro}.betan,ipl_tbnam,tbout{igyro}.ipl,bt_tbnam,tbout{igyro}.bt,a1_tbnam,tbout{igyro}.a1,a2_tbnam,tbout{igyro}.a2,rhopolntm_tbnam,tbout{igyro}.rhopolntm]=' ...
% 'textread(''' file_out_prefix num2str(igyro) '.dat'',''%s%d%s%d%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f'');']);
catch
disp(['problems reading file ' file_out_prefix num2str(igyro) '.dat: may be some errors with tbdemo, check file, skipped'])
......@@ -127,11 +127,11 @@ end
% comments for hiytory backup:
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -usedcr -eqdiag EQI -betapol -usemirror -cdrive 1 >> ' ['.' filename]]);
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -usedcr -eqdiag EQI -betapol -usemirror -cdrive 1 >> ' ['.' filename]]);
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm -usedcr -eqdiag EQI -betapol -usemirror -cdrive 1 >> ' ['.' filename]]);
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm -usedcr -eqdiag EQI -betapol -usemirror -cdrive 1 >> ' ['.' filename]]);
% -shot 29672 -time 3.0 -system 5 -batch -ntm -silent -usemirror -cdrive 1
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm -usemirror -cdrive 1 >> ' ['.' filename]]);
% [a,b]=unix(['ssh sxaug21.aug.ipp.mpg.de ~rem/public/tbm_demo/tbmdemo -batch -silent -shot ' num2str(shot) ' -time ' num2str(time_array(itt_tok(j))) ' -system ' num2str(igyro) ' -ntm -usemirror -cdrive 1 >> ' ['.' filename]]);
% [a,b]=unix(['grep -v ''could not''' ' .' filename '| grep -v ''invalid'' | grep -v ''Error'' | egrep -e ''^$'' -v > ' filename]);
function [torbeam_out,torbeam_in,varargout] = torbeam_prepare_inputs_and_run(shot,times_in,varargin);
%
% [torbeam_out,torbeam_in,varargout] = torbeam_prepare_inputs_and_run(shot,times_in,varargin);
%
%
% varargin{1}: torbeam_in (from a previous run, so avoids to reload all the data)
% leave then times_in empty to rerun at all times in torbeam_in.inbeam.t_some_beam_on or select times points from that array
% varargin{2}: source for gdat profiles/equilibrium related: [] (default sources), 'IDA' (IDA/IDE sources), {'TRA','expname'} for TRANSP
......@@ -93,7 +93,7 @@ if doload && (~exist('times_for_torbeam_eff') || isempty(times_for_torbeam_eff))
times_for_torbeam_eff = torbeam_in.nete.fit.t(torbeam_in.nete.fit.t>0);
end
% load beam releated data including theta,phi in torbeam reference
if doload,
if doload,
[torbeam_in.inbeam] = read_ech_py(shot,times_for_torbeam_eff,[],tbangles_source);
times_for_torbeam_eff = torbeam_in.inbeam.t_some_beam_on;
else
......@@ -134,7 +134,7 @@ if doload; disp(['time for reading data: ' num2str(toc)]); end
if doload,
nb_points_prof = 46;
rhofit = linspace(0,1,nb_points_prof)';
tb_par_fields=fieldnames(torbeam_in.inbeam.tb_par);
itime_te = iround_os(torbeam_in.nete.fit.t,times_for_torbeam_eff);
......@@ -202,7 +202,7 @@ if doload,
fprintf(fid,'%14.6f %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f %14.6f\n',eqd_with_b.psi(1:nb_rmesh,1:nb_zmesh));
if mod(nb_rmesh*nb_zmesh,8) ~= 0; fprintf(fid,'\n'); end
fclose(fid);
if isempty(torbeam_in.zeff.data) || torbeam_in.prepare_run_options.zeff_default < 0.
zeff_eff = abs(torbeam_in.prepare_run_options.zeff_default);
else
......@@ -214,10 +214,10 @@ if doload,
torbeam_in.fname{it}.inbeam{ibeam} = fullfile(torbeam_in.dir_torbeam,['inbeam' '_t' num2str(torbeam_in.inbeam.t_some_beam_on(it)) 'g' num2str(ibeam) '.dat']);
[aa,bb]=unix(['cp /afs/ipp-garching.mpg.de/home/o/osauter/TORBEAM/inbeam_default.dat ' torbeam_in.fname{it}.inbeam{ibeam}]);
fid=fopen(torbeam_in.fname{it}.inbeam{ibeam},'a');
fprintf(fid,' xf = %f, ! wave frequency om=2*pi*xf\n',torbeam_in.inbeam.freq(ibeam));
fprintf(fid,' nmod = %d, ! mode selection: O-mode (1), X-mode (-1)\n',torbeam_in.inbeam.rfmod(ibeam));
fprintf(fid,' xtordeg = %f, ! geom. optics injection angle\n',torbeam_in.inbeam.phi_t(ibeam,it_inb(it)));
fprintf(fid,' xpoldeg = %f, ! geom. optics injection angle\n',torbeam_in.inbeam.theta_t(ibeam,it_inb(it)));
fprintf(fid,' xf = %f, ! wave frequency om=2*pi*xf\n',torbeam_in.inbeam.freq(ibeam));
fprintf(fid,' nmod = %d, ! mode selection: O-mode (1), X-mode (-1)\n',torbeam_in.inbeam.rfmod(ibeam));
fprintf(fid,' xtordeg = %f, ! geom. optics injection angle\n',torbeam_in.inbeam.phi_t(ibeam,it_inb(it)));
fprintf(fid,' xpoldeg = %f, ! geom. optics injection angle\n',torbeam_in.inbeam.theta_t(ibeam,it_inb(it)));
% may be position and curvature, but get defaults from tb_gui. Check with tb_gui how several launchers are given
for i=1:length(tb_par_fields)
fprintf(fid,[' ' tb_par_fields{i} ' = %f,\n'],torbeam_in.inbeam.tb_par.(tb_par_fields{i})(ibeam));
......@@ -230,7 +230,7 @@ if doload,
end
disp(['time for creating all input files: ' num2str(toc)])
end
% run TORBEAM
current_dir = pwd;
eval(['cd ' torbeam_in.dir_torbeam])
......
......@@ -5,9 +5,9 @@ function help_struct = d3d_help_parameters(parameter_list)
%
% return the whole help structure if parameter_list empty or not provided
%
% do:
% do:
% help_struct = d3d_help_parameters(fieldnames(gdat_data.gdat_params));
%
%
% to get relevant help description
%
......@@ -29,7 +29,7 @@ help_struct_all = struct(...
% $$$ ' as well'];
help_struct_all.fit_tension = ['smoothing value used in interpos fitting routine, -30 means ''30 times default value'', thus -1 often a' ...
' good value' char(10) ...
'cxrs, nete: if numeric, default for all cases, if structure, default for non given fields'];
'cxrs, nete: if numeric, default for all cases, if structure, default for non given fields'];
help_struct_all.time = 'time(s) value(s) if relevant, for example eqdsk is provided by default only for time=1.0s';
% $$$ help_struct_all.zshift = 'vertical shift of equilibrium, either for eqdsk (1 to shift to zaxis=0) or for mapping measurements on to rho surfaces [m]';
help_struct_all.cocos = ['cocos value desired in output, uses eqdsk_cocos_transform. Note should use latter if a specific Ip and/or B0 sign' ...
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,7 +55,7 @@ for ii = 1:numel(tmp.names)
% Remove strange character in coil names
IDS_out.pf_active.coil{jj}.name = regexprep(IDS_out.pf_active.coil{jj}.name,'[\n\r]+','');
if strcmp(tmp.names{ii},IDS_out.pf_active.coil{jj}.name)
if isempty(IDS_out.pf_active.coil{jj}.element); IDS_out.pf_active.coil{jj}.element(1) = pf_active_default.coil{1}.element(1); end
if isempty(IDS_out.pf_active.coil{jj}.element); IDS_out.pf_active.coil{jj}.element(1) = pf_active_default.coil{1}.element(1); end
IDS_out.pf_active.coil{jj}.element{1}.geometry.geometry_type = 2; % Rectangle description
IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.r = tmp.R(ii);
IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.z = tmp.Z(ii);
......@@ -77,10 +77,10 @@ IDS_out.pf_active.time = [];
IDS_out.pf_active.ids_properties.homogeneous_time = 0;
if Ncircuit_eff > Ncircuit_in
IDS_out.pf_active.circuit(Ncircuit_in+1:Ncircuit_eff,1) = pf_active_default.circuit(1);
end
end
if Ncircuit_eff > Nsupply_in
IDS_out.pf_active.supply(Nsupply_in+1:Ncircuit_eff,1) = pf_active_default.supply(1);
end
end
for ii=1:Ncircuit_eff
IDS_out.pf_active.circuit{ii}.name = tmp{ii,1}{1};
IDS_out.pf_active.supply{ii}.name = tmp{ii,1}{1};
......@@ -95,16 +95,16 @@ for ii=1:Ncircuit_eff
% The coils must share the same current in the circuit so just take the first one.
IDS_out.pf_active.circuit{ii}.current.data = IDS_out.pf_active.coil{index_coil(1)}.current.data/IDS_out.pf_active.coil{index_coil(1)}.element{1}.turns_with_sign;
IDS_out.pf_active.circuit{ii}.current.time = IDS_out.pf_active.coil{index_coil(1)}.current.time;
IDS_out.pf_active.circuit{ii}.connections = zeros(2*numel(index_coil) -1 , 2*Ncircuit_eff + 2*Ncoils);
for jj = 1:numel(index_coil)
IDS_out.pf_active.circuit{ii}.connections( jj , 2*Ncircuit_eff + 2*(index_coil(jj)-1) +1) = 1;
IDS_out.pf_active.circuit{ii}.connections( jj +1 , 2*Ncircuit_eff + 2*(index_coil(jj)-1) +2) = 1;
end
% Add the connection to the power supply
IDS_out.pf_active.circuit{ii}.connections(1, 2*ii -1) = 1;
IDS_out.pf_active.circuit{ii}.connections(end, 2*ii ) =1;
IDS_out.pf_active.circuit{ii}.connections(1, 2*ii -1) = 1;
IDS_out.pf_active.circuit{ii}.connections(end, 2*ii ) =1;
end
%% Limiter description
......
function data_struct = data_limiter()
% Data from
%Plasma facing line of First Wall and Divertor
%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]
% Data from
%Plasma facing line of First Wall and Divertor
%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]
R = [...
4.1761
......
function vessel_data = data_vessel()
% Plasma facing line of First Wall and Divertor
%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]
% Plasma facing line of First Wall and Divertor
%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]
rin = [ ...
......
......@@ -211,7 +211,7 @@ if (nargin>=ivarargin_first_char)
if mod(nargin-ivarargin_first_char+1,2)==0
for i=1:2:nargin-ivarargin_first_char+1
if ischar(varargin_eff{i})
gdat_params.(lower(varargin_eff{i})) = varargin_eff{i+1}; % cannot enforce lower(params value) if filename or else are case sensitive
gdat_params.(lower(varargin_eff{i})) = varargin_eff{i+1}; % cannot enforce lower(params value) if filename or else are case sensitive
else
if gdat_params.nverbose>=1; warning(['input argument nb: ' num2str(i) ' is incorrect, expects a character string']); end
error_status=401;
......@@ -286,7 +286,7 @@ if do_mdsopen_mdsclose
end
try
gdat_data.gdat_params.idx_imas_open_env = imas_open_env('ids', shot, gdat_data.gdat_params.run,gdat_data.gdat_params.database_user, ...
gdat_data.gdat_params.tokamak_name,gdat_data.gdat_params.data_major_version);
gdat_data.gdat_params.tokamak_name,gdat_data.gdat_params.data_major_version);
disp('')
catch ME
warning('could not imas_open_env with following gdat_data.gdat_params:');
......@@ -304,16 +304,16 @@ else
if isfield(gdat_data.gdat_params,'idx_imas_open_env')
if gdat_data.gdat_params.idx_imas_open_env < 0
if gdat_data.gdat_params.nverbose>=1
warning(['idx < 0, shot/run not opened properly with gdat_data.gdat_params:']);
gdat_data.gdat_params
warning(['idx < 0, shot/run not opened properly with gdat_data.gdat_params:']);
gdat_data.gdat_params
end
return
end
else
if ~isempty(shot)
if gdat_data.gdat_params.nverbose>=1
warning(['no idx in gdat_params, cannot open shot with gdat_data.gdat_params:']);
gdat_data.gdat_params
warning(['no idx in gdat_params, cannot open shot with gdat_data.gdat_params:']);
gdat_data.gdat_params
end
return
end
......@@ -389,167 +389,167 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
% First the request names valid for "all" machines:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'ids'}
ids_empty_path = fullfile(fileparts(mfilename('fullpath')),'..','IMAS_IMAS','ids_empty');
case {'ids'}
ids_empty_path = fullfile(fileparts(mfilename('fullpath')),'..','IMAS_IMAS','ids_empty');
params_eff = gdat_data.gdat_params;
if isfield(params_eff,'source') && ~isempty(params_eff.source)
ids_top_names = params_eff.source;
if ischar(ids_top_names); ids_top_names = {ids_top_names}; end
else
ids_top_name = [];
warning('gdat:EmptyIDSName','Need an ids name in ''source'' parameter\n check substructure gdat_params.sources_available for an ids list');
addpath(ids_empty_path);
assert(~~exist('ids_list','file'),'could not find ids_list.m in %s',ids_empty_path);
gdat_data.gdat_params.sources_available = ids_list;
rmpath(ids_empty_path);
return
end
if ~isfield(params_eff,'fix_homogeneous') || isempty(params_eff.fix_homogeneous)
params_eff.fix_homogeneous = 0;
gdat_data.gdat_params.fix_homogeneous = params_eff.fix_homogeneous;
end
ids_gen_ok = ~~exist('ids_gen','file');
if ~isfield(gdat_data.gdat_params,'error_bar') || isempty(gdat_data.gdat_params.error_bar)
gdat_data.gdat_params.error_bar = 'delta';
end
if ~isfield(gdat_data.gdat_params,'cocos_in') || isempty(gdat_data.gdat_params.cocos_in)
gdat_data.gdat_params.cocos_in = 11;
end
if ~isfield(gdat_data.gdat_params,'cocos_out') || isempty(gdat_data.gdat_params.cocos_out)
gdat_data.gdat_params.cocos_out = 11;
end
if ~isfield(gdat_data.gdat_params,'ipsign_out') || isempty(gdat_data.gdat_params.ipsign_out)
gdat_data.gdat_params.ipsign_out = 0;
end
if ~isfield(gdat_data.gdat_params,'b0sign_out') || isempty(gdat_data.gdat_params.b0sign_out)
gdat_data.gdat_params.b0sign_out = 0;
end
if ~isfield(gdat_data.gdat_params,'ipsign_in') || isempty(gdat_data.gdat_params.ipsign_in)
if gdat_data.gdat_params.ipsign_out~=0
gdat_data.gdat_params.ipsign_in = -1;
params_eff = gdat_data.gdat_params;
if isfield(params_eff,'source') && ~isempty(params_eff.source)
ids_top_names = params_eff.source;
if ischar(ids_top_names); ids_top_names = {ids_top_names}; end
else
gdat_data.gdat_params.ipsign_in = 0;
ids_top_name = [];
warning('gdat:EmptyIDSName','Need an ids name in ''source'' parameter\n check substructure gdat_params.sources_available for an ids list');
addpath(ids_empty_path);
assert(~~exist('ids_list','file'),'could not find ids_list.m in %s',ids_empty_path);
gdat_data.gdat_params.sources_available = ids_list;
rmpath(ids_empty_path);
return
end
end
if ~isfield(gdat_data.gdat_params,'b0sign_in') || isempty(gdat_data.gdat_params.b0sign_in)
if gdat_data.gdat_params.b0sign_out~=0
gdat_data.gdat_params.b0sign_in = -1;
else
gdat_data.gdat_params.b0sign_in = 0;
if ~isfield(params_eff,'fix_homogeneous') || isempty(params_eff.fix_homogeneous)
params_eff.fix_homogeneous = 0;
gdat_data.gdat_params.fix_homogeneous = params_eff.fix_homogeneous;
end
end
for i=1:length(ids_top_names)
ids_top_name = ids_top_names{i};
if ids_gen_ok
ids_empty = ids_gen(ids_top_name); % generate ids from ids_gen
else
% load empty ids structure from template file
fname = sprintf('ids_empty_%s',ids_top_name);
try
assert(~~exist(ids_empty_path,'dir'),'folder %s not found',ids_empty_path);
addpath(ids_empty_path);
assert(~~exist(fname,'file'),'file %s does not exist in %s',fname,ids_empty_path);
ids_empty = eval(fname);
disp(['use structure in .mat file: ' ids_empty_path '/' fname]);
rmpath(ids_empty_path);
catch ME
fprintf('Could not load empty template for %s\n',ids_top_name);
fprintf('Available templates:\n');
disp(dir(ids_empty_path));
rmpath(ids_empty_path);
rethrow(ME);
end
ids_gen_ok = ~~exist('ids_gen','file');
if ~isfield(gdat_data.gdat_params,'error_bar') || isempty(gdat_data.gdat_params.error_bar)
gdat_data.gdat_params.error_bar = 'delta';
end
% load data
try
if isfield(gdat_data.gdat_params,'idx_imas_open_env') && gdat_data.gdat_params.idx_imas_open_env >= 0
if gdat_data.gdat_params.occurence == 0
ids_top = ids_get(gdat_data.gdat_params.idx_imas_open_env,ids_top_name);
else
ids_top = ids_get(gdat_data.gdat_params.idx_imas_open_env,[ids_top_name '/' num2str(gdat_data.gdat_params.occurence)]);
end
gdat_data.(ids_top_name) = ids_top;
else
gdat_data.(ids_top_name) = ids_empty;
return
end
catch ME_imas_ids_get
disp(['there is a problem with: imas_get_ids_' ids_top_name ...
' , may be check if it exists in your path or test it by itself'])
gdat_data.(ids_top_name) = ids_empty;
gdat_data.([ids_top_name '_help']) = getReport(ME_imas_ids_get);
rethrow(ME_imas_ids_get)
if ~isfield(gdat_data.gdat_params,'cocos_in') || isempty(gdat_data.gdat_params.cocos_in)
gdat_data.gdat_params.cocos_in = 11;
end
% check homogeneous
switch gdat_data.(ids_top_name).ids_properties.homogeneous_time
case -999999999
warning([ids_top_name '.ids_properties.homogeneous_time is not defined']);
if isempty(gdat_data.(ids_top_name).time)
if gdat_data.gdat_params.fix_homogeneous
gdat_data.(ids_top_name).ids_properties.homogeneous_time = 0;
warning([ids_top_name '.ids_properties.homogeneous_time set to 0 since .time empty']);
end
elseif isfinite(gdat_data.(ids_top_name).time)
if gdat_data.gdat_params.fix_homogeneous
gdat_data.(ids_top_name).ids_properties.homogeneous_time = 1;
warning([ids_top_name '.ids_properties.homogeneous_time set to 1 since .time finite']);
end
end
case 0
if ~isempty(gdat_data.(ids_top_name).time)
disp([ids_top_name '.ids_properties.homogeneous_time=0 but .time not empty, to check'])
end
case 1
if isempty(gdat_data.(ids_top_name).time)
disp([ids_top_name '.ids_properties.homogeneous_time=1 but .time empty, to check'])
end
otherwise
warning([ids_top_name '.ids_properties.homogeneous_time = ' num2str(gdat_data.(ids_top_name).ids_properties.homogeneous_time) ...
' not sure what to check'])
if ~isfield(gdat_data.gdat_params,'cocos_out') || isempty(gdat_data.gdat_params.cocos_out)
gdat_data.gdat_params.cocos_out = 11;
end
% Perform cocos transformation if cocos_out ~= cocos_in
if gdat_data.gdat_params.cocos_in ~= gdat_data.gdat_params.cocos_out
[ids_out,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(gdat_data.(ids_top_name),ids_top_name, ...
gdat_data.gdat_params.cocos_in, gdat_data.gdat_params.cocos_out, gdat_data.gdat_params.ipsign_out,gdat_data.gdat_params.b0sign_out, ...
gdat_data.gdat_params.ipsign_in, gdat_data.gdat_params.b0sign_in);
gdat_data.(ids_top_name) = ids_out;
if ~isfield(gdat_data.gdat_params,'ipsign_out') || isempty(gdat_data.gdat_params.ipsign_out)
gdat_data.gdat_params.ipsign_out = 0;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'eqdsk'}
% add defaults
if ~isfield(gdat_data.gdat_params,'time')
gdat_data.gdat_params.time = 1.; % default time
end
if ~isfield(gdat_data.gdat_params,'write')
gdat_data.gdat_params.write = 1; % default write eqdsk to /tmp/username
end
params_eff = gdat_data.gdat_params;
params_eff = rmfield(params_eff,'time');
params_eff.data_request = 'ids';
params_eff.source = 'equilibrium';
gdat_equil = gdat_imas(shot,params_eff);
params_eff.source = 'wall';
gdat_wall = gdat_imas(shot,params_eff);
%
eqdsk_filename_suffix = [num2str(gdat_data.shot) '_' num2str(gdat_data.gdat_params.run) 't' num2str(gdat_data.gdat_params.time) ...
gdat_data.gdat_params.tokamak_name '_' gdat_data.gdat_params.database_user];
[eqdsk_out] = ids2eqdsk(gdat_equil.equilibrium,gdat_wall.wall,gdat_data.gdat_params.time,eqdsk_filename_suffix,gdat_data.gdat_params.write);
gdat_data.equilibrium = gdat_equil.equilibrium;
gdat_data.wall = gdat_wall.wall;
gdat_data.eqdsk = eqdsk_out;
if isfield(gdat_data.gdat_params,'doplot') && gdat_data.gdat_params.doplot == 1
plot_eqdsk(gdat_data.eqdsk)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
otherwise
if (gdat_params.nverbose>=1); warning(['switchcase= ' data_request_eff ' not known in gdat_imas']); end
error_status=901;
return
if ~isfield(gdat_data.gdat_params,'b0sign_out') || isempty(gdat_data.gdat_params.b0sign_out)
gdat_data.gdat_params.b0sign_out = 0;
end
if ~isfield(gdat_data.gdat_params,'ipsign_in') || isempty(gdat_data.gdat_params.ipsign_in)
if gdat_data.gdat_params.ipsign_out~=0
gdat_data.gdat_params.ipsign_in = -1;
else
gdat_data.gdat_params.ipsign_in = 0;
end
end
if ~isfield(gdat_data.gdat_params,'b0sign_in') || isempty(gdat_data.gdat_params.b0sign_in)
if gdat_data.gdat_params.b0sign_out~=0
gdat_data.gdat_params.b0sign_in = -1;
else
gdat_data.gdat_params.b0sign_in = 0;
end
end
for i=1:length(ids_top_names)
ids_top_name = ids_top_names{i};
if ids_gen_ok
ids_empty = ids_gen(ids_top_name); % generate ids from ids_gen
else
% load empty ids structure from template file
fname = sprintf('ids_empty_%s',ids_top_name);
try
assert(~~exist(ids_empty_path,'dir'),'folder %s not found',ids_empty_path);
addpath(ids_empty_path);
assert(~~exist(fname,'file'),'file %s does not exist in %s',fname,ids_empty_path);
ids_empty = eval(fname);
disp(['use structure in .mat file: ' ids_empty_path '/' fname]);
rmpath(ids_empty_path);
catch ME
fprintf('Could not load empty template for %s\n',ids_top_name);
fprintf('Available templates:\n');
disp(dir(ids_empty_path));
rmpath(ids_empty_path);
rethrow(ME);
end
end
% load data
try
if isfield(gdat_data.gdat_params,'idx_imas_open_env') && gdat_data.gdat_params.idx_imas_open_env >= 0
if gdat_data.gdat_params.occurence == 0
ids_top = ids_get(gdat_data.gdat_params.idx_imas_open_env,ids_top_name);
else
ids_top = ids_get(gdat_data.gdat_params.idx_imas_open_env,[ids_top_name '/' num2str(gdat_data.gdat_params.occurence)]);
end
gdat_data.(ids_top_name) = ids_top;
else
gdat_data.(ids_top_name) = ids_empty;
return
end
catch ME_imas_ids_get
disp(['there is a problem with: imas_get_ids_' ids_top_name ...
' , may be check if it exists in your path or test it by itself'])
gdat_data.(ids_top_name) = ids_empty;
gdat_data.([ids_top_name '_help']) = getReport(ME_imas_ids_get);
rethrow(ME_imas_ids_get)
end
% check homogeneous
switch gdat_data.(ids_top_name).ids_properties.homogeneous_time
case -999999999
warning([ids_top_name '.ids_properties.homogeneous_time is not defined']);
if isempty(gdat_data.(ids_top_name).time)
if gdat_data.gdat_params.fix_homogeneous
gdat_data.(ids_top_name).ids_properties.homogeneous_time = 0;
warning([ids_top_name '.ids_properties.homogeneous_time set to 0 since .time empty']);
end
elseif isfinite(gdat_data.(ids_top_name).time)
if gdat_data.gdat_params.fix_homogeneous
gdat_data.(ids_top_name).ids_properties.homogeneous_time = 1;
warning([ids_top_name '.ids_properties.homogeneous_time set to 1 since .time finite']);
end
end
case 0
if ~isempty(gdat_data.(ids_top_name).time)
disp([ids_top_name '.ids_properties.homogeneous_time=0 but .time not empty, to check'])
end
case 1
if isempty(gdat_data.(ids_top_name).time)
disp([ids_top_name '.ids_properties.homogeneous_time=1 but .time empty, to check'])
end
otherwise
warning([ids_top_name '.ids_properties.homogeneous_time = ' num2str(gdat_data.(ids_top_name).ids_properties.homogeneous_time) ...
' not sure what to check'])
end
% Perform cocos transformation if cocos_out ~= cocos_in
if gdat_data.gdat_params.cocos_in ~= gdat_data.gdat_params.cocos_out
[ids_out,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(gdat_data.(ids_top_name),ids_top_name, ...
gdat_data.gdat_params.cocos_in, gdat_data.gdat_params.cocos_out, gdat_data.gdat_params.ipsign_out,gdat_data.gdat_params.b0sign_out, ...
gdat_data.gdat_params.ipsign_in, gdat_data.gdat_params.b0sign_in);
gdat_data.(ids_top_name) = ids_out;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'eqdsk'}
% add defaults
if ~isfield(gdat_data.gdat_params,'time')
gdat_data.gdat_params.time = 1.; % default time
end
if ~isfield(gdat_data.gdat_params,'write')
gdat_data.gdat_params.write = 1; % default write eqdsk to /tmp/username
end
params_eff = gdat_data.gdat_params;
params_eff = rmfield(params_eff,'time');
params_eff.data_request = 'ids';
params_eff.source = 'equilibrium';
gdat_equil = gdat_imas(shot,params_eff);
params_eff.source = 'wall';
gdat_wall = gdat_imas(shot,params_eff);
%
eqdsk_filename_suffix = [num2str(gdat_data.shot) '_' num2str(gdat_data.gdat_params.run) 't' num2str(gdat_data.gdat_params.time) ...
gdat_data.gdat_params.tokamak_name '_' gdat_data.gdat_params.database_user];
[eqdsk_out] = ids2eqdsk(gdat_equil.equilibrium,gdat_wall.wall,gdat_data.gdat_params.time,eqdsk_filename_suffix,gdat_data.gdat_params.write);
gdat_data.equilibrium = gdat_equil.equilibrium;
gdat_data.wall = gdat_wall.wall;
gdat_data.eqdsk = eqdsk_out;
if isfield(gdat_data.gdat_params,'doplot') && gdat_data.gdat_params.doplot == 1
plot_eqdsk(gdat_data.eqdsk)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
otherwise
if (gdat_params.nverbose>=1); warning(['switchcase= ' data_request_eff ' not known in gdat_imas']); end
error_status=901;
return
end
else
......@@ -625,7 +625,7 @@ else
end
if ~isempty(tracefirrat.data) && ~ischar(tracefirrat.data) && any(isfinite(tracefirrat.data)) ...
&& ~isempty(tracefirrat.dim) && ~isempty(tracefirrat.dim{1})
&& ~isempty(tracefirrat.dim) && ~isempty(tracefirrat.dim{1})
firthomratio = interp1(tracefirrat.dim{1},tracefirrat.data,timebase);
end
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,11 +7,11 @@ function flux=mapflux_fast(cij,ri,zi,r,z,varargin)
% syntaxe : flux=mapflux(cij,ri,zi,r,z)
%
% entrees :
% cij : coefficients bspline (efit/sspr(nr+nz+1:nr+nz+nc))
% ri : points de controle pour r (efit/sspr(1:nr))
% zi : points de controle pour z (efit/sspr(nr+1:nr+nz))
% r : grille en r pour la carte de flux (vecteur)
% z : grille en z pour la carte de flux (vecteur)
% cij : coefficients bspline (efit/sspr(nr+nz+1:nr+nz+nc))
% ri : points de controle pour r (efit/sspr(1:nr))
% zi : points de controle pour z (efit/sspr(nr+1:nr+nz))
% r : grille en r pour la carte de flux (vecteur)
% z : grille en z pour la carte de flux (vecteur)
%
% varargin{1}=1: output as diagonal of flux to get psin on (R,Z) set of points
% 0: output full matrix (default)
......@@ -21,7 +21,7 @@ function flux=mapflux_fast(cij,ri,zi,r,z,varargin)
% =0: compute all splines (slightly faster when whole grid needed)
%
% sortie :
% flux : matrice donnant le flux normalise sur la grille (r,z)
% flux : matrice donnant le flux normalise sur la grille (r,z)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% auteur : patrick maget
% date : 13/10/2000
......@@ -74,10 +74,10 @@ end
% fonction b-spline
% bki=bspline(ti,t,k,i)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% auteur : patrick maget
% auteur : patrick maget
% date : 14/12/99
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% retourne pour la valeur de i,
% retourne pour la valeur de i,
% le vecteur de poids correspondant au vecteur de demande t
% seuls les elements de t situes entre ti(i) et ti(i+k+1) ont un poids non nul
......
function [r,z,psinrz,sspr,sspi]=psirz(shot,time,nrg,nzg,efitlab,uid,seqd,varargin);
%
% psirz : reconstruction des surfaces de flux
%
%
% ce programme utilise les donnees de efit ou eftm
%
%
% examples:
% [r,z,psinrz,sspr,sspi]=psirz(shot,time,nrg,nzg,[efitlab,uid,seq,ncont]);
% [r,z,psinrz,sspr,sspi]=psirz(50814,60,65,65,[],[],[],60,sspr,sspi); % to get plot and give sspr,sspi
......@@ -11,7 +11,7 @@ function [r,z,psinrz,sspr,sspi]=psirz(shot,time,nrg,nzg,efitlab,uid,seqd,varargi
% entrees :
% shot : numero du choc jet
% time : time de l'analyse
% nrg, nzg: nb de points de la grille en r (resp. en z) sur laquelle on fait la
% nrg, nzg: nb de points de la grille en r (resp. en z) sur laquelle on fait la
% reconstruction des surfaces de flux.
% if nzg is negative, make symmetric box around zero
% varargin{1}: plot option: 0: do not plot contours, >0 plot contour with varargin{1} nb of contours (60 is good)
......@@ -65,7 +65,7 @@ if nargin>=11 & ~isempty(varargin{4})
else
deltaz=0;
end
[x,ind]=min(abs(time-tpefit));
sspr_t=ssprs(:,ind);
sspi_t=sspis(:,ind);
......@@ -122,14 +122,14 @@ function flux=mapflux(cij,ri,zi,r,z)
% syntaxe : flux=mapflux(cij,ri,zi,r,z)
%
% entrees :
% cij : coefficients bspline (efit/sspr(nr+nz+1:nr+nz+nc))
% ri : points de controle pour r (efit/sspr(1:nr))
% zi : points de controle pour z (efit/sspr(nr+1:nr+nz))
% r : grille en r pour la carte de flux (vecteur)
% z : grille en z pour la carte de flux (vecteur)
% cij : coefficients bspline (efit/sspr(nr+nz+1:nr+nz+nc))
% ri : points de controle pour r (efit/sspr(1:nr))
% zi : points de controle pour z (efit/sspr(nr+1:nr+nz))
% r : grille en r pour la carte de flux (vecteur)
% z : grille en z pour la carte de flux (vecteur)
%
% sortie :
% flux : matrice donnant le flux normalise sur la grille (r,z)
% flux : matrice donnant le flux normalise sur la grille (r,z)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% auteur : patrick maget
% date : 13/10/2000
......@@ -149,10 +149,10 @@ flux=fpq;
% fonction b-spline
% bki=bspline(ti,t,k,i)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% auteur : patrick maget
% auteur : patrick maget
% date : 14/12/99
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% retourne pour la valeur de i,
% retourne pour la valeur de i,
% le vecteur de poids correspondant au vecteur de demande t
% seuls les elements de t situes entre ti(i) et ti(i+k+1) ont un poids non nul
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment