Merge patches from branch 'objectify'
This commit is contained in:
		
						commit
						dae8c23926
					
				| @ -4,11 +4,11 @@ close all | |||||||
| %Script for calling the functions of TR-EPR toolbox | %Script for calling the functions of TR-EPR toolbox | ||||||
| 
 | 
 | ||||||
| %path to dataset | %path to dataset | ||||||
| % datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat'; | datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat'; | ||||||
| % [raw_data,params] = load_matlab(datapath); | [raw_data,params] = load_matlab(datapath); | ||||||
| 
 | 
 | ||||||
| datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\pentacene_355nm_481pt.DSC'; | % datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\pentacene_355nm_481pt.DSC'; | ||||||
| [raw_data,params] = load_bruker(datapath); | % [raw_data,params] = load_bruker(datapath); | ||||||
| 
 | 
 | ||||||
| [time_corr_data,params] = correct_time_baseline(raw_data,params); | [time_corr_data,params] = correct_time_baseline(raw_data,params); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,11 +25,11 @@ plotpanel.Units = 'Normalized'; | |||||||
| plotpanel.Position = [.01 .06 .98 .92]; | plotpanel.Position = [.01 .06 .98 .92]; | ||||||
| %axes for plot | %axes for plot | ||||||
| ax = axes(plotpanel); | ax = axes(plotpanel); | ||||||
| ax.XLabel.String = 'Time'; |  | ||||||
| ax.YLabel.String = 'Intensity'; |  | ||||||
| %plot current data in figure with time as x axis | %plot current data in figure with time as x axis | ||||||
| plot(ax,dataIN) | plot(ax,dataIN) | ||||||
| axis tight | xlabel(ax,'Time Points'); | ||||||
|  | ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  | axis(ax,'tight'); | ||||||
| 
 | 
 | ||||||
