iget_datainput_TCV

PURPOSE ^

SYNOPSIS ^

function shotdata = iget_datainput_TCV(diagnames,workdir,opt_gui,style)

DESCRIPTION ^

 GUI or command line inputs for TCV database query

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function shotdata = iget_datainput_TCV(diagnames,workdir,opt_gui,style)
0002 %
0003 % GUI or command line inputs for TCV database query
0004 %
0005 if nargin < 3,
0006     style = struct;
0007 end
0008 if nargin < 2,
0009     opt_gui = true;
0010 end
0011 if nargin < 1,
0012     workdir = pwd;
0013 end
0014 %
0015 if ~isfield(style,'fontname'),
0016     style.fontname = 'Liberation Mono';%get(0,'FixedWidthFontName');%'fixedwidth';% font type
0017 end
0018 if ~isfield(style,'fontsize'),
0019     style.fontsize = 14;% font size
0020 end
0021 %
0022 opt_full = false;
0023 shotdata = struct;
0024 %
0025 ndiag = length(diagnames);
0026 %
0027 % strings
0028 %
0029 timestxt = 'LUKE Simulation time vector. Leave empty to select TS points with Ip > Ipmax/2.';
0030 dtmaxtxt = 'Maximum time range for data averaging. Leave empty to select TS time interval';
0031 iseltxt = 'ECRH launchers : Leave empty to select all launchers (1 -> 9).';
0032 %
0033 if ~opt_full,% simplified interface
0034     %
0035     shotdata.shotnum = 0;
0036     shotdata.times = [];
0037     shotdata.dtmax = [];
0038     shotdata.outputdir = '';
0039     shotdata.isel = [];
0040     shotdata.flagTPG = true;
0041     shotdata.flagFF = true;
0042     shotdata.flagHXR = true;
0043     shotdata.flagZeff = true;
0044     %
0045     shotdata.expert.shotnum = 0;
0046     shotdata.expert.times = 0;
0047     shotdata.expert.dtmax = 1;
0048     shotdata.expert.outputdir = 1;
0049     shotdata.expert.isel = 1;
0050     shotdata.expert.flagTPG = 1;
0051     shotdata.expert.flagFF = 1;
0052     shotdata.expert.flagHXR = 1;
0053     shotdata.expert.flagZeff = 1;
0054     %
0055     shotdata.values.shotnum = [0;Inf];
0056     shotdata.values.times = [0;Inf];
0057     shotdata.values.dtmax = [0;Inf];
0058     shotdata.values.outputdir = '';
0059     shotdata.values.isel = [0;6];%[0;9];%
0060     shotdata.values.flagTPG = {true,false};
0061     shotdata.values.flagFF = {true,false};
0062     shotdata.values.flagHXR = {true,false};
0063     shotdata.values.flagZeff = {true,false};
0064     %
0065     shotdata.info.shotnum = 'Shot number';
0066     shotdata.info.times = timestxt;
0067     shotdata.info.dtmax = dtmaxtxt;
0068     shotdata.info.outputdir = 'Output Directory. Leave empty to use default tmp folder';
0069     shotdata.info.isel = iseltxt;
0070     shotdata.info.flagTPG = 'Option to calculate O/X fraction with TPG function';
0071     shotdata.info.flagFF = 'Option to calculate O/X fraction with FF function';
0072     shotdata.info.flagHXR = 'Option to load HXR data';
0073     shotdata.info.flagZeff = 'Option to load Zeff data';
0074     %
0075     shotdata = imod_struct_jd(shotdata,'shotdata',0,true,shotdata,style);%opt_gui
0076     %
0077 else% full interface
0078     %
0079     % strings
0080     %
0081     cgui.string = 'TCV database query';
0082     timetxt.string = timetxt_string;
0083     timeedit.string = '';
0084     outputdirtxt = 'Output Dir.';
0085     outputdirtxt.string = workdir;
0086     iseledit.string = '';
0087     diagtxt.string = 'Time vector & Output Dir. for each diag. Leave empty to select default values above';
0088     diagtimetxt = 'time vector';
0089     defaultdiagtime = '';
0090     ok.string = 'OK';
0091     reset.string = 'RESET';
0092     %
0093     for idiag = ndiag,
0094         %
0095         diagoutputdirtxt(idiag).string = '';
0096         %
0097     end
0098     %
0099     % callbacks
0100     %
0101     outputdirsel.callback = 'outputdirtxt.string == uigetdir(outputdirtxt.string,''Please select output directory'');';
0102     ok.callback = 'uiresume;';
0103     reset.callback = 'uiresume;';
0104     %
0105     % positions
0106     %
0107     cgui.position
0108     timetxt.position
0109     timeedit.position
0110     outputdirsel.position
0111     outputdirtxt.position
0112     iseltxt.position
0113     iseledit.position
0114     diagtxt.position
0115     ok.position
0116     reset.position
0117     %
0118     for idiag = ndiag,
0119         %
0120         diagtitle(idiag).position
0121         diagtimetxt(idiag).position
0122         diagtimeedit(idiag).position
0123         diagoutputdirsel(idiag).position
0124         diagoutputdirtxt(idiag).position
0125         %
0126     end
0127     %
0128     if opt_gui,% GUI
0129         %
0130         cgui.handle = figure('name',cgui.string,'visible','on','menubar','none','numbertitle','off','resize','off','Position',cgui.position,'toolbar','none','units','pixels');
0131         %
0132         timetxt.handle = uicontrol(cgui,'Style','text','String',timetxt.string,'Position',timetxt.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0133         timeedit.handle = uicontrol(cgui,'Style','edit','String',timeedit.string,'Position',timeedit.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize);
0134         %
0135         outputdirsel.handle = uicontrol(cgui,'Style','pushbutton','String',outputdirtxt,'Position',outputdirsel.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'Callback',outputdirsel.callback);
0136         outputdirtxt.handle = uicontrol(cgui,'Style','text','String',outputdirtxt.string,'Position',outputdirtxt.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0137         %
0138         iseltxt.handle = uicontrol(cgui,'Style','text','String',iseltxt.string,'Position',iseltxt.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0139         iseledit.handle = uicontrol(cgui,'Style','edit','String',iseledit.string,'Position',iseledit.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize);
0140         %
0141         diagtxt.handle = uicontrol(cgui,'Style','text','String',diagtxt.string,'Position',diagtxt.position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0142         %
0143         for idiag = ndiag,
0144             diagtitle(idiag).handle = uicontrol(cgui,'Style','text','String',diagnames{idiag},'Position',diagtitle(idiag).position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0145             %
0146             diagtimetxt(idiag).handle = uicontrol(cgui,'Style','text','String',diagtimetxt,'Position',diagtimetxt(idiag).position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize);
0147             diagtimeedit(idiag).handle = uicontrol(cgui,'Style','edit','String',defaultdiagtime,'Position',diagtimeedit(idiag).position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize);
0148             %
0149             diagoutputdirsel(idiag).handle = uicontrol(cgui,'Style','pushbutton','String',outputdirtxt,'Position',diagoutputdirsel(idiag).position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'Callback',outputdirsel.callback);
0150             diagoutputdirtxt(idiag).handle = uicontrol(cgui,'Style','text','String',diagoutputdirtxt(idiag).string,'Position',diagoutputdirtxt(idiag).position,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize,'HorizontalAlignment','left');
0151         end
0152         %
0153         ok.handle = uicontrol(p,'Style','pushbutton','String',ok.string,'Position',ok.position,'FontName',style.fontname,'FontSize',style.fontsize,'Callback',ok.callback);            
0154         reset.handle = uicontrol(p,'Style','pushbutton','String',reset.string,'Position',reset.position,'FontName',style.fontname,'FontSize',style.fontsize,'Callback',reset.callback);            
0155         %
0156     else
0157         %
0158         % TODO
0159         %
0160     end
0161 end
0162

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.