From dff74a3f842026b29fa9dccdab76d605183832fc Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 29 Sep 2015 14:06:00 +0000
Subject: [PATCH] can have automatically specific parameter helps

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@5071 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/tcv_help_parameters.m | 63 +++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 crpptbx/TCV/tcv_help_parameters.m

diff --git a/crpptbx/TCV/tcv_help_parameters.m b/crpptbx/TCV/tcv_help_parameters.m
new file mode 100644
index 00000000..bbb5f433
--- /dev/null
+++ b/crpptbx/TCV/tcv_help_parameters.m
@@ -0,0 +1,63 @@
+function help_struct = tcv_help_parameters(parameter_list)
+%
+% retrieve from present table the relevant help lines for the parameter_list{:}
+% should come from sqlite database at some point...
+%
+% return the whole help structure if parameter_list empty or not provided
+%
+% do: 
+%      help_struct = tcv_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' ...
+    );
+
+% TCV 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';
+help_struct_all.time_interval = ['if provided sets a specific time interval [tstart tend], assumes 2 values provided to be used.' ...
+                    char(10) 'cxrs: take data and average over this time interval only, plots from CXRS_get_profiles are then provided' ...
+                    ' 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'];
+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 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' ...
+                    'is wanted. See O. Sauter et al Comput. Phys. Commun. 184 (2013) 293'];
+help_struct_all.edge = '0 (default), 1 to get edge Thomson values';
+help_struct_all.fit = '1 if fit profiles desired as well, relevant for _rho profiles. Default is (0). See also fit_type';
+help_struct_all.fit_type = 'provenance of fitted profiles ''conf'' (default) from conf nodes, ''avg'' or ''local'' for resp. proffit: nodes';
+help_struct_all.trialindx = 'value of trialindx desired to get a specific one when relevant, otherwise gets ok_trialindx, that is 1 usually';
+%help_struct_all. = '';
+
+
+if ~exist('parameter_list') || isempty(parameter_list)
+  help_struct = help_struct_all;
+  return
+end
+
+if iscell(parameter_list)
+  parameter_list_eff = parameter_list;
+elseif ischar(parameter_list)
+  % assume only one parameter provided as char string
+  parameter_list_eff{1} = parameter_list;
+else
+  disp(['unknown type of parameter_list in tcv_help_parameters.m'])
+  parameter_list
+  return
+end
+
+fieldnames_all = fieldnames(help_struct_all);
+for i=1:length(parameter_list_eff)
+  if any(strcmp(fieldnames_all,parameter_list_eff{i}))
+    help_struct.(parameter_list_eff{i}) = help_struct_all.(parameter_list_eff{i});
+  end
+end
-- 
GitLab