[5] | 1 | function varargout = thomxringgui(varargin) |
---|
| 2 | % OPERATIONGUI M-file for thomxringgui.fig |
---|
| 3 | % OPERATIONGUI, by itself, creates a new OPERATIONGUI or raises the existing |
---|
| 4 | % singleton*. |
---|
| 5 | % |
---|
[26] | 6 | % |
---|
[5] | 7 | % H = OPERATIONGUI returns the handle to a new OPERATIONGUI or the handle to |
---|
| 8 | % the existing singleton*. |
---|
| 9 | % |
---|
| 10 | % OPERATIONGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
| 11 | % function named CALLBACK in OPERATIONGUI.M with the given input arguments. |
---|
| 12 | % |
---|
| 13 | % OPERATIONGUI('Property','Value',...) creates a new OPERATIONGUI or raises the |
---|
| 14 | % existing singleton*. Starting from the left, property value pairs are |
---|
| 15 | % applied to the GUI before operationgui_OpeningFcn gets called. An |
---|
| 16 | % unrecognized property name or invalid value makes property application |
---|
| 17 | % stop. All inputs are passed to operationgui_OpeningFcn via varargin. |
---|
| 18 | % |
---|
| 19 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
| 20 | % instance to run (singleton)". |
---|
| 21 | % |
---|
| 22 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
| 23 | |
---|
| 24 | % Edit the above text to modify the response to help operationgui |
---|
| 25 | |
---|
[28] | 26 | % Last Modified by GUIDE v2.5 25-Feb-2014 14:59:25 |
---|
[5] | 27 | |
---|
| 28 | % Begin initialization code - DO NOT EDIT |
---|
| 29 | % |
---|
| 30 | % Modified by Jianfeng Zhang @ LAL, 01/10/2013 |
---|
| 31 | % See also operationgui. |
---|
| 32 | % |
---|
| 33 | gui_Singleton = 1; |
---|
| 34 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 35 | 'gui_Singleton', gui_Singleton, ... |
---|
| 36 | 'gui_OpeningFcn', @operationgui_OpeningFcn, ... |
---|
| 37 | 'gui_OutputFcn', @operationgui_OutputFcn, ... |
---|
| 38 | 'gui_LayoutFcn', [] , ... |
---|
| 39 | 'gui_Callback', []); |
---|
| 40 | if nargin && ischar(varargin{1}) |
---|
| 41 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 42 | end |
---|
| 43 | |
---|
| 44 | if nargout |
---|
| 45 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 46 | else |
---|
| 47 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 48 | end |
---|
| 49 | % End initialization code - DO NOT EDIT |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | % --- Executes just before operationgui is made visible. |
---|
| 53 | function operationgui_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
| 54 | % This function has no output args, see OutputFcn. |
---|
| 55 | % hObject handle to figure |
---|
| 56 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 57 | % handles structure with handles and user data (see GUIDATA) |
---|
| 58 | % varargin command line arguments to operationgui (see VARARGIN) |
---|
| 59 | |
---|
| 60 | % Choose default command line output for operationgui |
---|
| 61 | handles.output = hObject; |
---|
| 62 | |
---|
| 63 | % Update handles structure |
---|
| 64 | guidata(hObject, handles); |
---|
| 65 | |
---|
| 66 | % UIWAIT makes operationgui wait for user response (see UIRESUME) |
---|
| 67 | % uiwait(handles.FigMenuGui); |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | % --- Outputs from this function are returned to the command line. |
---|
| 71 | function varargout = operationgui_OutputFcn(hObject, eventdata, handles) |
---|
| 72 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 73 | % hObject handle to figure |
---|
| 74 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 75 | % handles structure with handles and user data (see GUIDATA) |
---|
| 76 | |
---|
| 77 | % Get default command line output from handles structure |
---|
| 78 | varargout{1} = handles.output; |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | % --- Executes on button press in pushbutton_plotfamily. |
---|
| 82 | function pushbutton_plotfamily_Callback(hObject, eventdata, handles) |
---|
| 83 | % hObject handle to pushbutton_plotfamily (see GCBO) |
---|
| 84 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 85 | % handles structure with handles and user data (see GUIDATA) |
---|
| 86 | plotfamily; |
---|
| 87 | |
---|
[25] | 88 | % --- Executes on button press in pushbutton_empty. |
---|
| 89 | function pushbutton_empty_Callback(hObject, eventdata, handles) |
---|
| 90 | % hObject handle to pushbutton_empty (see GCBO) |
---|
[5] | 91 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 92 | % handles structure with handles and user data (see GUIDATA) |
---|
| 93 | |
---|
[25] | 94 | |
---|
| 95 | % place holder..... |
---|
| 96 | |
---|
[5] | 97 | % --- Executes on button press in pushbutton19. |
---|
| 98 | function pushbutton19_Callback(hObject, eventdata, handles) |
---|
| 99 | % hObject handle to pushbutton19 (see GCBO) |
---|
| 100 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 101 | % handles structure with handles and user data (see GUIDATA) |
---|
| 102 | %Variation_points_source; |
---|
| 103 | |
---|
| 104 | |
---|
[25] | 105 | % --- Executes on button press in pushbutton_measbeta. |
---|
| 106 | function pushbutton_measbeta_Callback(hObject, eventdata, handles) |
---|
| 107 | % hObject handle to pushbutton_measbeta (see GCBO) |
---|
[5] | 108 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 109 | % handles structure with handles and user data (see GUIDATA) |
---|
| 110 | |
---|
[25] | 111 | measbeta; |
---|
[5] | 112 | |
---|
[28] | 113 | % --- Executes on button press in pushbutton_meas. |
---|
| 114 | function pushbutton_meas_Callback(hObject, eventdata, handles) |
---|
| 115 | % hObject handle to pushbutton_meas (see GCBO) |
---|
[5] | 116 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 117 | % handles structure with handles and user data (see GUIDATA) |
---|
| 118 | |
---|
| 119 | % to be updated for ThomX |
---|
[28] | 120 | measmcf; |
---|
[5] | 121 | |
---|
| 122 | % --- Executes on button press in pushbutton_setoperationalmode. |
---|
| 123 | function pushbutton_setoperationalmode_Callback(hObject, eventdata, handles) |
---|
| 124 | % hObject handle to pushbutton_setoperationalmode (see GCBO) |
---|
| 125 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 126 | % handles structure with handles and user data (see GUIDATA) |
---|
| 127 | setoperationalmode |
---|
| 128 | |
---|
| 129 | % --- Executes on button press in pushbutton_cyclage. |
---|
| 130 | function pushbutton_cyclage_Callback(hObject, eventdata, handles) |
---|
| 131 | % hObject handle to pushbutton_cyclage (see GCBO) |
---|
| 132 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 133 | % handles structure with handles and user data (see GUIDATA) |
---|
| 134 | Ringcycling; |
---|
| 135 | |
---|
| 136 | % --- Executes on button press in pushbutton_configgui. |
---|
| 137 | function pushbutton_configgui_Callback(hObject, eventdata, handles) |
---|
| 138 | % hObject handle to pushbutton_configgui (see GCBO) |
---|
| 139 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 140 | % handles structure with handles and user data (see GUIDATA) |
---|
| 141 | configgui; |
---|
| 142 | |
---|
| 143 | % --- Executes on button press in pushbutton_setchrogolden. |
---|
| 144 | function pushbutton_setchrogolden_Callback(hObject, eventdata, handles) |
---|
| 145 | % hObject handle to pushbutton_setchrogolden (see GCBO) |
---|
| 146 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 147 | % handles structure with handles and user data (see GUIDATA) |
---|
| 148 | |
---|
| 149 | %% need to change back to the online model 'setchro('Physics')' when the ThomX machine is ready |
---|
| 150 | setchro('Physics','Simulator'); |
---|
| 151 | |
---|
| 152 | % --- Executes on button press in pushbuttonstepchro. |
---|
| 153 | function pushbuttonstepchro_Callback(hObject, eventdata, handles) |
---|
| 154 | % hObject handle to pushbuttonstepchro (see GCBO) |
---|
| 155 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 156 | % handles structure with handles and user data (see GUIDATA) |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | %% Need to change back to the 'online' model in the future for the ThomX... |
---|
| 160 | %pop up a dialog window to input the tune change range |
---|
| 161 | answer = inputdlg({'Change the horizontal chromaticity by', 'Change the vertical chromaticity by'},'STEPCHRO',1,{'0','0'}); |
---|
| 162 | if isempty(answer) |
---|
| 163 | return |
---|
| 164 | end |
---|
| 165 | |
---|
| 166 | DeltaChrom(1,1) = str2num(answer{1}); |
---|
| 167 | DeltaChrom(2,1) = str2num(answer{2}); |
---|
| 168 | |
---|
[13] | 169 | if (abs(DeltaChrom(1,1)) >= 1.0 || abs(DeltaChrom(2,1))>=1.0) |
---|
| 170 | errordlg('Chromaticity change should be less than 1.0','Chromaticity change error'); |
---|
| 171 | return; |
---|
| 172 | end |
---|
[5] | 173 | %InitialChrom = measchro; |
---|
| 174 | InitialChrom = measchro('Model'); |
---|
| 175 | FinalChrom = InitialChrom + DeltaChrom; |
---|
| 176 | |
---|
| 177 | while (abs(DeltaChrom(1)) > 1e-3 || abs(DeltaChrom(2)) > 1e-3) |
---|
| 178 | stepchro(DeltaChrom, 'Physics'); |
---|
| 179 | %stepchro('Physics'); |
---|
| 180 | DeltaChrom = FinalChrom-measchro('Model'); |
---|
| 181 | %DeltaChrom = FinalChrom-measchro; |
---|
| 182 | end |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | % --- Executes on button press in pushbutton_measchro. |
---|
| 188 | function pushbutton_measchro_Callback(hObject, eventdata, handles) |
---|
| 189 | % hObject handle to pushbutton_measchro (see GCBO) |
---|
| 190 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 191 | % handles structure with handles and user data (see GUIDATA) |
---|
| 192 | |
---|
| 193 | %% need to change back to 'measchro('Physics','Display')' when the ThomX ring is ready... |
---|
[17] | 194 | %% by Jianfeng Zhang @ LAL, 11/2013 |
---|
[5] | 195 | measchro('Simulator','Physics','Display'); |
---|
| 196 | %measchro('Physics','Display'); |
---|
| 197 | |
---|
| 198 | % --- Executes on button press in pushbutton_settunegolden. |
---|
| 199 | function pushbutton_settunegolden_Callback(hObject, eventdata, handles) |
---|
| 200 | % hObject handle to pushbutton_settunegolden (see GCBO) |
---|
| 201 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 202 | % handles structure with handles and user data (see GUIDATA) |
---|
| 203 | settune; |
---|
| 204 | |
---|
| 205 | % --- Executes on button press in pushbutton_steptune. |
---|
| 206 | function pushbutton_steptune_Callback(hObject, eventdata, handles) |
---|
| 207 | % hObject handle to pushbutton_steptune (see GCBO) |
---|
| 208 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 209 | % handles structure with handles and user data (see GUIDATA) |
---|
| 210 | |
---|
| 211 | %pop up a dialog window to input the tune change range |
---|
| 212 | answer = inputdlg({'Change the horizontal tune by', 'Change the vertical tune by'},'STEPTUNE',1,{'0','0'}); |
---|
| 213 | if isempty(answer) |
---|
| 214 | return |
---|
| 215 | end |
---|
| 216 | DeltaTune(1,1) = str2num(answer{1}); |
---|
| 217 | DeltaTune(2,1) = str2num(answer{2}); |
---|
[13] | 218 | |
---|
[25] | 219 | if (abs(DeltaTune(1,1)) >= 0.1 || abs(DeltaTune(2,1))>=0.1) |
---|
| 220 | errordlg('Tune change should be less than 0.1','Tune change error'); |
---|
[13] | 221 | return; |
---|
| 222 | end |
---|
| 223 | |
---|
[5] | 224 | InitialTune = gettune; |
---|
| 225 | FinalTune = InitialTune + DeltaTune; |
---|
| 226 | |
---|
| 227 | while (abs(DeltaTune(1)) > 1e-4 || abs(DeltaTune(2)) > 1e-4) |
---|
| 228 | steptune(DeltaTune); |
---|
| 229 | DeltaTune = FinalTune-gettune; |
---|
| 230 | end |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | % --- Executes on button press in pushbutton_measchroFBT. |
---|
| 234 | function pushbutton_measchroFBT_Callback(hObject, eventdata, handles) |
---|
| 235 | % hObject handle to pushbutton_measchroFBT (see GCBO) |
---|
| 236 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 237 | % handles structure with handles and user data (see GUIDATA) |
---|
| 238 | |
---|
| 239 | % to be updated for ThomX |
---|
| 240 | % measchroFBT('Physics') |
---|
| 241 | |
---|
| 242 | % --- Executes on button press in pushbutton_stepchroFBT. |
---|
| 243 | function pushbutton_stepchroFBT_Callback(hObject, eventdata, handles) |
---|
| 244 | % hObject handle to pushbutton_stepchroFBT (see GCBO) |
---|
| 245 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 246 | % handles structure with handles and user data (see GUIDATA) |
---|
| 247 | stepchro('Physics'); |
---|
| 248 | |
---|
| 249 | % --- Executes on button press in pushbutton_setchroGoldenFBT. |
---|
| 250 | function pushbutton_setchroGoldenFBT_Callback(hObject, eventdata, handles) |
---|
| 251 | % hObject handle to pushbutton_setchroGoldenFBT (see GCBO) |
---|
| 252 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 253 | % handles structure with handles and user data (see GUIDATA) |
---|
| 254 | setchro('Physics','FBT'); |
---|
| 255 | |
---|
| 256 | % --- Executes on button press in pushbutton_settuneGoldenFBT. |
---|
| 257 | function pushbutton_settuneGoldenFBT_Callback(hObject, eventdata, handles) |
---|
| 258 | % hObject handle to pushbutton_settuneGoldenFBT (see GCBO) |
---|
| 259 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 260 | % handles structure with handles and user data (see GUIDATA) |
---|
| 261 | |
---|
| 262 | % to be updated for ThomX |
---|
| 263 | % settune('FBT'); |
---|
| 264 | |
---|
| 265 | % --- Executes on button press in pushbutton_steptuneFBT. |
---|
| 266 | function pushbutton_steptuneFBT_Callback(hObject, eventdata, handles) |
---|
| 267 | % hObject handle to pushbutton_steptuneFBT (see GCBO) |
---|
| 268 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 269 | % handles structure with handles and user data (see GUIDATA) |
---|
| 270 | |
---|
| 271 | % to be updated for ThomX |
---|
| 272 | %steptune; |
---|
| 273 | |
---|
| 274 | % --- Executes on button press in pushbutton_getpinhole. |
---|
| 275 | function pushbutton_getpinhole_Callback(hObject, eventdata, handles) |
---|
| 276 | % hObject handle to pushbutton_getpinhole (see GCBO) |
---|
| 277 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 278 | % handles structure with handles and user data (see GUIDATA) |
---|
| 279 | getpinhole('NoArchive') |
---|
| 280 | |
---|
| 281 | % --- Executes on button press in pushbutton_lifetime. |
---|
| 282 | function pushbutton_lifetime_Callback(hObject, eventdata, handles) |
---|
| 283 | % hObject handle to pushbutton_lifetime (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 | measlifetime(30,'Display'); |
---|
| 287 | |
---|
| 288 | % --- Executes on button press in pushbutton_monbpm. |
---|
| 289 | function pushbutton_monbpm_Callback(hObject, eventdata, handles) |
---|
| 290 | % hObject handle to pushbutton_monbpm (see GCBO) |
---|
| 291 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 292 | % handles structure with handles and user data (see GUIDATA) |
---|
| 293 | monbpm(60); |
---|
| 294 | |
---|
| 295 | % --- Executes on button press in pushbutton_BBA. |
---|
| 296 | function pushbutton_BBA_Callback(hObject, eventdata, handles) |
---|
| 297 | % hObject handle to pushbutton_BBA (see GCBO) |
---|
| 298 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 299 | % handles structure with handles and user data (see GUIDATA) |
---|
| 300 | bbacentergui |
---|
| 301 | |
---|
| 302 | % --- Executes on button press in pushbutton_checklibera. |
---|
| 303 | function pushbutton_checklibera_Callback(hObject, eventdata, handles) |
---|
| 304 | % hObject handle to pushbutton_checklibera (see GCBO) |
---|
| 305 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 306 | % handles structure with handles and user data (see GUIDATA) |
---|
| 307 | Check_Libera_config |
---|
| 308 | |
---|
| 309 | % --- Executes on button press in pushbutton_findrf. |
---|
| 310 | function pushbutton_findrf_Callback(hObject, eventdata, handles) |
---|
| 311 | % hObject handle to pushbutton_findrf (see GCBO) |
---|
| 312 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 313 | % handles structure with handles and user data (see GUIDATA) |
---|
| 314 | findrf; |
---|
| 315 | |
---|
| 316 | % --- Executes on button press in pushbutton_firstturn. |
---|
| 317 | function pushbutton_firstturn_Callback(hObject, eventdata, handles) |
---|
| 318 | % hObject handle to pushbutton_firstturn (see GCBO) |
---|
| 319 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 320 | % handles structure with handles and user data (see GUIDATA) |
---|
| 321 | getbpmsum; |
---|
| 322 | |
---|
| 323 | |
---|
| 324 | % --- Executes on button press in pushbutton_gettune. |
---|
| 325 | function pushbutton_gettune_Callback(hObject, eventdata, handles) |
---|
| 326 | % hObject handle to pushbutton_gettune (see GCBO) |
---|
| 327 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 328 | % handles structure with handles and user data (see GUIDATA) |
---|
| 329 | gettune |
---|
| 330 | |
---|
| 331 | % --- Executes on button press in pushbutton_gettuneFBT. |
---|
| 332 | function pushbutton_gettuneFBT_Callback(hObject, eventdata, handles) |
---|
| 333 | % hObject handle to pushbutton_gettuneFBT (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 | % to be updated for ThomX |
---|
| 338 | %gettuneFBT |
---|
| 339 | |
---|
| 340 | |
---|
| 341 | % --- Executes on button press in pushbutton_steprf. |
---|
| 342 | function pushbutton_steprf_Callback(hObject, eventdata, handles) |
---|
| 343 | % hObject handle to pushbutton_steprf (see GCBO) |
---|
| 344 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 345 | % handles structure with handles and user data (see GUIDATA) |
---|
| 346 | Step_RF_Progressive; |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | % --- Executes on button press in pushbutton_BeamsizeTunette. |
---|
| 350 | function pushbutton_BeamsizeTunette_Callback(hObject, eventdata, handles) |
---|
| 351 | % hObject handle to pushbutton_BeamsizeTunette (see GCBO) |
---|
| 352 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 353 | % handles structure with handles and user data (see GUIDATA) |
---|
| 354 | BeamSizeTunette |
---|
| 355 | |
---|
| 356 | |
---|
| 357 | |
---|
[25] | 358 | |
---|
| 359 | |
---|
| 360 | % --- Executes on button press in pushbutton_measdisp. |
---|
| 361 | function pushbutton_measdisp_Callback(hObject, eventdata, handles) |
---|
| 362 | % hObject handle to pushbutton_measdisp (see GCBO) |
---|
| 363 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 364 | % handles structure with handles and user data (see GUIDATA) |
---|
| 365 | |
---|
| 366 | measdisp; |
---|