[4] | 1 | function varargout = optics_LT1_LT2(varargin) |
---|
| 2 | %OPTICS_LT1_LT2 - M-file for optics_LT1_LT2.fig |
---|
| 3 | % OPTICS_LT1_LT2, by itself, creates a new OPTICS_LT1_LT2 or raises the existing |
---|
| 4 | % singleton*. |
---|
| 5 | % |
---|
| 6 | % H = OPTICS_LT1_LT2 returns the handle to a new OPTICS_LT1_LT2 or the handle to |
---|
| 7 | % the existing singleton*. |
---|
| 8 | % |
---|
| 9 | % OPTICS_LT1_LT2('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
| 10 | % function named CALLBACK in OPTICS_LT1_LT2.M with the given input arguments. |
---|
| 11 | % |
---|
| 12 | % OPTICS_LT1_LT2('Property','Value',...) creates a new OPTICS_LT1_LT2 or raises the |
---|
| 13 | % existing singleton*. Starting from the left, property value pairs are |
---|
| 14 | % applied to the GUI before optics_LT1_LT2_OpeningFunction gets called. An |
---|
| 15 | % unrecognized property name or invalid value makes property application |
---|
| 16 | % stop. All inputs are passed to optics_LT1_LT2_OpeningFcn via varargin. |
---|
| 17 | % |
---|
| 18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
| 19 | % instance to run (singleton)". |
---|
| 20 | % |
---|
| 21 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
| 22 | |
---|
| 23 | % Edit the above text to modify the response to help optics_LT1_LT2 |
---|
| 24 | |
---|
| 25 | % Last Modified by GUIDE v2.5 09-Mar-2005 10:49:46 |
---|
| 26 | |
---|
| 27 | % Begin initialization code - DO NOT EDIT |
---|
| 28 | gui_Singleton = 1; |
---|
| 29 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 30 | 'gui_Singleton', gui_Singleton, ... |
---|
| 31 | 'gui_OpeningFcn', @optics_LT1_LT2_OpeningFcn, ... |
---|
| 32 | 'gui_OutputFcn', @optics_LT1_LT2_OutputFcn, ... |
---|
| 33 | 'gui_LayoutFcn', [] , ... |
---|
| 34 | 'gui_Callback', []); |
---|
| 35 | if nargin && ischar(varargin{1}) |
---|
| 36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 37 | end |
---|
| 38 | |
---|
| 39 | if nargout |
---|
| 40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 41 | else |
---|
| 42 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 43 | end |
---|
| 44 | % End initialization code - DO NOT EDIT |
---|
| 45 | |
---|
| 46 | % --- Executes just before optics_LT1_LT2 is made visible. |
---|
| 47 | function optics_LT1_LT2_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
| 48 | % This function has no output args, see OutputFcn. |
---|
| 49 | % hObject handle to figure |
---|
| 50 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 51 | % handles structure with handles and user data (see GUIDATA) |
---|
| 52 | % varargin command line arguments to optics_LT1_LT2 (see VARARGIN) |
---|
| 53 | |
---|
| 54 | % Choose default command line output for optics_LT1_LT2 |
---|
| 55 | handles.output = hObject; |
---|
| 56 | |
---|
| 57 | %mat: utilite ??? |
---|
| 58 | setappdata(handles.figure1, 'twissdatain',struct([])); |
---|
| 59 | |
---|
| 60 | % construct initial twiss parameters |
---|
| 61 | |
---|
| 62 | Machine = getfamilydata('SubMachine'); |
---|
| 63 | |
---|
| 64 | switch Machine |
---|
| 65 | case {'LT1'} |
---|
| 66 | |
---|
| 67 | twissdatain.ElemIndex = 1; |
---|
| 68 | twissdatain.SPos = 0; |
---|
| 69 | twissdatain.ClosedOrbit= [1e-3 0 2e-3 0]'*0; |
---|
| 70 | twissdatain.M44 = eye(4); |
---|
| 71 | % theorique |
---|
| 72 | twissdatain.beta = [8.1 8.1]; |
---|
| 73 | twissdatain.alpha = [0 0]; |
---|
| 74 | % mesure 2006-02-06 |
---|
| 75 | twissdatain.beta = [9.5 13.5]; |
---|
| 76 | twissdatain.alpha = [-1.16 -2.43]; |
---|
| 77 | twissdatain.mu = [0 0]; |
---|
| 78 | twissdatain.Dispersion = [0 0 0 0]'; |
---|
| 79 | set(handles.figure1,'Name', 'LT1 Optical functions'); |
---|
| 80 | |
---|
| 81 | case {'LT2'} |
---|
| 82 | |
---|
| 83 | twissdatain.ElemIndex = 1; |
---|
| 84 | twissdatain.SPos = 0; |
---|
| 85 | twissdatain.ClosedOrbit= [1e-3 0 2e-3 0]'*0; |
---|
| 86 | twissdatain.M44 = eye(4); |
---|
| 87 | twissdatain.beta = [6.0 6.0]; |
---|
| 88 | twissdatain.alpha = [-1.8 1.5]; |
---|
| 89 | twissdatain.mu = [0 0]; |
---|
| 90 | twissdatain.Dispersion = [0 0 0 0]'; |
---|
| 91 | set(handles.figure1,'Name', 'LT2 Optical functions'); |
---|
| 92 | |
---|
| 93 | otherwise |
---|
| 94 | error('No Machine loaded') |
---|
| 95 | end |
---|
| 96 | |
---|
| 97 | setappdata(handles.figure1, 'twissdatain0',twissdatain); |
---|
| 98 | handles.restart = 1; |
---|
| 99 | |
---|
| 100 | %% Initialize structure for handling LT1 and LT2 magnets |
---|
| 101 | handles = init_handles(handles); |
---|
| 102 | |
---|
| 103 | % Update handles structure |
---|
| 104 | guidata(hObject, handles); |
---|
| 105 | |
---|
| 106 | AO = getao; |
---|
| 107 | % setappdata(handles.figure1,'AOmagnet', AO); |
---|
| 108 | |
---|
| 109 | %set(handles.(name),'Max',9, 'Min', -9) |
---|
| 110 | |
---|
| 111 | % min et max des sliders (figé à l'ouverture puis modifiable par SETBAR) |
---|
| 112 | val_max = getmaxsp('QP'); |
---|
| 113 | val_min = getminsp('QP'); |
---|
| 114 | |
---|
| 115 | %% Number of sliders |
---|
| 116 | handles.sliderNumber = 7; |
---|
| 117 | |
---|
| 118 | for k = 1:handles.sliderNumber, |
---|
| 119 | name = strcat('sliderQP',num2str(k)) |
---|
| 120 | set(handles.(name),'Max',val_max(k),'Min',val_min(k)); |
---|
| 121 | end |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | %% liste de aimants a controler (menu deroulant) |
---|
| 125 | list = [AO.QP.CommonNames;... |
---|
| 126 | AO.CH.CommonNames; ... |
---|
| 127 | AO.CV.CommonNames |
---|
| 128 | ]; |
---|
| 129 | |
---|
| 130 | %% Automatic configuration for sliders |
---|
| 131 | for k = 1:handles.sliderNumber |
---|
| 132 | name = ['popupmenu_bar' num2str(k)]; |
---|
| 133 | set(handles.(name),'String',list); |
---|
| 134 | set(handles.(name),'Value',k); |
---|
| 135 | end |
---|
| 136 | |
---|
| 137 | %% graphe par defaut |
---|
| 138 | axes(handles.axes1); |
---|
| 139 | handles.xtype = 'spos'; |
---|
| 140 | handles.ytype = 'beta'; |
---|
| 141 | |
---|
| 142 | %% initialisation AT et IHM |
---|
| 143 | handles = restart(handles); |
---|
| 144 | |
---|
| 145 | %% Read Tango values |
---|
| 146 | %read_tango(handles); |
---|
| 147 | |
---|
| 148 | % UIWAIT makes optics_LT1_LT2 wait for user response (see UIRESUME) |
---|
| 149 | % uiwait(handles.figure1); |
---|
| 150 | set(0,'DefaultAxesXgrid','on','DefaultAxesYgrid','on'); |
---|
| 151 | |
---|
| 152 | %% graphe symboles |
---|
| 153 | axes(handles.axes2); |
---|
| 154 | drawlattice(0,0.8); |
---|
| 155 | set(handles.axes2,'Xlim',[handles.spos(1) handles.spos(end)], ... |
---|
| 156 | 'XTick',[],'YTick',[]); |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | % Update handles structure |
---|
| 160 | guidata(hObject, handles); |
---|
| 161 | |
---|
| 162 | %% ------------------------------------- |
---|
| 163 | function handles = computeTwiss(handles) |
---|
| 164 | % update ATmodel |
---|
| 165 | % compute new twiss parameters |
---|
| 166 | % |
---|
| 167 | global THERING; |
---|
| 168 | |
---|
| 169 | %%% parameters at the entrance of the line |
---|
| 170 | % twissdatain.ElemIndex=1; |
---|
| 171 | % twissdatain.SPos=0; |
---|
| 172 | % twissdatain.ClosedOrbit=[1e-3 0 2e-3 0]'*0; |
---|
| 173 | % twissdatain.M44=eye(4); |
---|
| 174 | % |
---|
| 175 | % if isequal(isfield(twissdatain,'beta'),0) |
---|
| 176 | |
---|
| 177 | if handles.restart == 1 |
---|
| 178 | twissdatain = getappdata(handles.figure1,'twissdatain0'); |
---|
| 179 | handles.restart = 0; |
---|
| 180 | else |
---|
| 181 | twissdatain = getappdata(handles.figure1,'twissdatain'); |
---|
| 182 | end |
---|
| 183 | % twissdatain.beta= [8.1 8.1]; |
---|
| 184 | % twissdatain.alpha= [0 0]; |
---|
| 185 | % else |
---|
| 186 | % twissdatain = getappdata(handles.figure1,'twissdatain') |
---|
| 187 | % end |
---|
| 188 | |
---|
| 189 | % twissdatain.mu= [0 0]; |
---|
| 190 | % twissdatain.Dispersion= [0 0 0 0]'; |
---|
| 191 | |
---|
| 192 | %%% get twiss paramaters |
---|
| 193 | TD = twissline(THERING,0.0,twissdatain,1:length(THERING),'chroma'); |
---|
| 194 | |
---|
| 195 | handles.twissdatain = twissdatain; |
---|
| 196 | handles.beta = cat(1,TD.beta); |
---|
| 197 | handles.cod = cat(2,TD.ClosedOrbit)'; |
---|
| 198 | handles.eta = cat(2,TD.Dispersion)'; |
---|
| 199 | handles.spos = cat(1,TD.SPos); |
---|
| 200 | handles.phase = cat(1,TD.mu); |
---|
| 201 | |
---|
| 202 | setappdata(handles.figure1,'twissdatain',twissdatain); |
---|
| 203 | |
---|
| 204 | % --- Outputs from this function are returned to the command line. |
---|
| 205 | function varargout = optics_LT1_LT2_OutputFcn(hObject, eventdata, handles) |
---|
| 206 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 207 | % hObject handle to figure |
---|
| 208 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 209 | % handles structure with handles and user data (see GUIDATA) |
---|
| 210 | |
---|
| 211 | % Get default command line output from handles structure |
---|
| 212 | varargout{1} = handles.output; |
---|
| 213 | |
---|
| 214 | % --- Executes during object creation, after setting all properties. |
---|
| 215 | function sliderQP1_CreateFcn(hObject, eventdata, handles) |
---|
| 216 | % hObject handle to sliderQP1 (see GCBO) |
---|
| 217 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 218 | % handles empty - handles not created until after all CreateFcns called |
---|
| 219 | |
---|
| 220 | % Hint: slider controls usually have a light gray background, change |
---|
| 221 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 222 | usewhitebg = 1; |
---|
| 223 | if usewhitebg |
---|
| 224 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 225 | else |
---|
| 226 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 227 | end |
---|
| 228 | |
---|
| 229 | % --- Executes on slider movement. |
---|
| 230 | function sliderQP1_Callback(hObject, eventdata, handles) |
---|
| 231 | % hObject handle to sliderQP1 (see GCBO) |
---|
| 232 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 233 | % handles structure with handles and user data (see GUIDATA) |
---|
| 234 | |
---|
| 235 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 236 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 237 | |
---|
| 238 | handles = setslider(hObject,handles); |
---|
| 239 | guidata(hObject, handles); |
---|
| 240 | |
---|
| 241 | % --- Executes during object creation, after setting all properties. |
---|
| 242 | function editQP1_CreateFcn(hObject, eventdata, handles) |
---|
| 243 | % hObject handle to editQP1 (see GCBO) |
---|
| 244 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 245 | % handles empty - handles not created until after all CreateFcns called |
---|
| 246 | |
---|
| 247 | % Hint: edit controls usually have a white background on Windows. |
---|
| 248 | % See ISPC and COMPUTER. |
---|
| 249 | if ispc |
---|
| 250 | set(hObject,'BackgroundColor','green'); |
---|
| 251 | else |
---|
| 252 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 253 | end |
---|
| 254 | |
---|
| 255 | % --- Executes on slider movement. |
---|
| 256 | function editQP1_Callback(hObject, eventdata, handles) |
---|
| 257 | % hObject handle to editQP1 (see GCBO) |
---|
| 258 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 259 | % handles structure with handles and user data (see GUIDATA) |
---|
| 260 | |
---|
| 261 | % Hints: get(hObject,'String') returns contents of editQP1 as text |
---|
| 262 | % str2double(get(hObject,'String')) returns contents of editQP1 as a double |
---|
| 263 | handles = setedit(handles); |
---|
| 264 | guidata(hObject, handles); |
---|
| 265 | |
---|
| 266 | % --- Executes during object creation, after setting all properties. |
---|
| 267 | function sliderQP2_CreateFcn(hObject, eventdata, handles) |
---|
| 268 | % hObject handle to sliderQP2 (see GCBO) |
---|
| 269 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 270 | % handles empty - handles not created until after all CreateFcns called |
---|
| 271 | |
---|
| 272 | % Hint: slider controls usually have a light gray background, change |
---|
| 273 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 274 | usewhitebg = 1; |
---|
| 275 | if usewhitebg |
---|
| 276 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 277 | else |
---|
| 278 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 279 | end |
---|
| 280 | |
---|
| 281 | % --- Executes on slider movement. |
---|
| 282 | function sliderQP2_Callback(hObject, eventdata, handles) |
---|
| 283 | % hObject handle to sliderQP2 (see GCBO) |
---|
| 284 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 285 | % handles structure with handles and user data (see GUIDATA) |
---|
| 286 | |
---|
| 287 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 288 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 289 | handles = setslider(hObject,handles); |
---|
| 290 | guidata(hObject, handles); |
---|
| 291 | |
---|
| 292 | % --- Executes during object creation, after setting all properties. |
---|
| 293 | function editQP2_CreateFcn(hObject, eventdata, handles) |
---|
| 294 | % hObject handle to editQP2 (see GCBO) |
---|
| 295 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 296 | % handles empty - handles not created until after all CreateFcns called |
---|
| 297 | |
---|
| 298 | % Hint: edit controls usually have a white background on Windows. |
---|
| 299 | % See ISPC and COMPUTER. |
---|
| 300 | if ispc |
---|
| 301 | set(hObject,'BackgroundColor','white'); |
---|
| 302 | else |
---|
| 303 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 304 | end |
---|
| 305 | |
---|
| 306 | function editQP2_Callback(hObject, eventdata, handles) |
---|
| 307 | % hObject handle to editQP2 (see GCBO) |
---|
| 308 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 309 | % handles structure with handles and user data (see GUIDATA) |
---|
| 310 | |
---|
| 311 | % Hints: get(hObject,'String') returns contents of editQP2 as text |
---|
| 312 | % str2double(get(hObject,'String')) returns contents of editQP2 as a double |
---|
| 313 | handles = setedit(handles); |
---|
| 314 | guidata(hObject, handles); |
---|
| 315 | |
---|
| 316 | % --- Executes during object creation, after setting all properties. |
---|
| 317 | function sliderQP3_CreateFcn(hObject, eventdata, handles) |
---|
| 318 | % hObject handle to sliderQP3 (see GCBO) |
---|
| 319 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 320 | % handles empty - handles not created until after all CreateFcns called |
---|
| 321 | |
---|
| 322 | % Hint: slider controls usually have a light gray background, change |
---|
| 323 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 324 | usewhitebg = 1; |
---|
| 325 | if usewhitebg |
---|
| 326 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 327 | else |
---|
| 328 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 329 | end |
---|
| 330 | |
---|
| 331 | % --- Executes on slider movement. |
---|
| 332 | function sliderQP3_Callback(hObject, eventdata, handles) |
---|
| 333 | % hObject handle to sliderQP3 (see GCBO) |
---|
| 334 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 335 | % handles structure with handles and user data (see GUIDATA) |
---|
| 336 | |
---|
| 337 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 338 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 339 | handles = setslider(hObject,handles); |
---|
| 340 | guidata(hObject, handles); |
---|
| 341 | |
---|
| 342 | |
---|
| 343 | % --- Executes during object creation, after setting all properties. |
---|
| 344 | function editQP3_CreateFcn(hObject, eventdata, handles) |
---|
| 345 | % hObject handle to editQP3 (see GCBO) |
---|
| 346 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 347 | % handles empty - handles not created until after all CreateFcns called |
---|
| 348 | |
---|
| 349 | % Hint: edit controls usually have a white background on Windows. |
---|
| 350 | % See ISPC and COMPUTER. |
---|
| 351 | if ispc |
---|
| 352 | set(hObject,'BackgroundColor','white'); |
---|
| 353 | else |
---|
| 354 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 355 | end |
---|
| 356 | |
---|
| 357 | function editQP3_Callback(hObject, eventdata, handles) |
---|
| 358 | % hObject handle to editQP3 (see GCBO) |
---|
| 359 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 360 | % handles structure with handles and user data (see GUIDATA) |
---|
| 361 | |
---|
| 362 | % Hints: get(hObject,'String') returns contents of editQP3 as text |
---|
| 363 | % str2double(get(hObject,'String')) returns contents of editQP3 as a double |
---|
| 364 | handles = setedit(handles); |
---|
| 365 | guidata(hObject, handles); |
---|
| 366 | |
---|
| 367 | % --- Executes during object creation, after setting all properties. |
---|
| 368 | function editQP4_CreateFcn(hObject, eventdata, handles) |
---|
| 369 | % hObject handle to editQP4 (see GCBO) |
---|
| 370 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 371 | % handles empty - handles not created until after all CreateFcns called |
---|
| 372 | |
---|
| 373 | % Hint: edit controls usually have a white background on Windows. |
---|
| 374 | % See ISPC and COMPUTER. |
---|
| 375 | if ispc |
---|
| 376 | set(hObject,'BackgroundColor','white'); |
---|
| 377 | else |
---|
| 378 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 379 | end |
---|
| 380 | |
---|
| 381 | function editQP4_Callback(hObject, eventdata, handles) |
---|
| 382 | % hObject handle to editQP4 (see GCBO) |
---|
| 383 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 384 | % handles structure with handles and user data (see GUIDATA) |
---|
| 385 | |
---|
| 386 | % Hints: get(hObject,'String') returns contents of editQP4 as text |
---|
| 387 | % str2double(get(hObject,'String')) returns contents of editQP4 as a double |
---|
| 388 | handles = setedit(handles); |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | % --- Executes during object creation, after setting all properties. |
---|
| 392 | function sliderQP4_CreateFcn(hObject, eventdata, handles) |
---|
| 393 | % hObject handle to sliderQP4 (see GCBO) |
---|
| 394 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 395 | % handles empty - handles not created until after all CreateFcns called |
---|
| 396 | |
---|
| 397 | % Hint: slider controls usually have a light gray background, change |
---|
| 398 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 399 | usewhitebg = 1; |
---|
| 400 | if usewhitebg |
---|
| 401 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 402 | else |
---|
| 403 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 404 | end |
---|
| 405 | |
---|
| 406 | |
---|
| 407 | % --- Executes on slider movement. |
---|
| 408 | function sliderQP4_Callback(hObject, eventdata, handles) |
---|
| 409 | % hObject handle to sliderQP4 (see GCBO) |
---|
| 410 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 411 | % handles structure with handles and user data (see GUIDATA) |
---|
| 412 | |
---|
| 413 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 414 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 415 | handles = setslider(hObject,handles); |
---|
| 416 | guidata(hObject, handles); |
---|
| 417 | |
---|
| 418 | % --- Executes during object creation, after setting all properties. |
---|
| 419 | function editQP5_CreateFcn(hObject, eventdata, handles) |
---|
| 420 | % hObject handle to editQP5 (see GCBO) |
---|
| 421 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 422 | % handles empty - handles not created until after all CreateFcns called |
---|
| 423 | |
---|
| 424 | % Hint: edit controls usually have a white background on Windows. |
---|
| 425 | % See ISPC and COMPUTER. |
---|
| 426 | if ispc |
---|
| 427 | set(hObject,'BackgroundColor','white'); |
---|
| 428 | else |
---|
| 429 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 430 | end |
---|
| 431 | |
---|
| 432 | |
---|
| 433 | function editQP5_Callback(hObject, eventdata, handles) |
---|
| 434 | % hObject handle to editQP5 (see GCBO) |
---|
| 435 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 436 | % handles structure with handles and user data (see GUIDATA) |
---|
| 437 | |
---|
| 438 | % Hints: get(hObject,'String') returns contents of editQP5 as text |
---|
| 439 | % str2double(get(hObject,'String')) returns contents of editQP5 as a double |
---|
| 440 | handles = setedit(handles); |
---|
| 441 | guidata(hObject, handles); |
---|
| 442 | |
---|
| 443 | % --- Executes during object creation, after setting all properties. |
---|
| 444 | function sliderQP5_CreateFcn(hObject, eventdata, handles) |
---|
| 445 | % hObject handle to sliderQP5 (see GCBO) |
---|
| 446 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 447 | % handles empty - handles not created until after all CreateFcns called |
---|
| 448 | |
---|
| 449 | % Hint: slider controls usually have a light gray background, change |
---|
| 450 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 451 | usewhitebg = 1; |
---|
| 452 | if usewhitebg |
---|
| 453 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 454 | else |
---|
| 455 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 456 | end |
---|
| 457 | |
---|
| 458 | % --- Executes on slider movement. |
---|
| 459 | function sliderQP5_Callback(hObject, eventdata, handles) |
---|
| 460 | % hObject handle to sliderQP5 (see GCBO) |
---|
| 461 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 462 | % handles structure with handles and user data (see GUIDATA) |
---|
| 463 | |
---|
| 464 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 465 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 466 | handles = setslider(hObject,handles); |
---|
| 467 | guidata(hObject, handles); |
---|
| 468 | |
---|
| 469 | % --- Executes during object creation, after setting all properties. |
---|
| 470 | function sliderQP6_CreateFcn(hObject, eventdata, handles) |
---|
| 471 | % hObject handle to sliderQP6 (see GCBO) |
---|
| 472 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 473 | % handles empty - handles not created until after all CreateFcns called |
---|
| 474 | |
---|
| 475 | % Hint: slider controls usually have a light gray background, change |
---|
| 476 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 477 | usewhitebg = 1; |
---|
| 478 | if usewhitebg |
---|
| 479 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 480 | else |
---|
| 481 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 482 | end |
---|
| 483 | |
---|
| 484 | % --- Executes on slider movement. |
---|
| 485 | function sliderQP6_Callback(hObject, eventdata, handles) |
---|
| 486 | % hObject handle to sliderQP6 (see GCBO) |
---|
| 487 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 488 | % handles structure with handles and user data (see GUIDATA) |
---|
| 489 | |
---|
| 490 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 491 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 492 | handles = setslider(hObject,handles); |
---|
| 493 | guidata(hObject, handles); |
---|
| 494 | |
---|
| 495 | % --- Executes during object creation, after setting all properties. |
---|
| 496 | function editQP6_CreateFcn(hObject, eventdata, handles) |
---|
| 497 | % hObject handle to editQP6 (see GCBO) |
---|
| 498 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 499 | % handles empty - handles not created until after all CreateFcns called |
---|
| 500 | |
---|
| 501 | % Hint: edit controls usually have a white background on Windows. |
---|
| 502 | % See ISPC and COMPUTER. |
---|
| 503 | if ispc |
---|
| 504 | set(hObject,'BackgroundColor','white'); |
---|
| 505 | else |
---|
| 506 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 507 | end |
---|
| 508 | |
---|
| 509 | function editQP6_Callback(hObject, eventdata, handles) |
---|
| 510 | % hObject handle to editQP6 (see GCBO) |
---|
| 511 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 512 | % handles structure with handles and user data (see GUIDATA) |
---|
| 513 | |
---|
| 514 | % Hints: get(hObject,'String') returns contents of editQP6 as text |
---|
| 515 | % str2double(get(hObject,'String')) returns contents of editQP6 as a double |
---|
| 516 | handles = setedit(handles); |
---|
| 517 | guidata(hObject, handles); |
---|
| 518 | |
---|
| 519 | % --- Executes during object creation, after setting all properties. |
---|
| 520 | function editQP7_CreateFcn(hObject, eventdata, handles) |
---|
| 521 | % hObject handle to editQP7 (see GCBO) |
---|
| 522 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 523 | % handles empty - handles not created until after all CreateFcns called |
---|
| 524 | |
---|
| 525 | % Hint: edit controls usually have a white background on Windows. |
---|
| 526 | % See ISPC and COMPUTER. |
---|
| 527 | if ispc |
---|
| 528 | set(hObject,'BackgroundColor','white'); |
---|
| 529 | else |
---|
| 530 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 531 | end |
---|
| 532 | |
---|
| 533 | function editQP7_Callback(hObject, eventdata, handles) |
---|
| 534 | % hObject handle to editQP7 (see GCBO) |
---|
| 535 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 536 | % handles structure with handles and user data (see GUIDATA) |
---|
| 537 | |
---|
| 538 | % Hints: get(hObject,'String') returns contents of editQP7 as text |
---|
| 539 | % str2double(get(hObject,'String')) returns contents of editQP7 as a double |
---|
| 540 | handles = setedit(handles); |
---|
| 541 | |
---|
| 542 | |
---|
| 543 | % --- Executes during object creation, after setting all properties. |
---|
| 544 | function sliderQP7_CreateFcn(hObject, eventdata, handles) |
---|
| 545 | % hObject handle to sliderQP7 (see GCBO) |
---|
| 546 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 547 | % handles empty - handles not created until after all CreateFcns called |
---|
| 548 | |
---|
| 549 | % Hint: slider controls usually have a light gray background, change |
---|
| 550 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
| 551 | usewhitebg = 1; |
---|
| 552 | if usewhitebg |
---|
| 553 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
| 554 | else |
---|
| 555 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 556 | end |
---|
| 557 | |
---|
| 558 | % --- Executes on slider movement. |
---|
| 559 | function sliderQP7_Callback(hObject, eventdata, handles) |
---|
| 560 | % hObject handle to sliderQP7 (see GCBO) |
---|
| 561 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 562 | % handles structure with handles and user data (see GUIDATA) |
---|
| 563 | |
---|
| 564 | % Hints: get(hObject,'Value') returns position of slider |
---|
| 565 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
| 566 | handles = setslider(hObject,handles); |
---|
| 567 | guidata(hObject, handles); |
---|
| 568 | |
---|
| 569 | %----------------------------------------------------------------------- |
---|
| 570 | function plot_axes(handles,quoi) |
---|
| 571 | %%% fonction generique |
---|
| 572 | |
---|
| 573 | axes(handles.axes1); cla; hold on; |
---|
| 574 | |
---|
| 575 | switch handles.xtype |
---|
| 576 | case 'spos' |
---|
| 577 | x=handles.(handles.xtype); |
---|
| 578 | case 'phase' |
---|
| 579 | x=handles.(handles.xtype); x = x(:,1); |
---|
| 580 | end |
---|
| 581 | |
---|
| 582 | switch quoi |
---|
| 583 | case 'beta' |
---|
| 584 | plot(x,handles.beta(:,1),'r.-'); |
---|
| 585 | plot(x,handles.beta(:,2),'b.-'); |
---|
| 586 | ylabel('\beta (m)'); |
---|
| 587 | %mat |
---|
| 588 | %ylim([0 130]); |
---|
| 589 | |
---|
| 590 | case 'eta' |
---|
| 591 | plot(x,handles.eta(:,1),'r.-'); |
---|
| 592 | plot(x,handles.eta(:,3),'b.-'); |
---|
| 593 | ylabel('\eta (m)'); |
---|
| 594 | case 'cod' |
---|
| 595 | plot(x,handles.cod(:,1)*1e3,'r.-'); |
---|
| 596 | plot(x,handles.cod(:,3)*1e3,'b.-'); |
---|
| 597 | ylabel('cod (mm)'); |
---|
| 598 | case 'phase' |
---|
| 599 | plot(x,handles.phase(:,1),'r.-'); |
---|
| 600 | plot(x,handles.phase(:,2),'b.-'); |
---|
| 601 | ylabel('phase '); |
---|
| 602 | end |
---|
| 603 | axis([x(1) x(end) -inf inf]); |
---|
| 604 | datalabel on |
---|
| 605 | |
---|
| 606 | %-------------------------------------------------------------------------- |
---|
| 607 | function handles = setslider(hObject, handles) |
---|
| 608 | %%% fonction generique pour un slider de type aimant |
---|
| 609 | |
---|
| 610 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
| 611 | %% extrait le numero |
---|
| 612 | tagstring = get(hObject,'Tag'); |
---|
| 613 | num = tagstring(regexp(tagstring,'\d')); |
---|
| 614 | magnet0 = ['QP' num2str(num)]; |
---|
| 615 | val = get(hObject,'Value'); |
---|
| 616 | str = num2str(val); |
---|
| 617 | set(handles.(['edit' magnet0]),'string',str); |
---|
| 618 | |
---|
| 619 | %% Cherche le nom de l'aimant |
---|
| 620 | h = handles.(['popupmenu_bar' num]); |
---|
| 621 | contents = get(h,'String'); |
---|
| 622 | magnet = contents{get(h,'Value')}; |
---|
| 623 | handles = setATmagnet(handles,magnet,val); |
---|
| 624 | |
---|
| 625 | AOmagnet.(magnet(1:2)).ModelVal(str2double(magnet(end))) = val; |
---|
| 626 | |
---|
| 627 | % save data |
---|
| 628 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
| 629 | |
---|
| 630 | %-------------------------------------------------------------------------- |
---|
| 631 | function handles = setATmagnet(handles,magnet,val) |
---|
| 632 | % function handles = setATmagnet(handles,magnet,val) |
---|
| 633 | % set val as new setvalue of element 'magnet' |
---|
| 634 | % Replot current graph |
---|
| 635 | |
---|
| 636 | AOmagnet= getappdata(handles.figure1,'AOmagnet'); % get magnet AO |
---|
| 637 | |
---|
| 638 | % set value to AT model |
---|
| 639 | setsp(common2family(magnet), val, common2dev(magnet),'Model'); |
---|
| 640 | |
---|
| 641 | % Recompute twiss parameters |
---|
| 642 | handles = computeTwiss(handles); |
---|
| 643 | % Replot everything |
---|
| 644 | plot_axes(handles,handles.ytype); |
---|
| 645 | %mat |
---|
| 646 | %ylim([0 130]); |
---|
| 647 | |
---|
| 648 | %-------------------------------------------------------------------------- |
---|
| 649 | function handles = setedit(handles) |
---|
| 650 | % function setedit(handles) |
---|
| 651 | % generic callback for an edit box |
---|
| 652 | |
---|
| 653 | AOmagnet= getappdata(handles.figure1,'AOmagnet'); % get magnet AO |
---|
| 654 | |
---|
| 655 | %% construction automatique du nom du slider |
---|
| 656 | val = str2double(get(gcbo,'String')); |
---|
| 657 | tagstring = get(gcbo,'Tag'); |
---|
| 658 | num = tagstring(regexp(tagstring,'\d')); |
---|
| 659 | magnet0=['QP' num2str(num)]; |
---|
| 660 | name = handles.(['slider' magnet0]); |
---|
| 661 | %% Cherche le nom de l'aimant |
---|
| 662 | h = handles.(['popupmenu_bar' num]); |
---|
| 663 | contents = get(h,'String'); |
---|
| 664 | magnet = contents{get(h,'Value')}; |
---|
| 665 | |
---|
| 666 | %%% Test si dans les limites |
---|
| 667 | if val<get(name,'Max') && val> get(name,'Min') |
---|
| 668 | set(name,'Value',val); |
---|
| 669 | handles = setATmagnet(handles,magnet,val); |
---|
| 670 | AOmagnet.(magnet(1:2)).ModelVal(str2double(magnet(end))) = val; |
---|
| 671 | else % message d'erreur |
---|
| 672 | warndlg('Wrong value for K','Edit Box','Modal') |
---|
| 673 | set(hObject,'String',num2str(get(name,'Value'))); |
---|
| 674 | end |
---|
| 675 | |
---|
| 676 | % Save data |
---|
| 677 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
| 678 | |
---|
| 679 | %--------------------------------- |
---|
| 680 | function mutual_exclude(off) |
---|
| 681 | % function mutual_exclude(off) |
---|
| 682 | % fonction pour faire des radioboutons |
---|
| 683 | set(off,'Value',0); |
---|
| 684 | |
---|
| 685 | % --- Executes during object creation, after setting all properties. |
---|
| 686 | function popupmenu_y_CreateFcn(hObject, eventdata, handles) |
---|
| 687 | % hObject handle to popupmenu_y (see GCBO) |
---|
| 688 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 689 | % handles empty - handles not created until after all CreateFcns called |
---|
| 690 | |
---|
| 691 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 692 | % See ISPC and COMPUTER. |
---|
| 693 | if ispc |
---|
| 694 | set(hObject,'BackgroundColor','white'); |
---|
| 695 | else |
---|
| 696 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 697 | end |
---|
| 698 | |
---|
| 699 | |
---|
| 700 | % --- Executes on selection change in popupmenu_y. |
---|
| 701 | function popupmenu_y_Callback(hObject, eventdata, handles) |
---|
| 702 | % hObject handle to popupmenu_y (see GCBO) |
---|
| 703 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 704 | % handles structure with handles and user data (see GUIDATA) |
---|
| 705 | |
---|
| 706 | % Hints: contents = get(hObject,'String') returns popupmenu_y contents as cell array |
---|
| 707 | % contents{get(hObject,'Value')} returns selected item from popupmenu_y |
---|
| 708 | contents = get(hObject,'String'); |
---|
| 709 | plot_axes(handles, contents{get(hObject,'Value')}); |
---|
| 710 | %mat |
---|
| 711 | %ylim([0 130]); |
---|
| 712 | handles.ytype = contents{get(hObject,'Value')}; |
---|
| 713 | guidata(hObject, handles); |
---|
| 714 | |
---|
| 715 | % --- Executes during object creation, after setting all properties. |
---|
| 716 | function popupmenu_x_CreateFcn(hObject, eventdata, handles) |
---|
| 717 | % hObject handle to popupmenu_x (see GCBO) |
---|
| 718 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 719 | % handles empty - handles not created until after all CreateFcns called |
---|
| 720 | |
---|
| 721 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 722 | % See ISPC and COMPUTER. |
---|
| 723 | if ispc |
---|
| 724 | set(hObject,'BackgroundColor','white'); |
---|
| 725 | else |
---|
| 726 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 727 | end |
---|
| 728 | |
---|
| 729 | % --- Executes on selection change in popupmenu_x. |
---|
| 730 | function popupmenu_x_Callback(hObject, eventdata, handles) |
---|
| 731 | % hObject handle to popupmenu_x (see GCBO) |
---|
| 732 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 733 | % handles structure with handles and user data (see GUIDATA) |
---|
| 734 | |
---|
| 735 | % Hints: contents = get(hObject,'String') returns popupmenu_x contents as cell array |
---|
| 736 | % contents{get(hObject,'Value')} returns selected item from popupmenu_x |
---|
| 737 | contents = get(hObject,'String'); |
---|
| 738 | handles.xtype = contents{get(hObject,'Value')}; |
---|
| 739 | guidata(hObject, handles); |
---|
| 740 | plot_axes(handles, handles.ytype); |
---|
| 741 | %mat |
---|
| 742 | %ylim([0 130]); |
---|
| 743 | |
---|
| 744 | % --- Executes during object creation, after setting all properties. |
---|
| 745 | function popupmenu_plane_CreateFcn(hObject, eventdata, handles) |
---|
| 746 | % hObject handle to popupmenu_plane (see GCBO) |
---|
| 747 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 748 | % handles empty - handles not created until after all CreateFcns called |
---|
| 749 | |
---|
| 750 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 751 | % See ISPC and COMPUTER. |
---|
| 752 | if ispc |
---|
| 753 | set(hObject,'BackgroundColor','white'); |
---|
| 754 | else |
---|
| 755 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 756 | end |
---|
| 757 | |
---|
| 758 | |
---|
| 759 | % --- Executes on selection change in popupmenu_plane. |
---|
| 760 | function popupmenu_plane_Callback(hObject, eventdata, handles) |
---|
| 761 | % hObject handle to popupmenu_plane (see GCBO) |
---|
| 762 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 763 | % handles structure with handles and user data (see GUIDATA) |
---|
| 764 | |
---|
| 765 | % Hints: contents = get(hObject,'String') returns popupmenu_plane contents as cell array |
---|
| 766 | % contents{get(hObject,'Value')} returns selected item from popupmenu_plane |
---|
| 767 | |
---|
| 768 | |
---|
| 769 | % --- Executes on button press in pushbutton_reload. |
---|
| 770 | function pushbutton_reload_Callback(hObject, eventdata, handles) |
---|
| 771 | % hObject handle to pushbutton_reload (see GCBO) |
---|
| 772 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 773 | % handles structure with handles and user data (see GUIDATA) |
---|
| 774 | |
---|
| 775 | handles = restart(handles); |
---|
| 776 | guidata(hObject,handles); |
---|
| 777 | |
---|
| 778 | %-------------------------------------------------------- |
---|
| 779 | function handles = restart(handles) |
---|
| 780 | % function handles = restart(handles) |
---|
| 781 | % Reinitialise la maille et l'IHM |
---|
| 782 | |
---|
| 783 | AD = getad; |
---|
| 784 | run(AD.ATModel); %% Load lattice |
---|
| 785 | global THERING |
---|
| 786 | % MAT ET LAURENT : TEMPORAIRE |
---|
| 787 | %warning('66 MeV'); |
---|
| 788 | %setenergymodel(0.066); |
---|
| 789 | |
---|
| 790 | % |
---|
| 791 | setappdata(handles.figure1, 'LT1', THERING); |
---|
| 792 | |
---|
| 793 | handles.restart = 1; |
---|
| 794 | handles = computeTwiss(handles); |
---|
| 795 | |
---|
| 796 | plot_axes(handles,handles.ytype); |
---|
| 797 | %mat |
---|
| 798 | |
---|
| 799 | %ylim([0 130]); |
---|
| 800 | |
---|
| 801 | handles.modelMagnetVal = {'chModelVal', 'cvModelVal', ... |
---|
| 802 | 'quadrupoleModelVal', 'dipoleModelVal'}; |
---|
| 803 | |
---|
| 804 | store_model_values(handles); |
---|
| 805 | |
---|
| 806 | % Relaod Accelerator Object |
---|
| 807 | AO = getao; |
---|
| 808 | |
---|
| 809 | %% Initialise les sliders et editboxes |
---|
| 810 | for k = 1:handles.sliderNumber |
---|
| 811 | name = ['popupmenu_bar' num2str(k)]; |
---|
| 812 | contents = get(handles.(name),'String'); |
---|
| 813 | magnet = contents{get(handles.(name),'Value')}; |
---|
| 814 | |
---|
| 815 | Qname = ['QP' num2str(k)]; |
---|
| 816 | |
---|
| 817 | % Read AT values |
---|
| 818 | val = getam(common2family(magnet),common2dev(magnet),'Model'); |
---|
| 819 | |
---|
| 820 | set(handles.(['slider' Qname]),'Value', val); |
---|
| 821 | set(handles.(['edit' Qname]),'string', num2str(val)); |
---|
| 822 | end |
---|
| 823 | |
---|
| 824 | |
---|
| 825 | % --- Executes during object creation, after setting all properties. |
---|
| 826 | function popupmenu_bar1_CreateFcn(hObject, eventdata, handles) |
---|
| 827 | % hObject handle to popupmenu_bar1 (see GCBO) |
---|
| 828 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 829 | % handles empty - handles not created until after all CreateFcns called |
---|
| 830 | |
---|
| 831 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 832 | % See ISPC and COMPUTER. |
---|
| 833 | if ispc |
---|
| 834 | set(hObject,'BackgroundColor','white'); |
---|
| 835 | else |
---|
| 836 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 837 | end |
---|
| 838 | |
---|
| 839 | |
---|
| 840 | % --- Executes on selection change in popupmenu_bar1. |
---|
| 841 | function popupmenu_bar1_Callback(hObject, eventdata, handles) |
---|
| 842 | % hObject handle to popupmenu_bar1 (see GCBO) |
---|
| 843 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 844 | % handles structure with handles and user data (see GUIDATA) |
---|
| 845 | |
---|
| 846 | % Hints: contents = get(hObject,'String') returns popupmenu_bar1 contents as cell array |
---|
| 847 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar1 |
---|
| 848 | |
---|
| 849 | setbar(handles); |
---|
| 850 | |
---|
| 851 | %---------------------------------------------------------- |
---|
| 852 | function setbar(handles) |
---|
| 853 | %% aimant selectionne |
---|
| 854 | contents = get(gcbo,'String'); |
---|
| 855 | magnet = contents{get(gcbo,'Value')} |
---|
| 856 | |
---|
| 857 | %% mets a jour l'IHM pour cet aimant |
---|
| 858 | tagstring = get(gcbo,'Tag'); |
---|
| 859 | num = tagstring(regexp(tagstring,'\d')); |
---|
| 860 | slidername = ['sliderQP' num]; |
---|
| 861 | editboxname = ['editQP' num]; |
---|
| 862 | |
---|
| 863 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 864 | |
---|
| 865 | switch magnet |
---|
| 866 | case AOmagnet.CH.CommonNames |
---|
| 867 | val_max = getmaxsp('CH'); |
---|
| 868 | for k = 1:7 |
---|
| 869 | name = strcat('sliderQP',num2str(k)) |
---|
| 870 | set(handles.(name),'Max',val_max); |
---|
| 871 | end |
---|
| 872 | val = AOmagnet.CH.ModelVal(str2double(magnet(end))); |
---|
| 873 | case AOmagnet.CV.CommonNames |
---|
| 874 | val = AOmagnet.CV.ModelVal(str2double(magnet(end))); |
---|
| 875 | case AOmagnet.QP.CommonNames |
---|
| 876 | val = AOmagnet.QP.ModelVal(str2double(magnet(end))); |
---|
| 877 | end |
---|
| 878 | |
---|
| 879 | str = num2str(val); |
---|
| 880 | set(handles.(slidername),'Value',val); % writes slider |
---|
| 881 | set(handles.(editboxname),'String',str); % writes editbox |
---|
| 882 | |
---|
| 883 | % --- Executes during object creation, after setting all properties. |
---|
| 884 | function popupmenu_bar2_CreateFcn(hObject, eventdata, handles) |
---|
| 885 | % hObject handle to popupmenu_bar2 (see GCBO) |
---|
| 886 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 887 | % handles empty - handles not created until after all CreateFcns called |
---|
| 888 | |
---|
| 889 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 890 | % See ISPC and COMPUTER. |
---|
| 891 | if ispc |
---|
| 892 | set(hObject,'BackgroundColor','white'); |
---|
| 893 | else |
---|
| 894 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 895 | end |
---|
| 896 | |
---|
| 897 | % --- Executes on selection change in popupmenu_bar2. |
---|
| 898 | function popupmenu_bar2_Callback(hObject, eventdata, handles) |
---|
| 899 | % hObject handle to popupmenu_bar2 (see GCBO) |
---|
| 900 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 901 | % handles structure with handles and user data (see GUIDATA) |
---|
| 902 | |
---|
| 903 | % Hints: contents = get(hObject,'String') returns popupmenu_bar2 contents as cell array |
---|
| 904 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar2 |
---|
| 905 | setbar(handles); |
---|
| 906 | |
---|
| 907 | % --- Executes during object creation, after setting all properties. |
---|
| 908 | function popupmenu_bar3_CreateFcn(hObject, eventdata, handles) |
---|
| 909 | % hObject handle to popupmenu_bar3 (see GCBO) |
---|
| 910 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 911 | % handles empty - handles not created until after all CreateFcns called |
---|
| 912 | |
---|
| 913 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 914 | % See ISPC and COMPUTER. |
---|
| 915 | if ispc |
---|
| 916 | set(hObject,'BackgroundColor','white'); |
---|
| 917 | else |
---|
| 918 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 919 | end |
---|
| 920 | |
---|
| 921 | % --- Executes on selection change in popupmenu_bar3. |
---|
| 922 | function popupmenu_bar3_Callback(hObject, eventdata, handles) |
---|
| 923 | % hObject handle to popupmenu_bar3 (see GCBO) |
---|
| 924 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 925 | % handles structure with handles and user data (see GUIDATA) |
---|
| 926 | |
---|
| 927 | % Hints: contents = get(hObject,'String') returns popupmenu_bar3 contents as cell array |
---|
| 928 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar3 |
---|
| 929 | setbar(handles); |
---|
| 930 | |
---|
| 931 | % --- Executes during object creation, after setting all properties. |
---|
| 932 | function popupmenu_bar4_CreateFcn(hObject, eventdata, handles) |
---|
| 933 | % hObject handle to popupmenu_bar4 (see GCBO) |
---|
| 934 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 935 | % handles empty - handles not created until after all CreateFcns called |
---|
| 936 | |
---|
| 937 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 938 | % See ISPC and COMPUTER. |
---|
| 939 | if ispc |
---|
| 940 | set(hObject,'BackgroundColor','white'); |
---|
| 941 | else |
---|
| 942 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 943 | end |
---|
| 944 | |
---|
| 945 | % --- Executes on selection change in popupmenu_bar4. |
---|
| 946 | function popupmenu_bar4_Callback(hObject, eventdata, handles) |
---|
| 947 | % hObject handle to popupmenu_bar4 (see GCBO) |
---|
| 948 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 949 | % handles structure with handles and user data (see GUIDATA) |
---|
| 950 | |
---|
| 951 | % Hints: contents = get(hObject,'String') returns popupmenu_bar4 contents as cell array |
---|
| 952 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar4 |
---|
| 953 | setbar(handles); |
---|
| 954 | |
---|
| 955 | % --- Executes during object creation, after setting all properties. |
---|
| 956 | function popupmenu_bar5_CreateFcn(hObject, eventdata, handles) |
---|
| 957 | % hObject handle to popupmenu_bar5 (see GCBO) |
---|
| 958 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 959 | % handles empty - handles not created until after all CreateFcns called |
---|
| 960 | |
---|
| 961 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 962 | % See ISPC and COMPUTER. |
---|
| 963 | if ispc |
---|
| 964 | set(hObject,'BackgroundColor','white'); |
---|
| 965 | else |
---|
| 966 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 967 | end |
---|
| 968 | |
---|
| 969 | % --- Executes on selection change in popupmenu_bar5. |
---|
| 970 | function popupmenu_bar5_Callback(hObject, eventdata, handles) |
---|
| 971 | % hObject handle to popupmenu_bar5 (see GCBO) |
---|
| 972 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 973 | % handles structure with handles and user data (see GUIDATA) |
---|
| 974 | |
---|
| 975 | % Hints: contents = get(hObject,'String') returns popupmenu_bar5 contents as cell array |
---|
| 976 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar5 |
---|
| 977 | setbar(handles); |
---|
| 978 | |
---|
| 979 | % --- Executes during object creation, after setting all properties. |
---|
| 980 | function popupmenu_bar6_CreateFcn(hObject, eventdata, handles) |
---|
| 981 | % hObject handle to popupmenu_bar6 (see GCBO) |
---|
| 982 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 983 | % handles empty - handles not created until after all CreateFcns called |
---|
| 984 | |
---|
| 985 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 986 | % See ISPC and COMPUTER. |
---|
| 987 | if ispc |
---|
| 988 | set(hObject,'BackgroundColor','white'); |
---|
| 989 | else |
---|
| 990 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 991 | end |
---|
| 992 | |
---|
| 993 | |
---|
| 994 | % --- Executes on selection change in popupmenu_bar6. |
---|
| 995 | function popupmenu_bar6_Callback(hObject, eventdata, handles) |
---|
| 996 | % hObject handle to popupmenu_bar6 (see GCBO) |
---|
| 997 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 998 | % handles structure with handles and user data (see GUIDATA) |
---|
| 999 | |
---|
| 1000 | % Hints: contents = get(hObject,'String') returns popupmenu_bar6 contents as cell array |
---|
| 1001 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar6 |
---|
| 1002 | setbar(handles); |
---|
| 1003 | |
---|
| 1004 | % --- Executes during object creation, after setting all properties. |
---|
| 1005 | function popupmenu_bar7_CreateFcn(hObject, eventdata, handles) |
---|
| 1006 | % hObject handle to popupmenu_bar7 (see GCBO) |
---|
| 1007 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1008 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1009 | |
---|
| 1010 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
| 1011 | % See ISPC and COMPUTER. |
---|
| 1012 | if ispc |
---|
| 1013 | set(hObject,'BackgroundColor','white'); |
---|
| 1014 | else |
---|
| 1015 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
| 1016 | end |
---|
| 1017 | |
---|
| 1018 | % --- Executes on selection change in popupmenu_bar7. |
---|
| 1019 | function popupmenu_bar7_Callback(hObject, eventdata, handles) |
---|
| 1020 | % hObject handle to popupmenu_bar7 (see GCBO) |
---|
| 1021 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1022 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1023 | |
---|
| 1024 | % Hints: contents = get(hObject,'String') returns popupmenu_bar7 contents as cell array |
---|
| 1025 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar7 |
---|
| 1026 | setbar(handles); |
---|
| 1027 | |
---|
| 1028 | |
---|
| 1029 | % --- Executes on button press in pushbutton_refresh. |
---|
| 1030 | function pushbutton_refresh_Callback(hObject, eventdata, handles) |
---|
| 1031 | % hObject handle to pushbutton_refresh (see GCBO) |
---|
| 1032 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1033 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1034 | |
---|
| 1035 | %-------------------------------------------------------------------------- |
---|
| 1036 | function read_tango(handles) |
---|
| 1037 | % Reads Tango values for LT1. |
---|
| 1038 | |
---|
| 1039 | % Get magnet AO |
---|
| 1040 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 1041 | FamilyName = fieldnames(AOmagnet); |
---|
| 1042 | |
---|
| 1043 | for k1 = 1:length(FamilyName) |
---|
| 1044 | % get attribute readback value |
---|
| 1045 | magnet = AOmagnet.(FamilyName{k1}); |
---|
| 1046 | AOmagnet.(FamilyName{k1}).TangoVal = ... |
---|
| 1047 | getam(FamilyName{k1},'Online'); |
---|
| 1048 | end |
---|
| 1049 | |
---|
| 1050 | % save data |
---|
| 1051 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
| 1052 | |
---|
| 1053 | %-------------------------------------------------------------------------- |
---|
| 1054 | function write_tango(handles); |
---|
| 1055 | %-- Writes Tango values |
---|
| 1056 | %% Ecriture courant aimant sur les devices serveurs |
---|
| 1057 | |
---|
| 1058 | % Get magnet AO |
---|
| 1059 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 1060 | |
---|
| 1061 | FamilyName = fieldnames(AOmagnet); |
---|
| 1062 | for k1 = 1:length(FamilyName) |
---|
| 1063 | magnet = AOmagnet.(FamilyName{k1}); |
---|
| 1064 | setsp(magnet, magnet.ModelVal,'Online'); |
---|
| 1065 | end |
---|
| 1066 | |
---|
| 1067 | %-------------------------------------------------------------------------- |
---|
| 1068 | function devicelist = get_device_name(machine,property,magnet) |
---|
| 1069 | % get device list from mapping read in tango database |
---|
| 1070 | |
---|
| 1071 | map = tango_get_db_property(machine,property); |
---|
| 1072 | sep = cell2mat(regexpi(map,'::','once'))-1; |
---|
| 1073 | devicelist = regexprep(map,[magnet '\d*::'],'')'; |
---|
| 1074 | |
---|
| 1075 | % --- Executes during object creation, after setting all properties. |
---|
| 1076 | function pushbutton_reload_CreateFcn(hObject, eventdata, handles) |
---|
| 1077 | % hObject handle to pushbutton_reload (see GCBO) |
---|
| 1078 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1079 | % handles empty - handles not created until after all CreateFcns called |
---|
| 1080 | |
---|
| 1081 | % --- Executes on button press in pushbutton_model2online. |
---|
| 1082 | function pushbutton_model2online_Callback(hObject, eventdata, handles) |
---|
| 1083 | % hObject handle to pushbutton_model2online (see GCBO) |
---|
| 1084 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1085 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1086 | |
---|
| 1087 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
| 1088 | |
---|
| 1089 | user_response = questdlg('Do you want to write setvalues to LT1?'); |
---|
| 1090 | switch user_response |
---|
| 1091 | case{'No','Cancel'} |
---|
| 1092 | return; |
---|
| 1093 | case{'Yes'} |
---|
| 1094 | FamilyName = fieldnames(AOmagnet); |
---|
| 1095 | for k1 = 1:length(FamilyName) |
---|
| 1096 | AOmagnet.(FamilyName{k1}).TangoVal = ... |
---|
| 1097 | AOmagnet.(FamilyName{k1}).ModelVal; |
---|
| 1098 | end |
---|
| 1099 | write_tango(handles); |
---|
| 1100 | end |
---|
| 1101 | |
---|
| 1102 | % save data |
---|
| 1103 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
| 1104 | |
---|
| 1105 | % --- Executes on button press in pushbutton_online2model. |
---|
| 1106 | function pushbutton_online2model_Callback(hObject, eventdata, handles) |
---|
| 1107 | % hObject handle to pushbutton_online2model (see GCBO) |
---|
| 1108 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1109 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1110 | |
---|
| 1111 | % Online values stored in model values except dipoles |
---|
| 1112 | user_response = questdlg('Do you want to read TANGO setvalues from LT1?'); |
---|
| 1113 | switch user_response |
---|
| 1114 | case{'No','Cancel'} |
---|
| 1115 | return; |
---|
| 1116 | case{'Yes'} |
---|
| 1117 | read_tango(handles); |
---|
| 1118 | end |
---|
| 1119 | |
---|
| 1120 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
| 1121 | |
---|
| 1122 | FamilyName = fieldnames(AOmagnet); |
---|
| 1123 | for k1 = 1:length(FamilyName) |
---|
| 1124 | AOmagnet.(FamilyName{k1}).ModelVal = AOmagnet.(FamilyName{k1}).TangoVal; |
---|
| 1125 | end |
---|
| 1126 | |
---|
| 1127 | %% Initialise les sliders et editboxes |
---|
| 1128 | for k = 1:handles.sliderNumber |
---|
| 1129 | name = ['popupmenu_bar' num2str(k)]; |
---|
| 1130 | contents = get(handles.(name),'String'); |
---|
| 1131 | magnet = contents{get(handles.(name),'Value')}; |
---|
| 1132 | |
---|
| 1133 | Qname = ['QP' num2str(k)]; |
---|
| 1134 | |
---|
| 1135 | switch magnet |
---|
| 1136 | case AOmagnet.QP.CommonNames |
---|
| 1137 | val = AOmagnet.QP.TangoVal(str2double(magnet(end))); |
---|
| 1138 | case AOmagnet.CH.CommonNames |
---|
| 1139 | val = AOmagnet.CH.TangoVal(str2double(magnet(end))); |
---|
| 1140 | case AOmagnet.CV.CommonNames |
---|
| 1141 | val = AOmagnet.CV.TangoVal(str2double(magnet(end))); |
---|
| 1142 | end |
---|
| 1143 | |
---|
| 1144 | set(handles.(['slider' Qname]),'Value', val); |
---|
| 1145 | set(handles.(['edit' Qname]),'string', num2str(val)); |
---|
| 1146 | end |
---|
| 1147 | |
---|
| 1148 | set_model_values(handles); |
---|
| 1149 | |
---|
| 1150 | handles = computeTwiss(handles); |
---|
| 1151 | plot_axes(handles,handles.ytype); |
---|
| 1152 | %mat |
---|
| 1153 | %ylim([0 130]); |
---|
| 1154 | % Update handles structure |
---|
| 1155 | guidata(hObject, handles); |
---|
| 1156 | |
---|
| 1157 | %% Update date |
---|
| 1158 | set(handles.text_date,'String',datestr(now,0)); |
---|
| 1159 | |
---|
| 1160 | %save data |
---|
| 1161 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
| 1162 | |
---|
| 1163 | %-------------------------------------------------------------------------- |
---|
| 1164 | function handles = init_handles(handles) |
---|
| 1165 | %% Inits structure storing all the magnet data |
---|
| 1166 | |
---|
| 1167 | %% AT model used |
---|
| 1168 | % global THERING; |
---|
| 1169 | |
---|
| 1170 | A1 = getao; % Load AO for the first time |
---|
| 1171 | AOmagnet = []; |
---|
| 1172 | list = findmemberof('Magnet'); |
---|
| 1173 | for k = 1:length(list) |
---|
| 1174 | AOmagnet.(list{k}) = A1.(list{k}); |
---|
| 1175 | end |
---|
| 1176 | clear A1; |
---|
| 1177 | |
---|
| 1178 | %save data |
---|
| 1179 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
| 1180 | |
---|
| 1181 | store_model_values(handles); |
---|
| 1182 | |
---|
| 1183 | %% Update time |
---|
| 1184 | set(handles.text_date,'String',datestr(now,0)); |
---|
| 1185 | |
---|
| 1186 | %-------------------------------------------------------------------------- |
---|
| 1187 | function store_model_values(handles) |
---|
| 1188 | %% Stores model values in AOmagnet |
---|
| 1189 | |
---|
| 1190 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); % get AOmagnet structure |
---|
| 1191 | |
---|
| 1192 | % Loop over magnet types |
---|
| 1193 | FamilyName = fieldnames(AOmagnet); |
---|
| 1194 | |
---|
| 1195 | for k1 = 1:length(FamilyName) |
---|
| 1196 | AOmagnet.(FamilyName{k1}).ModelVal = getam(FamilyName{k1},'Model'); |
---|
| 1197 | end |
---|
| 1198 | |
---|
| 1199 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
| 1200 | |
---|
| 1201 | %-------------------------------------------------------------------------- |
---|
| 1202 | function set_model_values(handles) |
---|
| 1203 | % Set Modelvalue into LT1 AT model |
---|
| 1204 | |
---|
| 1205 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); % get AOmagnet structure |
---|
| 1206 | |
---|
| 1207 | %% Set model values to AT |
---|
| 1208 | FamilyName = fieldnames(AOmagnet); |
---|
| 1209 | |
---|
| 1210 | for k1 = 1:length(FamilyName) |
---|
| 1211 | magnet = AOmagnet.(FamilyName{k1}); |
---|
| 1212 | setsp(FamilyName{k1}, magnet.ModelVal,'Model'); |
---|
| 1213 | end |
---|
| 1214 | |
---|
| 1215 | |
---|
| 1216 | %-------------------------------------------------------------------------- |
---|
| 1217 | function submenu_print_setpoint_Callback(hObject, eventdata, handles) |
---|
| 1218 | % hObject handle to submenu_print_setpoint (see GCBO) |
---|
| 1219 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1220 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1221 | |
---|
| 1222 | |
---|
| 1223 | %-------------------------------------------------------------------------- |
---|
| 1224 | function submenu_print_model_Callback(hObject, eventdata, handles) |
---|
| 1225 | % hObject handle to submenu_print_model (see GCBO) |
---|
| 1226 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1227 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1228 | |
---|
| 1229 | |
---|
| 1230 | % ------------------------------------------------------------------------- |
---|
| 1231 | function submenu_save_setpoint_Callback(hObject, eventdata, handles) |
---|
| 1232 | % hObject handle to submenu_save_setpoint (see GCBO) |
---|
| 1233 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1234 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1235 | |
---|
| 1236 | |
---|
| 1237 | % ------------------------------------------------------------------------- |
---|
| 1238 | function submenu_save_model_Callback(hObject, eventdata, handles) |
---|
| 1239 | % hObject handle to submenu_save_model (see GCBO) |
---|
| 1240 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1241 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1242 | |
---|
| 1243 | |
---|
| 1244 | % ------------------------------------------------------------------------- |
---|
| 1245 | function submenu_load_setpoint_Callback(hObject, eventdata, handles) |
---|
| 1246 | % hObject handle to submenu_load_setpoint (see GCBO) |
---|
| 1247 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1248 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1249 | |
---|
| 1250 | |
---|
| 1251 | %-------------------------------------------------------------------------- |
---|
| 1252 | function submenu_load_model_Callback(hObject, eventdata, handles) |
---|
| 1253 | % hObject handle to submenu_load_model (see GCBO) |
---|
| 1254 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1255 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1256 | |
---|
| 1257 | |
---|
| 1258 | %-------------------------------------------------------------------------- |
---|
| 1259 | function Untitled_1_Callback(hObject, eventdata, handles) |
---|
| 1260 | % hObject handle to Untitled_1 (see GCBO) |
---|
| 1261 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1262 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1263 | |
---|
| 1264 | |
---|
| 1265 | %-------------------------------------------------------------------------- |
---|
| 1266 | function Untitled_4_Callback(hObject, eventdata, handles) |
---|
| 1267 | % hObject handle to Untitled_4 (see GCBO) |
---|
| 1268 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1269 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1270 | |
---|
| 1271 | |
---|
| 1272 | %-------------------------------------------------------------------------- |
---|
| 1273 | function Untitled_7_Callback(hObject, eventdata, handles) |
---|
| 1274 | % hObject handle to Untitled_7 (see GCBO) |
---|
| 1275 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1276 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1277 | |
---|
| 1278 | |
---|
| 1279 | % -------------------------------------------------------------------- |
---|
| 1280 | function submenu_dump_model_Callback(hObject, eventdata, handles) |
---|
| 1281 | % hObject handle to submenu_dump_model (see GCBO) |
---|
| 1282 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1283 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1284 | |
---|
| 1285 | % Get magnet AO |
---|
| 1286 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 1287 | |
---|
| 1288 | fprintf(' DeviceName Model s(m) phasex betax(m) etax(m) xcod(mm) phasez betaz(m) etaz(m) zcod(mm)\n') |
---|
| 1289 | |
---|
| 1290 | FamilyName = fieldnames(AOmagnet); |
---|
| 1291 | for k1 = 1:length(FamilyName) |
---|
| 1292 | alias = AOmagnet.(FamilyName{k1}); |
---|
| 1293 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
| 1294 | fprintf('%15s %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f \n', ... |
---|
| 1295 | alias.DeviceName{k2}, alias.ModelVal(k2), ... |
---|
| 1296 | handles.spos(alias.AT.ATIndex(k2),1), handles.phase(alias.AT.ATIndex(k2),1), ... |
---|
| 1297 | handles.beta(alias.AT.ATIndex(k2),1), handles.eta(alias.AT.ATIndex(k2),1), ... |
---|
| 1298 | handles.cod(alias.AT.ATIndex(k2),1), ... |
---|
| 1299 | handles.phase(alias.AT.ATIndex(k2),2), ... |
---|
| 1300 | handles.beta(alias.AT.ATIndex(k2),2), handles.eta(alias.AT.ATIndex(k2),2), ... |
---|
| 1301 | handles.cod(alias.AT.ATIndex(k2),2)); |
---|
| 1302 | end |
---|
| 1303 | end |
---|
| 1304 | |
---|
| 1305 | |
---|
| 1306 | %-------------------------------------------------------------------------- |
---|
| 1307 | function submenu_dump_setpoint_Callback(hObject, eventdata, handles) |
---|
| 1308 | % hObject handle to submenu_dump_setpoint (see GCBO) |
---|
| 1309 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1310 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1311 | |
---|
| 1312 | % Get magnet AO |
---|
| 1313 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 1314 | |
---|
| 1315 | fprintf('\n\n DeviceName TANGO\n') |
---|
| 1316 | |
---|
| 1317 | FamilyName = fieldnames(AOmagnet); |
---|
| 1318 | for k1 = 1:length(FamilyName) |
---|
| 1319 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
| 1320 | alias = AOmagnet.(FamilyName{k1}); |
---|
| 1321 | fprintf('%15s %6.2f \n', alias.DeviceName{k2}, ... |
---|
| 1322 | alias.TangoVal(k2)); |
---|
| 1323 | end |
---|
| 1324 | end |
---|
| 1325 | |
---|
| 1326 | |
---|
| 1327 | %-------------------------------------------------------------------------- |
---|
| 1328 | function submenu_dump_soleil_setpoint_Callback(hObject, eventdata, handles) |
---|
| 1329 | % hObject handle to submenu_dump_soleil_setpoint (see GCBO) |
---|
| 1330 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1331 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1332 | |
---|
| 1333 | fprintf('\n\n DeviceName Model TANGO\n') |
---|
| 1334 | |
---|
| 1335 | % Get magnet AO |
---|
| 1336 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
| 1337 | |
---|
| 1338 | FamilyName = fieldnames(AOmagnet); |
---|
| 1339 | for k1 = 1:length(FamilyName) |
---|
| 1340 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
| 1341 | alias = AOmagnet.(FamilyName{k1}); |
---|
| 1342 | fprintf('%15s %6.2f %6.2f\n', alias.DeviceName{k2}, ... |
---|
| 1343 | alias.ModelVal(k2), alias.TangoVal(k2)); |
---|
| 1344 | end |
---|
| 1345 | end |
---|
| 1346 | |
---|
| 1347 | |
---|
| 1348 | % -------------------------------------------------------------------- |
---|
| 1349 | function twiss_parameters_Callback(hObject, eventdata, handles) |
---|
| 1350 | % hObject handle to twiss_parameters (see GCBO) |
---|
| 1351 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1352 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1353 | |
---|
| 1354 | |
---|
| 1355 | % -------------------------------------------------------------------- |
---|
| 1356 | function submenu_twissparameters_entry_Callback(hObject, eventdata, handles) |
---|
| 1357 | % hObject handle to submenu_twissparameters_entry (see GCBO) |
---|
| 1358 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 1359 | % handles structure with handles and user data (see GUIDATA) |
---|
| 1360 | |
---|
| 1361 | twiss_parameters_entry(handles) |
---|
| 1362 | |
---|
| 1363 | |
---|
| 1364 | |
---|