/ATF2/FlightSim/testApps/mOTR/calib_find.m

http://atf2flightsim.googlecode.com/ · MATLAB · 114 lines · 47 code · 18 blank · 49 comment · 4 complexity · cad37d74491bb2607580c2414ec188e5 MD5 · raw file

  1. function varargout = calib_find(varargin)
  2. % CALIB_FIND MATLAB code for calib_find.fig
  3. % CALIB_FIND, by itself, creates a new CALIB_FIND or raises the existing
  4. % singleton*.
  5. %
  6. % H = CALIB_FIND returns the handle to a new CALIB_FIND or the handle to
  7. % the existing singleton*.
  8. %
  9. % CALIB_FIND('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in CALIB_FIND.M with the given input arguments.
  11. %
  12. % CALIB_FIND('Property','Value',...) creates a new CALIB_FIND or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before calib_find_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to calib_find_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. % Edit the above text to modify the response to help calib_find
  23. % Last Modified by GUIDE v2.5 15-Nov-2010 15:37:45
  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton', gui_Singleton, ...
  28. 'gui_OpeningFcn', @calib_find_OpeningFcn, ...
  29. 'gui_OutputFcn', @calib_find_OutputFcn, ...
  30. 'gui_LayoutFcn', [] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end
  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT
  41. % --- Executes just before calib_find is made visible.
  42. function calib_find_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdata reserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to calib_find (see VARARGIN)
  48. handles.startGuiHandles=varargin{1};
  49. % Choose default command line output for calib_find
  50. handles.output = hObject;
  51. % Update handles structure
  52. guidata(hObject, handles);
  53. % UIWAIT makes calib_find wait for user response (see UIRESUME)
  54. % uiwait(handles.figure1);
  55. % --- Outputs from this function are returned to the command line.
  56. function varargout = calib_find_OutputFcn(hObject, eventdata, handles)
  57. % varargout cell array for returning output args (see VARARGOUT);
  58. % hObject handle to figure
  59. % eventdata reserved - to be defined in a future version of MATLAB
  60. % handles structure with handles and user data (see GUIDATA)
  61. % Get default command line output from handles structure
  62. varargout{1} = handles.output;
  63. % --- Executes on button press in continue_calib_find.
  64. function continue_calib_find_Callback(hObject, eventdata, handles)
  65. % hObject handle to continue_calib_find (see GCBO)
  66. % eventdata reserved - to be defined in a future version of MATLAB
  67. % handles structure with handles and user data (see GUIDATA)
  68. handles=varagin{1}
  69. % orbit0 - orbit3 = [x x' y y' dx dx' dy dy'] orbit fits and errors
  70. [stat orbit0 orbit1 orbit2 orbit3] = fsCom('OrbitFit',5);
  71. if stat{1}~=1
  72. set(handles.text_under_screen,'String',stat{2})
  73. pause(3)
  74. set(handles.text_under_screen,'String','')
  75. else
  76. fit_x_zero=lcaGet(handles.RDBL{(1+3*otr_numb)})+eval(['orbit',num2str(handles.startGuiHandles.otr_numb),'(1)'])*10e6/handles.cal(1+handles.otr_numb,5);%PLUS SIGN BECAUSE VOLTS AND MICRONS GROW OPPOSITE
  77. fit_y_zero=lcaGet(handles.RDBL{(2+3*otr_numb)})-eval(['orbit',num2str(handles.startGuiHandles.otr_numb),'(3)'])*10e6/handles.cal(1+handles.otr_numb,6);
  78. if ~exist('fit_beam.dat')
  79. fit_beam(1+handles.startGuiHandles.otr_numb,2)=fit_x_zero;
  80. fit_beam(1+handles.startGuiHandles.otr_numb,3)=fit_y_zero;
  81. fit_beam(1+handles.startGuiHandles.otr_numb,4)=1;
  82. save('fit_beam.dat','fit_beam','-ascii')
  83. else
  84. load('fit_beam.dat','fit_beam','-ascii')
  85. fit_beam(1+handles.startGuiHandles.otr_numb,2)=fit_x_zero;
  86. fit_beam(1+handles.startGuiHandles.otr_numb,3)=fit_y_zero;
  87. fit_beam(1+handles.startGuiHandles.otr_numb,4)=1;
  88. save('fit_beam.dat','fit_beam','-ascii')
  89. end
  90. end
  91. % --- Executes on button press in cancel_calib_find.
  92. function cancel_calib_find_Callback(hObject, eventdata, handles)
  93. % hObject handle to cancel_calib_find (see GCBO)
  94. % eventdata reserved - to be defined in a future version of MATLAB
  95. % handles structure with handles and user data (see GUIDATA)
  96. delete(gcf)