Changeset 503 in ETALON for SPESO


Ignore:
Timestamp:
Apr 21, 2016, 1:51:52 PM (8 years ago)
Author:
malovyts
Message:

Structurized the offline script

Location:
SPESO/ana2015/offline_analysis
Files:
5 added
10 edited

Legend:

Unmodified
Added
Removed
  • SPESO/ana2015/offline_analysis/make_colormap.m

    r497 r503  
    55colormap_viridis;
    66
    7 magnitude=data;
     7data=data';
    88pos1=y;
    99pos2=x;
     
    1212
    1313       
    14         min_magnitude=min(magnitude(:));
    15         color_coeff=(max(magnitude(:))-min(magnitude(:)));
    16         colors=round((magnitude-min_magnitude)./color_coeff.*255)+1;
     14        min_magnitude=min(min(data));
     15        color_coeff=(max(max(data))-min_magnitude);
     16        colors=round((data-min_magnitude)./color_coeff.*255)+1;
    1717        color_to_magn=@(color_in)((color_in-1)/255*color_coeff+min_magnitude);
    1818       
  • SPESO/ana2015/offline_analysis/offline_analyse_multi.m

    r497 r503  
    1111offline_analysis('2016JanFeb', '20160{30?,2??,1??}.dayFullInfo', 1001); % histo
    1212offline_analysis('2016JanFeb', '20160{30?,2??,1??}.dayFullInfo', 2001); % colorplots
     13offline_analysis('2016JanFebMarch', '20160{3[^1]?,31[^3],2??,1??}.dayFullInfo', 3002); % reseau analysis
    1314
    1415% 2016 04/09 -- 03/09
    1516offline_analysis('2016Mar', '20160{40?,3[^1]?,31[^3]}.dayFullInfo', 2002); % colorplots
    16 offline_analysis('2016Mar', '20160{40?,3[^1]?,31[^3]}.dayFullInfo', 3002); % reseau analysis
    1717
    1818%offline_analysis('1', );
  • SPESO/ana2015/offline_analysis/offline_analyse_reseau.m

    r497 r503  
    1010figures_path=offline_figures_path;
    1111
    12 offline_reseau_html('reseau_positions')
     12offline_reseau_html('main', selection_id)
    1313
    1414% load selections
     
    5050                       
    5151                % "background" (pos_reseau<50000)
    52                 data_select(POS_selection{1}{1}{:});
    53                 data_select(POS_selection{1}{2}{:});
    54                 data_select(POS_selection{2}{1}{:});
    55                 data_select(POS_selection{2}{2}{:});
     52                data_select(POS_selection{1}{3}{:});
     53                data_select(POS_selection{1}{4}{:});
     54                data_select(POS_selection{2}{3}{:});
     55                data_select(POS_selection{2}{4}{:});
    5656                data_select(XPOS_selection{1}{1}{:});
    5757                data_select(XPOS_selection{1}{2}{:});
     
    117117end % function
    118118
    119 function print_fig(fig_handle, fig_name)
    120 %print figure
    121         set(gca,'FontSize',16)
    122         print(fig_handle, '-dpng', '-r300', fig_name);
    123 end
  • SPESO/ana2015/offline_analysis/offline_analysis.m

    r497 r503  
    1414% add path to the SPESO analysis scripts, if this script was called from the offline_analysis folder
    1515addpath('../');
     16addpath('lib_offline');
    1617
    1718%global variables
     
    3738% load data
    3839%date_mask='20160{3[^1]?,31[^3],2??,1??}.dayFullInfo'; % months 01, 02, 03 except day 13th
     40
    3941load_analysis_data(date_mask);
    4042
     
    6163if ((fix(selection_id/1000)==3)||(fix(selection_id/1000)==0))
    6264        %create reseau anlysis plots
    63    offline_histograms(selection_id);
     65   offline_analyse_reseau(selection_id);
    6466end;
    6567
  • SPESO/ana2015/offline_analysis/offline_colorplots.m

    r497 r503  
    77figures_path=offline_figures_path;
    88
     9offline_colorplots_html('main', selection_id)
     10
    911% load selections
    1012data_sel=offline_selection(selection_id);% load selection
     
    1315Y_edges=        data_sel.Y_edges;
    1416Z_edges=        data_sel.Z_edges;
     17
     18X_axis_var=data_sel.X_axis_var;
     19X_axis_edges=data_sel.X_axis_edges;
     20Y_axis_var=data_sel.Y_axis_var;
     21Y_axis_edges=data_sel.Y_axis_edges;
    1522
    1623% save selections in current function
     
    3542LPM_txt = data_sel.LPM_txt;
    3643
    37 if (selection_id==1)||(selection_id==2)
    38 %select positions
    39 end;% selection id
    4044
    4145% make plots
     
    6771
    6872                fih = figure(1)
    69                         det_signal=data_colorplot(dvar.DETECT_SPOS, dvar.DETECT_XPOS, data_types(det_type), Y_edges, X_edges);
     73                        det_signal=data_colorplot(X_axis_var, Y_axis_var, data_types(det_type), X_axis_edges, Y_axis_edges);
    7074                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
    7175                        print_fig(fih, [ figures_path 'signal_' pars_txt '.png' ]);
     
    7983
    8084                fih = figure(1);
    81                         det_BG=data_colorplot(dvar.DETECT_SPOS, dvar.DETECT_XPOS, data_types(det_type), Y_edges, X_edges);
     85                        det_BG=data_colorplot(X_axis_var, Y_axis_var, data_types(det_type), X_axis_edges, Y_axis_edges);
    8286                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
    8387                        print_fig(fih,[ figures_path 'bg_' pars_txt '.png' ]);
     
    9296       
    9397        signal_bg=det_BG.bins(:,:,1);
    94         signal_stat=det_signal.bins(:,:,3)
     98        signal_stat=det_signal.bins(:,:,3);
    9599       
    96100        % data w/o backgroung
    97101                fih = figure(1);
    98102                        make_colormap(signal_vals-signal_bg, x_vals, y_vals);
    99                         xlabel(get_var_name(dvar.DETECT_SPOS));
    100                         ylabel(get_var_name(dvar.DETECT_XPOS));
     103                        xlabel(get_var_name(X_axis_var));
     104                        ylabel(get_var_name(Y_axis_var));
    101105                        title(base_selected_text);
    102106                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
     
    106110                fih = figure(1);
    107111                        make_colormap(signal_stat, x_vals, y_vals);
    108                         xlabel(get_var_name(dvar.DETECT_SPOS));
    109                         ylabel(get_var_name(dvar.DETECT_XPOS));
     112                        xlabel(get_var_name(X_axis_var));
     113                        ylabel(get_var_name(Y_axis_var));
    110114                        title(base_selected_text);
    111115                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
     
    119123end % function
    120124
    121 function print_fig(fig_handle, fig_name)
    122 %print figure
    123         set(gca,'FontSize',16)
    124         print(fig_handle, '-dpng', '-r300', fig_name);
    125 end
  • SPESO/ana2015/offline_analysis/offline_colorplots_html.m

    r497 r503  
    3232
    3333% create menu making JS
    34 if exist('links.js')
    35                 hrefs = fopen('links.js', 'r+');
    36         js_script = fscanf(hrefs, '%s');
    37         hyper_link = ['<a href="' page_link '.html">' page_link_text '</a></br>'];
    38         if isempty(strfind(js_script, ))
    39                  fseek(hrefs, -3, 'eof');
    40                  fprintf(hrefs, '%s'');', hyper_link);
    41         end   
    42         fclose(hrefs);
    43 else
    44                   hrefs = fopen('links.js', 'w');
    45                   fprintf(hrefs, '%s', ['document.write(''<a href="'
    46                                                                                  page_link '.html">'
    47                                                                                  page_link_text '</a></br> '');']);
    48                   fclose(hrefs);
    49 end
     34html_links_list(figures_path, page_link, page_link_text);
    5035
    5136file_id = fopen([figures_path page_link '.html'], 'w');
     
    5540tabstops=0;
    5641
    57 print_tag('HTML')
     42fprintf(file_id, '%s\n', '<!doctype html>');
     43html_print_tag('HTML')
    5844
    59 print_tag('head', '', '');
    60 print_tag('body');
    61 print_tag('H1', '', ['Simulation time:' datestr(now)]);
    62 print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
     45html_print_tag('head', '', '');
     46html_print_tag('body');
     47html_print_tag('H1', '', ['Simulation time:' datestr(now)]);
     48html_print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
    6349
    6450% print links
    65 print_tag('script', 'src="links.js"', '');
     51html_print_tag('script', 'src="links.js"', '');
    6652
    6753% all period statistics
    6854img_name=[ '9plots_monthly.png' ];
    69 print_img(img_name, '400');
     55html_print_img(img_name, '400');
    7056
    71  for LPMloop  =1:length(LPM_selection)
     57 for LPMloop  =1:length(LPM_txt)
    7258  for DetLoop=1:2
    7359               
    7460       
    75         print_tag('table', 'border="2"');
    76         print_tag('tr');
    77         print_tag('td', '', '');
     61        html_print_tag('table', 'border="2"');
     62        html_print_tag('tr');
     63        html_print_tag('td', '', '');
    7864        % QICT labels
    7965        for QICT1loop=1:length(QICT1_txt);
    80            print_tag('td', '', ['Q=' QICT1_txt{QICT1loop}]);
     66           html_print_tag('td', '', ['Q=' QICT1_txt{QICT1loop}]);
    8167   end;% QICT1loop
    82         print_tag('/tr');
     68        html_print_tag('/tr');
    8369
    8470        % signal
    85    print_tag('tr');
    86    print_tag('td', '', [data_names{DetLoop}]);
     71   html_print_tag('tr');
     72   html_print_tag('td', '', [data_names{DetLoop} '<br>' 'Signal']);
    8773   for QICT1loop=1:length(QICT1_txt);
    8874                pars_txt=[LPM_txt{LPMloop}...
    89                          'Det' num2str(DetLoop)...
     75                         '_Det' num2str(DetLoop)...
    9076                         '_Q' QICT1_txt{QICT1loop}...
    9177                         ];
    9278                img_name=[ 'signal_' pars_txt '.png' ];
    93                 print_tag('td');
    94                 print_img(img_name, '400');
    95       print_tag('/td');
     79                html_print_tag('td');
     80                html_print_img(img_name, '400');
     81      html_print_tag('/td');
    9682        end; % QICT1loop
    97    print_tag('/tr');
     83   html_print_tag('/tr');
    9884
    9985        % background
    100    print_tag('tr');
    101    print_tag('td', '', [data_names{DetLoop}]);
     86   html_print_tag('tr');
     87   html_print_tag('td', '', [data_names{DetLoop} '<br>' 'background']);
    10288   for QICT1loop=1:length(QICT1_txt);
    10389                pars_txt=[LPM_txt{LPMloop}...
    104                          'Det' num2str(DetLoop)...
     90                         '_Det' num2str(DetLoop)...
    10591                         '_Q' QICT1_txt{QICT1loop}...
    10692                         ];
    10793                img_name=[ 'bg_' pars_txt '.png' ];
    108                 print_tag('td');
    109                 print_img(img_name, '400');
    110       print_tag('/td');
     94                html_print_tag('td');
     95                html_print_img(img_name, '400');
     96      html_print_tag('/td');
    11197        end; % QICT1loop
    112    print_tag('/tr');
     98   html_print_tag('/tr');
    11399
    114100        % signal w/o background
    115    print_tag('tr');
    116    print_tag('td', '', [data_names{DetLoop}]);
     101   html_print_tag('tr');
     102   html_print_tag('td', '', [data_names{DetLoop} '<br>' 'Signal w/o bg']);
    117103   for QICT1loop=1:length(QICT1_txt);
    118104                pars_txt=[LPM_txt{LPMloop}...
    119                          'Det' num2str(DetLoop)...
     105                         '_Det' num2str(DetLoop)...
    120106                         '_Q' QICT1_txt{QICT1loop}...
    121107                         ];
    122108                img_name=[ 'signal_wo_bg_' pars_txt '.png' ];
    123                 print_tag('td');
    124                 print_img(img_name, '400');
    125       print_tag('/td');
     109                html_print_tag('td');
     110                html_print_img(img_name, '400');
     111      html_print_tag('/td');
    126112        end; % QICT1loop
    127    print_tag('/tr');
     113   html_print_tag('/tr');
    128114
    129115        % number of points in the bins
    130    print_tag('tr');
    131    print_tag('td', '', [data_names{DetLoop}]);
     116   html_print_tag('tr');
     117   html_print_tag('td', '', [data_names{DetLoop} '<br>' 'Number of data points']);
    132118   for QICT1loop=1:length(QICT1_txt);
    133119                pars_txt=[LPM_txt{LPMloop}...
    134                          'Det' num2str(DetLoop)...
     120                         '_Det' num2str(DetLoop)...
    135121                         '_Q' QICT1_txt{QICT1loop}...
    136122                         ];
    137123                img_name=[ 'stat_' pars_txt '.png' ];
    138                 print_tag('td');
    139                 print_img(img_name, '400');
    140       print_tag('/td');
     124                html_print_tag('td');
     125                html_print_img(img_name, '400');
     126      html_print_tag('/td');
    141127        end; % QICT1loop
    142    print_tag('/tr');
     128   html_print_tag('/tr');
    143129
    144         print_tag('/table');
     130        html_print_tag('/table');
    145131  end; % detloop
    146132 end; %LPMloop
    147133
    148 print_tag('/body');
    149 print_tag('/HTML');
     134html_print_tag('/body');
     135html_print_tag('/HTML');
    150136fclose(file_id);
    151137
    152138end % function
    153139
    154 function result_text = print_tag(tagName, tag_params, tag_txt)
    155 % print html tag, with neat tabshifts
    156 % 1 arg - only <tagname>
    157 % 2 args - <tagname tagparams>
    158 % 3 args - <tagname tagparams>tagtxt</tagname>
    159 global prev_tag
    160 global tabstops
    161 global file_id
    162 tabchar='\t';
    163 
    164 if nargin<1
    165         return
    166 end; % if not enough arguments
    167 
    168    if (tagName(1)=='/')&&(length(tagName)==1)
    169                  tabstops=tabstops-2;           
    170          return
    171         end; % shift tabulation to the left
    172 
    173 
    174 if nargin<2
    175         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName '>']);
    176 elseif nargin<3
    177         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    178 else
    179         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    180         fprintf(file_id, [repmat(tabchar,1,tabstops+1) '%s\n'], [tag_txt]);
    181         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['</' tagName '>']);
    182 end;
    183 
    184 if tagName(1)=='/'
    185         tabstops=tabstops-1;           
    186 else
    187         tabstops=tabstops+1;   
    188 end;
    189 
    190 prev_tag=tagName;
    191 end
    192 
    193 function print_img(image_name, width)
    194         % print image with link to itself
    195         print_tag('a', 'href="image_name"');   
    196            print_tag('img', ['src="' image_name '"' ' width="' width '"']);
    197                 print_tag('/');
    198         print_tag('/a');
    199 end
  • SPESO/ana2015/offline_analysis/offline_histograms.m

    r497 r503  
    156156end % function
    157157
    158 function print_fig(fig_handle, fig_name)
    159 %print figure
    160         set(gca,'FontSize',16)
    161         print(fig_handle, '-dpng', '-r300', fig_name);
    162 end
  • SPESO/ana2015/offline_analysis/offline_histograms_html.m

    r497 r503  
    3030 for POSloop  =1:length(POS_txt)
    3131 %print html pages for each POSITION(Z,S)
    32         file_id = fopen([figures_path page_name POS_txt{POSloop} '.html'], 'w');
    3332
    3433        prev_tag='';
    3534        tabstops=0;
    3635
    37         page_link=[page_name POS_txt{linkloop}];
    38         page_link_text=['Position' POS_txt{linkloop}];
     36        page_link=[page_name POS_txt{POSloop}];
     37        page_link_text=['Position' POS_txt{POSloop}];
    3938
    4039        % create menu making JS
    41         if exist('links.js')
    42                         hrefs = fopen('links.js', 'r+');
    43                 js_script = fscanf(hrefs, '%s');
    44                 hyper_link = ['<a href="' page_link '.html">' page_link_text '</a></br>'];
    45                 if isempty(strfind(js_script, ))
    46                          fseek(hrefs, -3, 'eof');
    47                          fprintf(hrefs, '%s'');', hyper_link);
    48                 end   
    49                 fclose(hrefs);
    50         else
    51                           hrefs = fopen('links.js', 'w');
    52                           fprintf(hrefs, '%s', ['document.write(''<a href="'
    53                                                                                          page_link '.html">'
    54                                                                                          page_link_text '</a></br> '');']);
    55                           fclose(hrefs);
    56         end
     40        html_links_list(figures_path, page_link, page_link_text);
    5741
    58         print_tag('HTML')
     42        file_id = fopen([figures_path page_name POS_txt{POSloop} '.html'], 'w');
    5943
    60         print_tag('head', '', '');
    61         print_tag('body');
    62         print_tag('H1', '', ['Simulation time:' datestr(now)]);
    63         print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
     44        fprintf(file_id, '%s\n', '<!doctype html>');
     45        html_print_tag('HTML')
     46
     47        html_print_tag('head', '', '');
     48        html_print_tag('body');
     49        html_print_tag('H1', '', ['Simulation time:' datestr(now)]);
     50        html_print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
    6451
    6552        % print links
    66         print_tag('script', 'src="links.js"', '');
     53        html_print_tag('script', 'src="links.js"', '');
    6754
    6855  img_name=[ '9plots_monthly.png' ];
    69   print_img(img_name, '400');
    70 
    71         % for each detector and signal type type make colorplot
    72         for dataloop = 1:length(data_names);
    73                         img_name=[ 'colorplot_' data_names{dataloop} '.png' ];
    74                         print_img(img_name, '400');
    75         end; % data_loop
     56  html_print_img(img_name, '400');
    7657
    7758  for LPMloop  =1:length(LPM_txt)
     
    8566                params_list='';
    8667
    87           print_tag('table', 'border="2"');
     68          html_print_tag('table', 'border="2"');
    8869
    89      print_tag('tr');
    90           print_tag('td', '','');
     70     html_print_tag('tr');
     71          html_print_tag('td', '','');
    9172     for DetLoop=1:2
    92            print_tag('td', '', ['Det' num2str(DetLoop)]);
     73           html_print_tag('td', '', ['Det' num2str(DetLoop)]);
    9374          end;
    94           print_tag('td', '','');
    95      print_tag('/tr');
     75          html_print_tag('td', '','');
     76     html_print_tag('/tr');
    9677
    97      print_tag('tr');
    98           print_tag('td', '','Scatter');
     78     html_print_tag('tr');
     79          html_print_tag('td', '','Scatter');
    9980     for DetLoop=1:2
    10081                img_name=([ 'scatter_Det' num2str(DetLoop) '_' pars_txt '.png'] );
    101            print_tag('td');
    102            print_img(img_name, '400');
    103            print_tag('/'); % decrease tabstops
    104            print_tag('/td');
     82           html_print_tag('td');
     83           html_print_img(img_name, '400');
     84           html_print_tag('/td');
    10585          end;
    106           print_tag('td', '','');
    107      print_tag('/tr');
     86          html_print_tag('td', '','');
     87     html_print_tag('/tr');
    10888
    109      print_tag('tr');
    110           print_tag('td', '','Histogram');
     89     html_print_tag('tr');
     90          html_print_tag('td', '','Histogram');
    11191     for DetLoop=1:2
    11292                img_name=([ 'hist_Det' num2str(DetLoop) '_' pars_txt '.png'] );
    113            print_tag('td');
    114            print_img(img_name, '400');
    115            print_tag('/'); % decrease tabstops
    116            print_tag('/td');
     93           html_print_tag('td');
     94           html_print_img(img_name, '400');
     95           html_print_tag('/td');
    11796          end;
    118           print_tag('td', '','');
    119      print_tag('/tr');
     97          html_print_tag('td', '','');
     98     html_print_tag('/tr');
    12099               
    121           print_tag('tr');
    122           print_tag('td', '','Comparison');
     100          html_print_tag('tr');
     101          html_print_tag('td', '','Comparison');
    123102                img_name=(['compare_Det1_Det2_' pars_txt '.png' ]);
    124            print_tag('td', 'colspan="2"');
    125            print_img(img_name, '800');
    126       print_tag('/'); % decrease tabstops
    127       print_tag('/td');
    128           print_tag('td', '','');
    129      print_tag('/tr');
     103           html_print_tag('td', 'colspan="2"');
     104           html_print_img(img_name, '800');
     105      html_print_tag('/td');
     106          html_print_tag('td', '','');
     107     html_print_tag('/tr');
    130108
    131      print_tag('tr');
    132           print_tag('td', '','Polar');
     109     html_print_tag('tr');
     110          html_print_tag('td', '','Polar');
    133111     for DetLoop=1:2
    134112                img_name=([ 'polar_Det' num2str(DetLoop) '_' pars_txt '.png'] );
    135            print_tag('td');
    136            print_img(img_name, '400');
    137            print_tag('/'); % decrease tabstops
    138            print_tag('/td');
     113           html_print_tag('td');
     114           html_print_img(img_name, '400');
     115           html_print_tag('/td');
    139116          end;
    140           print_tag('td', '','');
    141      print_tag('tr');
    142           print_tag('/table');
     117          html_print_tag('td', '','');
     118     html_print_tag('/tr');
     119          html_print_tag('/table');
    143120    end;% XPOSloop
    144121   end;% QICT1loop
    145122  end;% LPMloop
    146                   print_tag('/body');
    147                   print_tag('/HTML');
     123                  html_print_tag('/body');
     124                  html_print_tag('/HTML');
    148125                  fclose(file_id);
    149126 end;% POSloop
     
    154131end % function
    155132
    156 function result_text = print_tag(tagName, tag_params, tag_txt)
    157 % print html tag, with neat tabshifts
    158 % 1 arg - only <tagname>
    159 % 2 args - <tagname tagparams>
    160 % 3 args - <tagname tagparams>tagtxt</tagname>
    161 % after single tags it is good to call "print_tag('/');"
    162 global prev_tag
    163 global tabstops
    164 global file_id
    165 tabchar='\t';
    166 
    167 if nargin<1
    168         return
    169 end; % if not enough arguments
    170 
    171    if (tagName(1)=='/')&&(length(tagName)==1)
    172                  tabstops=tabstops-2;           
    173          return
    174         end; % shift tabulation to the left
    175 
    176 
    177 if nargin<2
    178         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName '>']);
    179 elseif nargin<3
    180         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    181 else
    182         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    183         fprintf(file_id, [repmat(tabchar,1,tabstops+1) '%s\n'], [tag_txt]);
    184         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['</' tagName '>']);
    185 end;
    186 
    187 if tagName(1)=='/'
    188         tabstops=tabstops-1;           
    189 else
    190         tabstops=tabstops+1;   
    191 end;
    192 
    193 prev_tag=tagName;
    194 end
    195 
    196 function print_img(image_name, width)
    197         % print image with link to itself
    198         print_tag('a', 'href="image_name"');   
    199            print_tag('img', ['src="' image_name '"' ' width="' width '"']);
    200                 print_tag('/');
    201         print_tag('/a');
    202 end
  • SPESO/ana2015/offline_analysis/offline_reseau_html.m

    r497 r503  
    3131
    3232        % create JS, that prints links
    33         if exist('links.js')
    34                         hrefs = fopen('links.js', 'r+');
    35                 js_script = fscanf(hrefs, '%s');
    36                 hyper_link = ['<a href="' page_link '.html">' page_link_text '</a></br>'];
    37                 if isempty(strfind(js_script, ))
    38                          fseek(hrefs, -3, 'eof');
    39                          fprintf(hrefs, '%s'');', hyper_link);
    40                 end   
    41                 fclose(hrefs);
    42         else
    43                           hrefs = fopen('links.js', 'w');
    44                           fprintf(hrefs, '%s', ['document.write(''<a href="'
    45                                                                                          page_link '.html">'
    46                                                                                          page_link_text '</a></br> '');']);
    47                           fclose(hrefs);
    48         end
     33        html_links_list(figures_path, page_link, page_link_text);
    4934
    50 file_id = fopen([figures_path page_name '.html'], 'w');
     35file_id = fopen([figures_path page_link '.html'], 'w');
    5136
    5237prev_tag='';
    5338tabstops=0;
    5439
    55 print_tag('HTML')
     40fprintf(file_id, '%s\n', '<!doctype html>');
     41html_print_tag('HTML')
    5642
    57 print_tag('head', '', '');
    58 print_tag('body');
    59 print_tag('H1', '', ['Simulation time:' datestr(now)]);
    60 print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
     43html_print_tag('head', '', '');
     44html_print_tag('body');
     45html_print_tag('H1', '', ['Simulation time:' datestr(now)]);
     46html_print_tag('H2', '', ['SVN revision:' svn_revision{1}]);
    6147
    6248% print links
    63 print_tag('script', 'src="links.js"', '');
     49html_print_tag('script', 'src="links.js"', '');
    6450
    6551img_name=[ '9plots_monthly.png' ];
    66 print_img(img_name, '400');
     52html_print_img(img_name, '400');
    6753
    6854        for DetLoop=1:4
    69                   print_tag('table', 'border="2"');
    70                         print_tag('tr');
    71                         print_tag('td', '', '');
     55                  html_print_tag('table', 'border="2"');
     56                        html_print_tag('tr');
     57                        html_print_tag('td', '', '');
    7258                for QICT1loop=1:length(QICT1_txt);
    73                         print_tag('td', '', ['Q=' QICT1_txt{QICT1loop}]);
     59                        html_print_tag('td', '', ['Q=' QICT1_txt{QICT1loop}]);
    7460                end;% QICT1loop
    75                         print_tag('/tr');
    76                         print_tag('tr');
    77                         print_tag('td', '', [data_names{DetLoop}]);
     61                        html_print_tag('/tr');
     62                        html_print_tag('tr');
     63                        html_print_tag('td', '', [data_names{DetLoop}]);
    7864                for QICT1loop=1:length(QICT1_txt);
    7965                        img_name=[ 'Reseau_'...
    8066                                                  data_names{DetLoop}...
    8167                                                '_Q' QICT1_txt{QICT1loop} '.png' ];
    82                         print_tag('td');
    83                         print_img(img_name, '400');
    84                         print_tag('/td');
     68                        html_print_tag('td');
     69                        html_print_img(img_name, '400');
     70                        html_print_tag('/td');
    8571                end;% QICT1loop
    86                         print_tag('/tr');
    87                   print_tag('/table');
     72                        html_print_tag('/tr');
     73                  html_print_tag('/table');
    8874        end;% DetLoop
    8975
    9076       
    91 print_tag('/body');
    92 print_tag('/HTML');
     77html_print_tag('/body');
     78html_print_tag('/HTML');
    9379fclose(file_id);
    9480
     
    9884end % function
    9985
    100 function result_text = print_tag(tagName, tag_params, tag_txt)
    101 % print html tag, with neat tabshifts
    102 % 1 arg - only <tagname>
    103 % 2 args - <tagname tagparams>
    104 % 3 args - <tagname tagparams>tagtxt</tagname>
    105 global prev_tag
    106 global tabstops
    107 global file_id
    108 tabchar='\t';
    109 
    110 if nargin<1
    111         return
    112 end; % if not enough arguments
    113 
    114         if ((prev_tag(1)=='/')&&(tagName(1)=='/'))
    115                 tabstops=tabstops-1;           
    116         end;
    117         if ((tagName(1)=='/')&&(length(tagName)==1))
    118                 prev_tag='/';
    119                 tabstops=tabstops-1;
    120                 return
    121         end;
    122 
    123 if nargin<2
    124         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName '>']);
    125 elseif nargin<3
    126         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    127 else
    128         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['<' tagName ' ' tag_params '>']);
    129         fprintf(file_id, [repmat(tabchar,1,tabstops+1) '%s\n'], [tag_txt]);
    130         fprintf(file_id, [repmat(tabchar,1,tabstops) '%s\n'], ['</' tagName '>']);
    131         tagName=['/' tagName];
    132         %tabstops=tabstops-1;
    133 end;
    134 
    135 if tagName(1)~='/'
    136         tabstops=tabstops+1;   
    137 end;
    138 
    139 prev_tag=tagName;
    140 end
    141 
    142 function print_img(image_name, width)
    143         print_tag('a', ['href="' image_name '"']);     
    144            print_tag('img', ['src="' image_name '"' ' width="' width '"']);
    145            print_tag('/');
    146         print_tag('/a');
    147 end
  • SPESO/ana2015/offline_analysis/offline_selection.m

    r497 r503  
    77        define_data_var();
    88
    9         if mod(selection_id,1000)==1
    10                 % before 20160310
    11                 % ======================== from balayage =================
    12                 pos_hublot_Z=-66000;
    13                 pos_hublot_Y=-575000;
    14 
    15                 N_DAYS=5;
    16                 %if (mod(theDate,N_DAYS)>0)
    17                 theDate=1:N_DAYS-1;
    18                 %zloop=2*str2num(datestr(now,'HH'))+floor((str2num(datestr(now,'MM')))/30)
    19                 zloop=0:47;
    20 
    21                 pos_next_Y=-200000+(-1).*(floor(600000/48).*(zloop+0.5));
    22                 pos_next_Z=(-1).*(floor(140000/48).*(zloop+0.5));
    23                 pos_next_X=[-200000 -400000];
    24 
    25                 %----------------------- end balayage --------------------
    26         elseif mod(selection_id,1000)==2
    27                 % after 2016/03/10 before 2016/04/09
    28       % ======================== from balayage =================
    29       pos_hublot_Z=-66000;
    30       pos_hublot_Y=-575000;
    31 
    32       N_DAYS=8;
    33       %if (mod(theDate,N_DAYS)>0)
    34       theDate=1:N_DAYS-1;
    35       %zloop=2*str2num(datestr(now,'HH'))+floor((str2num(datestr(now,'MM')))/30)
    36       zloop=0:47;
    37                 pos_next_Y=-200000+(-1).*(floor(600000/48).*(zloop+0.5));
    38                 pos_next_X=-200000+(-1).*(floor(200000/(N_DAYS-1)).*(mod(theDate,N_DAYS)-1));
    39 
    40       pos_next_Z=[0 pos_hublot_Z];
    41 
    42       %----------------------- end balayage --------------------
    43         else
    44                 % do nothing
    45                 return
    46         end; % selection id
    47 
    48         delta_pos_Y=pos_next_Y(1)-pos_next_Y(2);
    49         delta_pos_X=pos_next_X(1)-pos_next_X(2);
    50         delta_pos_Z=pos_next_Z(1)-pos_next_Z(2);
    51 
    52         % from end to start -> from min to max
    53         data_sel.X_edges=[pos_next_X(end)-delta_pos_X/2:delta_pos_X:pos_next_X(1)+delta_pos_X/2];
    54         data_sel.Y_edges=[pos_next_Y(end)-delta_pos_Y/2:delta_pos_Y:pos_next_Y(1)+delta_pos_Y/2];
    55         data_sel.Z_edges=[pos_next_Z(end)-delta_pos_Z/2:delta_pos_Z:pos_next_Z(1)+delta_pos_Z/2];
    56 
    579        data_sel.data_types=[dvar.DATA1_VAL_LPM dvar.DATA2_VAL_LPM dvar.DATA1_VAL_SPM dvar.DATA2_VAL_SPM];
    5810        data_sel.data_names={'DATA1_LPM','DATA2_LPM','DATA1_SPM','DATA2_SPM'}';
    59 
    60         % XPOS  = -200000;
    61         data_sel.XPOS_selection{1}{1}={dvar.DETECT_XPOS, '<', -190000};
    62         data_sel.XPOS_selection{1}{2}={dvar.DETECT_XPOS, '>', -210000};
    63         data_sel.XPOS_txt{1}='200k';   
    64 
    65         % XPOS = -400000;
    66         data_sel.XPOS_selection{2}{1}={dvar.DETECT_XPOS, '<', -390000};
    67         data_sel.XPOS_selection{2}{2}={dvar.DETECT_XPOS, '>', -410000};
    68         data_sel.XPOS_txt{2}='400k';   
    69 
    70         % exclude pos_hublot_Z
    71         data_sel.POS_selection{1}{1}={dvar.DETECT_ZPOS, '<', pos_hublot_Z-100};
    72         data_sel.POS_selection{1}{2}={dvar.DETECT_ZPOS, '>', pos_hublot_Z+100};
    73         data_sel.POS_var{1}=dvar.DETECT_ZPOS;
    74         data_sel.POS_txt{1}='Z';
    75         data_sel.POS_edges{1}=Z_edges;
    76         data_sel.POS_offset{1}(1)=0;
    77         data_sel.POS_offset{1}(2)=0;
    78 
    79         % exclude pos_hublot_S
    80         data_sel.POS_selection{2}{1}={dvar.DETECT_SPOS, '<', pos_hublot_Y-100};
    81         data_sel.POS_selection{2}{2}={dvar.DETECT_SPOS, '>', pos_hublot_Y+100};
    82         data_sel.POS_var{2}=dvar.DETECT_SPOS;
    83         data_sel.POS_txt{2}='S';
    84         data_sel.POS_edges{2}=Y_edges;
    85         data_sel.POS_offset{2}(1)=-650000;
    86         data_sel.POS_offset{2}(2)=-450000;
    87 
    88         % RESEAU_POS > 1000000
    89         data_sel.RESEAU_POS_selection{1}{1}={dvar.RESEAU_POS, '>', 1000000};
    90 
    91         % RESEAU_POS < 1000000
    92         data_sel.RESEAU_POS_selection{2}{1}={dvar.RESEAU_POS, '<', 1000000};
    9311       
    9412        % QICT1 = 3.5
     
    11533        data_sel.LPM_txt{2}='SPM';
    11634
     35        % ======================== from balayage =================
     36        if mod(selection_id,1000)==1
     37                % before 20160310
     38                pos_hublot_Z=-66000;
     39                pos_hublot_Y=-575000;
     40
     41                N_DAYS=5;
     42                theDate=1:N_DAYS-1;
     43                zloop=0:47;
     44
     45                pos_next_Y=-200000+(-1).*(floor(600000/48).*(zloop+0.5));
     46                pos_next_Z=(-1).*(floor(140000/48).*(zloop+0.5));
     47                pos_next_X=[-200000 -400000];
     48
     49        elseif mod(selection_id,1000)==2
     50                % after 2016/03/10 before 2016/04/09
     51      pos_hublot_Z=-66000;
     52      pos_hublot_Y=-575000;
     53
     54      N_DAYS=8;
     55      theDate=1:N_DAYS-1;
     56      zloop=0:47;
     57                pos_next_Y=-200000+(-1).*(floor(600000/48).*(zloop+0.5));
     58                pos_next_X=-200000+(-1).*(floor(200000/(N_DAYS-1)).*(mod(theDate,N_DAYS)-1));
     59
     60      pos_next_Z=[0 pos_hublot_Z];
     61
     62        else
     63                % do nothing
     64                return
     65        end; % selection id
     66        %----------------------- end balayage --------------------
     67
     68        delta_pos_Y=pos_next_Y(1)-pos_next_Y(2);
     69        delta_pos_X=pos_next_X(1)-pos_next_X(2);
     70        delta_pos_Z=pos_next_Z(1)-pos_next_Z(2);
     71
     72        % from end to start -> from min to max
     73        data_sel.X_edges=[pos_next_X(end)-delta_pos_X/2:delta_pos_X:pos_next_X(1)+delta_pos_X/2];
     74        data_sel.Y_edges=[pos_next_Y(end)-delta_pos_Y/2:delta_pos_Y:pos_next_Y(1)+delta_pos_Y/2];
     75        data_sel.Z_edges=[pos_next_Z(end)-delta_pos_Z/2:delta_pos_Z:pos_next_Z(1)+delta_pos_Z/2];
     76
     77        % =========================================================
     78        % selection axis/edges for colorplots
     79        if (mod(selection_id,1000)==1)||(mod(selection_id,1000)==2)
     80                % before 20160410
     81                % colorplot X axis - S_POS
     82                % colorplot Y axis - X_Pos
     83                data_sel.X_axis_var=dvar.DETECT_SPOS;
     84                data_sel.X_axis_edges=data_sel.Y_edges;
     85                data_sel.Y_axis_var=dvar.DETECT_XPOS;
     86                data_sel.Y_axis_edges=data_sel.X_edges;
     87        elseif (mod(selection_id,1000)==3)
     88                % after 20160409
     89                %return
     90        end;% selection id
     91        % ---------------------------------------------------------
     92
     93        % XPOS  = -200000;
     94        data_sel.XPOS_selection{1}{1}={dvar.DETECT_XPOS, '<', -190000};
     95        data_sel.XPOS_selection{1}{2}={dvar.DETECT_XPOS, '>', -210000};
     96        data_sel.XPOS_txt{1}='200k';   
     97
     98        % XPOS = -400000;
     99        data_sel.XPOS_selection{2}{1}={dvar.DETECT_XPOS, '<', -390000};
     100        data_sel.XPOS_selection{2}{2}={dvar.DETECT_XPOS, '>', -410000};
     101        data_sel.XPOS_txt{2}='400k';   
     102
     103        % exclude pos_hublot_Z
     104        data_sel.POS_selection{1}{1}={dvar.DETECT_ZPOS, '<', pos_hublot_Z-100};
     105        data_sel.POS_selection{1}{2}={dvar.DETECT_ZPOS, '>', pos_hublot_Z+100};
     106        % only position pos_hublot_Z
     107        data_sel.POS_selection{1}{3}={dvar.DETECT_ZPOS, '>', pos_hublot_Z-100};
     108        data_sel.POS_selection{1}{4}={dvar.DETECT_ZPOS, '<', pos_hublot_Z+100};
     109        data_sel.POS_var{1}=dvar.DETECT_ZPOS;
     110        data_sel.POS_txt{1}='Z';
     111        data_sel.POS_edges{1}=data_sel.Z_edges;
     112        data_sel.POS_offset{1}(1)=0;
     113        data_sel.POS_offset{1}(2)=0;
     114
     115        % exclude pos_hublot_S
     116        data_sel.POS_selection{2}{1}={dvar.DETECT_SPOS, '<', pos_hublot_Y-100};
     117        data_sel.POS_selection{2}{2}={dvar.DETECT_SPOS, '>', pos_hublot_Y+100};
     118        % only position pos_hublot_S
     119        data_sel.POS_selection{2}{3}={dvar.DETECT_SPOS, '>', pos_hublot_Y-100};
     120        data_sel.POS_selection{2}{4}={dvar.DETECT_SPOS, '<', pos_hublot_Y+100};
     121
     122        data_sel.POS_var{2}=dvar.DETECT_SPOS;
     123        data_sel.POS_txt{2}='S';
     124        data_sel.POS_edges{2}=data_sel.Y_edges;
     125        data_sel.POS_offset{2}(1)=-650000;
     126        data_sel.POS_offset{2}(2)=-450000;
     127
     128        % RESEAU_POS > 1000000
     129        data_sel.RESEAU_POS_selection{1}{1}={dvar.RESEAU_POS, '>', 1000000};
     130
     131        % RESEAU_POS < 1000000
     132        data_sel.RESEAU_POS_selection{2}{1}={dvar.RESEAU_POS, '<', 1000000};
     133
    117134end % function
    118135
Note: See TracChangeset for help on using the changeset viewer.