| %create push buttons | %create push buttons | ||||||
| a = uicontrol(fig,'Style','pushbutton'); | a = uicontrol(fig,'Style','pushbutton'); | ||||||
| @ -91,7 +91,9 @@ uiwait(fig) | |||||||
|         dataOUT = dataIN / max(maxima_mean); |         dataOUT = dataIN / max(maxima_mean); | ||||||
|         %plotting result with time as x axis |         %plotting result with time as x axis | ||||||
|         plot(ax,dataOUT) |         plot(ax,dataOUT) | ||||||
|         axis tight |         xlabel(ax,'Time Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|         %writing parameter |         %writing parameter | ||||||
|         params.region_of_max = [left_point right_point]; |         params.region_of_max = [left_point right_point]; | ||||||
|         params.max_mean = maxima_mean / max(maxima_mean); |         params.max_mean = maxima_mean / max(maxima_mean); | ||||||
| @ -99,7 +101,9 @@ uiwait(fig) | |||||||
| 
 | 
 | ||||||
|     function NormResetButtonPushed(~,~) |     function NormResetButtonPushed(~,~) | ||||||
|         plot(ax,dataIN) |         plot(ax,dataIN) | ||||||
|         axis tight |         xlabel(ax,'Time Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function NormDoneButtonPushed(~,~) |     function NormDoneButtonPushed(~,~) | ||||||
|  | |||||||
| @ -26,12 +26,12 @@ plotpanel.Units = 'Normalized'; | |||||||
| plotpanel.Position = [.01 .06 .98 .92]; | plotpanel.Position = [.01 .06 .98 .92]; | ||||||
| %axes for plot | %axes for plot | ||||||
| ax = axes(plotpanel); | ax = axes(plotpanel); | ||||||
| ax.XLabel.String = 'Magnetic field'; |  | ||||||
| ax.YLabel.String = 'Intensity'; |  | ||||||
| %plot current data in figure with field as x axis | %plot current data in figure with field as x axis | ||||||
| dataIN_transp = dataIN.'; | dataIN_transp = dataIN.'; | ||||||
| plot(ax,dataIN_transp) | plot(ax,dataIN_transp) | ||||||
| axis tight | xlabel(ax,'Magnetic Field Points'); | ||||||
|  | ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  | axis(ax,'tight'); | ||||||
| 
 | 
 | ||||||
| %create push buttons | %create push buttons | ||||||
| a = uicontrol(fig,'Style','pushbutton'); | a = uicontrol(fig,'Style','pushbutton'); | ||||||
| @ -102,7 +102,9 @@ uiwait(fig) | |||||||
|         %plotting result with field as x axis |         %plotting result with field as x axis | ||||||
|         dataOUT_transp = dataOUT.'; |         dataOUT_transp = dataOUT.'; | ||||||
|         plot(ax,dataOUT_transp) |         plot(ax,dataOUT_transp) | ||||||
|         axis tight |         xlabel(ax,'Magnetic Field Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|         %adjusting parameter |         %adjusting parameter | ||||||
|         params.Field_Sweep = params.Field_Sweep - params.Field_Step*2*field_cut; |         params.Field_Sweep = params.Field_Sweep - params.Field_Step*2*field_cut; | ||||||
|         params.Field_Start = params.Field_Start + params.Field_Step*field_cut; |         params.Field_Start = params.Field_Start + params.Field_Step*field_cut; | ||||||
| @ -116,7 +118,9 @@ uiwait(fig) | |||||||
| 
 | 
 | ||||||
|     function FieldResetButtonPushed(~,~) |     function FieldResetButtonPushed(~,~) | ||||||
|         plot(ax,dataIN_transp) |         plot(ax,dataIN_transp) | ||||||
|         axis tight |         xlabel(ax,'Magnetic Field Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function FieldDoneButtonPushed(~,~) |     function FieldDoneButtonPushed(~,~) | ||||||
|  | |||||||
| @ -24,11 +24,11 @@ plotpanel.Units = 'Normalized'; | |||||||
| plotpanel.Position = [.01 .06 .98 .92]; | plotpanel.Position = [.01 .06 .98 .92]; | ||||||
| %axes for plot | %axes for plot | ||||||
| ax = axes(plotpanel); | ax = axes(plotpanel); | ||||||
| ax.XLabel.String = 'Time'; |  | ||||||
| ax.YLabel.String = 'Intensity'; |  | ||||||
| %plot current data in figure | %plot current data in figure | ||||||
| plot(ax,dataIN) | plot(ax,dataIN) | ||||||
| axis tight | xlabel(ax,'Time Points'); | ||||||
|  | ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  | axis(ax,'tight'); | ||||||
| 
 | 
 | ||||||
| %create push buttons | %create push buttons | ||||||
| a = uicontrol(fig,'Style','pushbutton'); | a = uicontrol(fig,'Style','pushbutton'); | ||||||
| @ -83,14 +83,18 @@ uiwait(fig) | |||||||
|         end |         end | ||||||
|         %plotting result |         %plotting result | ||||||
|         plot(ax,dataOUT) |         plot(ax,dataOUT) | ||||||
|         axis tight |         xlabel(ax,'Time Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|         %writing parameter |         %writing parameter | ||||||
|         params.pretrigger = pretrigger; |         params.pretrigger = pretrigger; | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function TimeResetButtonPushed(~,~) |     function TimeResetButtonPushed(~,~) | ||||||
|         plot(ax,dataIN) |         plot(ax,dataIN) | ||||||
|         axis tight |         xlabel(ax,'Time Points'); | ||||||
|  |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function TimeDoneButtonPushed(~,~) |     function TimeDoneButtonPushed(~,~) | ||||||
|  | |||||||
| @ -27,11 +27,11 @@ plotpanel.Units = 'Normalized'; | |||||||
| plotpanel.Position = [.01 .01 .7 .98]; | plotpanel.Position = [.01 .01 .7 .98]; | ||||||
| %axes for plot | %axes for plot | ||||||
| ax = axes(plotpanel); | ax = axes(plotpanel); | ||||||
| ax.XLabel.String = 'magnetic field'; |  | ||||||
| ax.YLabel.String = 'Intensity'; |  | ||||||
| %plot current data in figure with field as x axis | %plot current data in figure with field as x axis | ||||||
| plot(ax,0.1*params.Field_Vector,params.max_mean,'r') | plot(ax,0.1*params.Field_Vector,params.max_mean,'r') | ||||||
| axis tight | xlabel(ax,'Magnetic Field / mT'); | ||||||
|  | ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  | axis(ax,'tight'); | ||||||
| 
 | 
 | ||||||
| %% create push buttons | %% create push buttons | ||||||
| a = uicontrol(fig,'Style','pushbutton'); | a = uicontrol(fig,'Style','pushbutton'); | ||||||
| @ -289,8 +289,10 @@ uiwait(fig) | |||||||
|         %plot result |         %plot result | ||||||
|         plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... |         plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | ||||||
|              bfield,spec_norm,'b','LineWidth',1.2) |              bfield,spec_norm,'b','LineWidth',1.2) | ||||||
|         legend('experimental','simulation') |         xlabel(ax,'Magnetic Field / mT'); | ||||||
|         axis tight |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|  |         legend(ax,'experimental','simulation'); | ||||||
|  |         axis(ax,'tight'); | ||||||
|         %write manual fit to params |         %write manual fit to params | ||||||
|         params.Manual_Sys = Sys; |         params.Manual_Sys = Sys; | ||||||
|         params.Triplett_pop = Exp.Temperature; |         params.Triplett_pop = Exp.Temperature; | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ eventdata.manExp.CenterSweep = 0.1*[params.Field_Center params.Field_Sweep]; % m | |||||||
| eventdata.manExp.Harmonic = 0; % zeroth harmonic | eventdata.manExp.Harmonic = 0; % zeroth harmonic | ||||||
| eventdata.manExp.Temperature = params.Triplett_pop; | eventdata.manExp.Temperature = params.Triplett_pop; | ||||||
| eventdata.simSys = params.Manual_Sys; %initialize simulation parameters | eventdata.simSys = params.Manual_Sys; %initialize simulation parameters | ||||||
|  | eventdata.simSys.Temperature = params.Triplett_pop; | ||||||
| eventdata.simExp = eventdata.manExp; | eventdata.simExp = eventdata.manExp; | ||||||
| eventdata.SaveStat = 0; %counter if save button was pushed | eventdata.SaveStat = 0; %counter if save button was pushed | ||||||
| 
 | 
 | ||||||
| @ -48,7 +49,7 @@ spec_norm = spec/max(spec); % normalize the simulation | |||||||
| plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | ||||||
|      bfield,spec_norm,'b','LineWidth',1.2) |      bfield,spec_norm,'b','LineWidth',1.2) | ||||||
| xlabel 'Magnetic Field / mT' | xlabel 'Magnetic Field / mT' | ||||||
| ylabel 'EPR signal / A. U.' | ylabel 'EPR Signal / A. U.' | ||||||
| legend('experimental','simulation') | legend('experimental','simulation') | ||||||
| axis tight | axis tight | ||||||
| 
 | 
 | ||||||
| @ -328,15 +329,20 @@ uiwait(fig) | |||||||
|         %get previous simulation parameters (manual or saved) |         %get previous simulation parameters (manual or saved) | ||||||
|         Sys0 = eventdata.simSys; |         Sys0 = eventdata.simSys; | ||||||
|         Exp0 = eventdata.simExp; |         Exp0 = eventdata.simExp; | ||||||
|  |         %check if Temperature can run into negative | ||||||
|  |         for nT = 1:3 | ||||||
|  |             if Sys0.Temperature(nT) - Vary.Temperature(nT) < 0 | ||||||
|  |                  warndlg('Triplett population boundary < 0!','Warning'); | ||||||
|  |             end | ||||||
|  |         end | ||||||
|         %perform fit |         %perform fit | ||||||
|         Sys0.Temperature = [0 0 0]; |  | ||||||
|         [BestSys,BestSpc] = esfit('thyme',params.max_mean,Sys0,Vary,Exp0,[],FitOpt); |         [BestSys,BestSpc] = esfit('thyme',params.max_mean,Sys0,Vary,Exp0,[],FitOpt); | ||||||
|         plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... |         plot(ax,0.1*params.Field_Vector,params.max_mean,'r',... | ||||||
|                 0.1*params.Field_Vector,BestSpc,'b','LineWidth',1.2) |                 0.1*params.Field_Vector,BestSpc,'b','LineWidth',1.2); | ||||||
|         xlabel 'Magnetic Field / mT' |         xlabel(ax,'Magnetic Field / mT'); | ||||||
|         ylabel 'EPR signal / A. U.' |         ylabel(ax,'EPR Signal / A. U.'); | ||||||
|         legend('experimental','simulation') |         legend(ax,'experimental','simulation'); | ||||||
|         axis tight |         axis(ax,'tight'); | ||||||
|         %normalize Triplett population |         %normalize Triplett population | ||||||
|         Tsum = sum(BestSys.Temperature); |         Tsum = sum(BestSys.Temperature); | ||||||
|         BestSys.Temperature = BestSys.Temperature ./ Tsum; |         BestSys.Temperature = BestSys.Temperature ./ Tsum; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user