Merge branch 'objectify' trying to get rid off uncommon flows
This commit is contained in:
		
						commit
						b76cf58945
					
				| @ -4,15 +4,17 @@ 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'; | ||||||
|  | [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); | ||||||
| 
 | 
 | ||||||
| [full_corr_data,params] = correct_magnetic_baseline(time_corr_data,params); | [full_corr_data,params] = correct_magnetic_baseline(time_corr_data,params); | ||||||
| 
 | 
 | ||||||
| [norm_data,params] = normalize_data(full_corr_data,params); | [norm_data,params] = average_maximum(full_corr_data,params); | ||||||
| 
 | 
 | ||||||
| [params] = pre_simulation_TREPR(params); | [params] = pre_simulation_TREPR(params); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,20 +1,20 @@ | |||||||
| function [dataOUT,params] = normalize_data(dataIN,params) | function [dataOUT,params] = average_maximum(dataIN,params) | ||||||
| %NORMALISE_DATA normalizes data by max of region | %AVERAGE_MAXIMUM normalizes data by max of region | ||||||
| % | % | ||||||
| %   Usage: [dataOUT,params] = NORMALISE_DATA(dataIN,params), where dataIN | %   Usage: [dataOUT,params] = AVERAGE_MAXIMUM(dataIN,params), where dataIN | ||||||
| %   is a dataset loaded via the LOAD_MATLAB or LOAD_BRUKER function. | %   is a dataset loaded via the LOAD_MATLAB or LOAD_BRUKER function. | ||||||
| % | % | ||||||
| %   The function will show the input data and offer two input fields, where | %   The function will show the input data and offer two input fields, where | ||||||
| %   the left and right borders of the maximum's region should be set. | %   the left and right borders of the maximum's region should be set. | ||||||
| %   By pressing "Apply" the normalization will be executed and the graph | %   By pressing "Apply" normalization to maximum will be executed and the | ||||||
| %   changes to the normalized data. The borders of the maximum region and | %   graph changes to the normalized data. The borders of the maximum region | ||||||
| %   the mean of maximums will also be appended to the params struct. | %   and the mean of maxima will also be appended to the params struct. | ||||||
| %   By pressing "Reset" the graph will return to show the original data. | %   By pressing "Reset" the graph will return to show the original data. | ||||||
| %   Exit the function by pressing "Done". | %   Exit the function by pressing "Done". | ||||||
| 
 | 
 | ||||||
| %% creating UI | %% creating UI | ||||||
| fig = figure; | fig = figure; | ||||||
| fig.Name = 'Normalize Data'; | fig.Name = 'Average of Data in Maximum'; | ||||||
| fig.Units = 'Normalized'; | fig.Units = 'Normalized'; | ||||||
| fig.Position = [.2 .2 .6 .6]; | fig.Position = [.2 .2 .6 .6]; | ||||||
| fig.Tag = 'Normalize'; | fig.Tag = 'Normalize'; | ||||||
| @ -103,7 +103,7 @@ uiwait(fig) | |||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function NormDoneButtonPushed(~,~) |     function NormDoneButtonPushed(~,~) | ||||||
|         close 'Normalize Data' |         close 'Average of Data in Maximum' | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
| end | end | ||||||
| @ -15,7 +15,7 @@ function [dataOUT,params] = correct_magnetic_baseline(dataIN,params) | |||||||
| 
 | 
 | ||||||
| %% creating UI | %% creating UI | ||||||
| fig = figure; | fig = figure; | ||||||
| fig.Name = 'Correct Magnetic Baseline'; | fig.Name = 'Correct Magnetic Field Baseline'; | ||||||
| fig.Units = 'Normalized'; | fig.Units = 'Normalized'; | ||||||
| fig.Position = [.2 .2 .6 .6]; | fig.Position = [.2 .2 .6 .6]; | ||||||
| fig.Tag = 'CorrMagBase'; | fig.Tag = 'CorrMagBase'; | ||||||
| @ -72,7 +72,7 @@ p1.FontSize = 0.6; | |||||||
| p1.Tag = 'FieldPoints'; | p1.Tag = 'FieldPoints'; | ||||||
| 
 | 
 | ||||||
| p2 = uicontrol(fig,'Style','edit'); | p2 = uicontrol(fig,'Style','edit'); | ||||||
| p2.String = 'No. points to cut'; | p2.String = 'No. points to cut before'; | ||||||
| p2.Units = 'Normalized'; | p2.Units = 'Normalized'; | ||||||
| p2.Position = [.26 .01 .24 .05]; | p2.Position = [.26 .01 .24 .05]; | ||||||
| p2.HorizontalAlignment = 'left'; | p2.HorizontalAlignment = 'left'; | ||||||
| @ -120,7 +120,7 @@ uiwait(fig) | |||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     function FieldDoneButtonPushed(~,~) |     function FieldDoneButtonPushed(~,~) | ||||||
|         close 'Correct Magnetic Baseline' |         close 'Correct Magnetic Field Baseline' | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
| end | end | ||||||
|  | |||||||
| @ -11744,23 +11744,11 @@ | |||||||
|         <S>1</S> |         <S>1</S> | ||||||
|         <g>2</g> |         <g>2</g> | ||||||
|         <D>2150</D> |         <D>2150</D> | ||||||
|         <D>70</D> |         <D>75</D> | ||||||
|         <lw>8</lw> |         <lw>8</lw> | ||||||
|         <lw>0</lw> |         <lw>0</lw> | ||||||
|     </Manual_Sys> |     </Manual_Sys> | ||||||
|     <Triplett_pop>0</Triplett_pop> |     <Triplett_pop>0</Triplett_pop> | ||||||
|     <Triplett_pop>0.71429</Triplett_pop> |     <Triplett_pop>0.71429</Triplett_pop> | ||||||
|     <Triplett_pop>0.28571</Triplett_pop> |     <Triplett_pop>0.28571</Triplett_pop> | ||||||
|     <Fitted_Simulation> |  | ||||||
|         <S>1</S> |  | ||||||
|         <g>1.9934</g> |  | ||||||
|         <D>2150.3379</D> |  | ||||||
|         <D>66.695461</D> |  | ||||||
|         <lw>9</lw> |  | ||||||
|         <lw>0</lw> |  | ||||||
|         <Temperature>0</Temperature> |  | ||||||
|         <Temperature>0.55912</Temperature> |  | ||||||
|         <Temperature>0.44088</Temperature> |  | ||||||
|         <weight>1</weight> |  | ||||||
|     </Fitted_Simulation> |  | ||||||
| </struct> | </struct> | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ params.Accumulations = bruker_params.AVGS; | |||||||
| params.laser_shotreprate = "NOT RECORDED"; | params.laser_shotreprate = "NOT RECORDED"; | ||||||
| params.Field_Start = bruker_params.YMIN; | params.Field_Start = bruker_params.YMIN; | ||||||
| params.Field_End = bruker_params.YMIN + bruker_params.YWID; | params.Field_End = bruker_params.YMIN + bruker_params.YWID; | ||||||
| params.Field_Vector = cell2mat(bruker_axes(1,2)); | params.Field_Vector = cell2mat(bruker_axes(1,2)).'; | ||||||
| params.mwFreq = bruker_params.MWFQ / 1e9; | params.mwFreq = bruker_params.MWFQ / 1e9; | ||||||
| params.mwPower = bruker_params.MWPW * 1e3; | params.mwPower = bruker_params.MWPW * 1e3; | ||||||
| params.QValue = "NOT RECORDED"; | params.QValue = "NOT RECORDED"; | ||||||
|  | |||||||
| @ -10,6 +10,9 @@ function [params] = pre_simulation_TREPR(params) | |||||||
| %   different relevant paramters of TREPR simulation. | %   different relevant paramters of TREPR simulation. | ||||||
| %   By pressing "Apply" the simulation will be calculated and displayed. | %   By pressing "Apply" the simulation will be calculated and displayed. | ||||||
| %   The simulation parameters will be saved to the params struct. | %   The simulation parameters will be saved to the params struct. | ||||||
|  | %   Note: Triplett popluations will be processed normalized, but must not | ||||||
|  | %   be equal. | ||||||
|  | %   "Done" will close the window. | ||||||
| 
 | 
 | ||||||
| %% creating UI | %% creating UI | ||||||
| fig = figure; | fig = figure; | ||||||
| @ -51,7 +54,7 @@ d.Callback = @PreSimDoneButtonPushed; | |||||||
| 
 | 
 | ||||||
| %% create input and text fields (Triplet) | %% create input and text fields (Triplet) | ||||||
| textTrip = uicontrol(fig,'Style','text'); | textTrip = uicontrol(fig,'Style','text'); | ||||||
| textTrip.String = 'Triplett populations'; | textTrip.String = 'Triplet populations'; | ||||||
| textTrip.Units = 'Normalized'; | textTrip.Units = 'Normalized'; | ||||||
| textTrip.Position = [.71 .94 .28 .05]; | textTrip.Position = [.71 .94 .28 .05]; | ||||||
| textTrip.HorizontalAlignment = 'center'; | textTrip.HorizontalAlignment = 'center'; | ||||||
| @ -70,7 +73,7 @@ textTx.FontSize = 0.6; | |||||||
| textTx.Tag = 'textTx'; | textTx.Tag = 'textTx'; | ||||||
| 
 | 
 | ||||||
| InpTx = uicontrol(fig,'Style','edit'); | InpTx = uicontrol(fig,'Style','edit'); | ||||||
| InpTx.String = '1'; | InpTx.String = '0.9'; | ||||||
| InpTx.Units = 'Normalized'; | InpTx.Units = 'Normalized'; | ||||||
| InpTx.Position = [.75334 .89 .04333 .05]; | InpTx.Position = [.75334 .89 .04333 .05]; | ||||||
| InpTx.HorizontalAlignment = 'left'; | InpTx.HorizontalAlignment = 'left'; | ||||||
| @ -88,7 +91,7 @@ textTy.FontSize = 0.6; | |||||||
| textTy.Tag = 'textTy'; | textTy.Tag = 'textTy'; | ||||||
| 
 | 
 | ||||||
| InpTy = uicontrol(fig,'Style','edit'); | InpTy = uicontrol(fig,'Style','edit'); | ||||||
| InpTy.String = '1'; | InpTy.String = '1.0'; | ||||||
| InpTy.Units = 'Normalized'; | InpTy.Units = 'Normalized'; | ||||||
| InpTy.Position = [.85001 .89 .04333 .05]; | InpTy.Position = [.85001 .89 .04333 .05]; | ||||||
| InpTy.HorizontalAlignment = 'left'; | InpTy.HorizontalAlignment = 'left'; | ||||||
| @ -106,7 +109,7 @@ textTz.FontSize = 0.6; | |||||||
| textTz.Tag = 'textTz'; | textTz.Tag = 'textTz'; | ||||||
| 
 | 
 | ||||||
| InpTz = uicontrol(fig,'Style','edit'); | InpTz = uicontrol(fig,'Style','edit'); | ||||||
| InpTz.String = '1'; | InpTz.String = '1.1'; | ||||||
| InpTz.Units = 'Normalized'; | InpTz.Units = 'Normalized'; | ||||||
| InpTz.Position = [.94667 .89 .04333 .05]; | InpTz.Position = [.94667 .89 .04333 .05]; | ||||||
| InpTz.HorizontalAlignment = 'left'; | InpTz.HorizontalAlignment = 'left'; | ||||||
| @ -116,7 +119,7 @@ InpTz.Tag = 'InpTz'; | |||||||
| 
 | 
 | ||||||
| %% create input and text fields (D & E) | %% create input and text fields (D & E) | ||||||
| textDE = uicontrol(fig,'Style','text'); | textDE = uicontrol(fig,'Style','text'); | ||||||
| textDE.String = 'D tensor'; | textDE.String = 'ZFS parameters / MHz'; | ||||||
| textDE.Units = 'Normalized'; | textDE.Units = 'Normalized'; | ||||||
| textDE.Position = [.71 .77 .28 .05]; | textDE.Position = [.71 .77 .28 .05]; | ||||||
| textDE.HorizontalAlignment = 'center'; | textDE.HorizontalAlignment = 'center'; | ||||||
| @ -153,7 +156,7 @@ textE.FontSize = 0.6; | |||||||
| textE.Tag = 'textE'; | textE.Tag = 'textE'; | ||||||
| 
 | 
 | ||||||
| InpE = uicontrol(fig,'Style','edit'); | InpE = uicontrol(fig,'Style','edit'); | ||||||
| InpE.String = '1/3 D'; | InpE.String = 'max D/3'; | ||||||
| InpE.Units = 'Normalized'; | InpE.Units = 'Normalized'; | ||||||
| InpE.Position = [.9225 .72 .0675 .05]; | InpE.Position = [.9225 .72 .0675 .05]; | ||||||
| InpE.HorizontalAlignment = 'left'; | InpE.HorizontalAlignment = 'left'; | ||||||
| @ -208,9 +211,9 @@ InpG.FontUnits = 'Normalized'; | |||||||
| InpG.FontSize = 0.6; | InpG.FontSize = 0.6; | ||||||
| InpG.Tag = 'InpG'; | InpG.Tag = 'InpG'; | ||||||
| 
 | 
 | ||||||
| %% create input and text fields (linewidth) | %% create input and text fields (linewidths) | ||||||
| textLW = uicontrol(fig,'Style','text'); | textLW = uicontrol(fig,'Style','text'); | ||||||
| textLW.String = 'Linewidth'; | textLW.String = 'Linewidths'; | ||||||
| textLW.Units = 'Normalized'; | textLW.Units = 'Normalized'; | ||||||
| textLW.Position = [.71 .43 .28 .05]; | textLW.Position = [.71 .43 .28 .05]; | ||||||
| textLW.HorizontalAlignment = 'center'; | textLW.HorizontalAlignment = 'center'; | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ 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.simExp = eventdata.manExp; | eventdata.simExp = eventdata.manExp; | ||||||
|  | eventdata.SaveStat = 0; %counter if save button was pushed | ||||||
| 
 | 
 | ||||||
| %% creating UI | %% creating UI | ||||||
| fig = figure; | fig = figure; | ||||||
| @ -146,7 +147,7 @@ InpTz.Tag = 'InpTz'; | |||||||
| 
 | 
 | ||||||
| %% create input and text fields (D & E) | %% create input and text fields (D & E) | ||||||
| textDE = uicontrol(fig,'Style','text'); | textDE = uicontrol(fig,'Style','text'); | ||||||
| textDE.String = 'D tensor variation'; | textDE.String = 'ZFS parameter variation / MHz'; | ||||||
| textDE.Units = 'Normalized'; | textDE.Units = 'Normalized'; | ||||||
| textDE.Position = [.71 .78 .28 .05]; | textDE.Position = [.71 .78 .28 .05]; | ||||||
| textDE.HorizontalAlignment = 'center'; | textDE.HorizontalAlignment = 'center'; | ||||||
| @ -191,7 +192,7 @@ InpE.FontUnits = 'Normalized'; | |||||||
| InpE.FontSize = 0.6; | InpE.FontSize = 0.6; | ||||||
| InpE.Tag = 'InpE'; | InpE.Tag = 'InpE'; | ||||||
| 
 | 
 | ||||||
| %% create input and text fields (linewidth) | %% create input and text fields (linewidths) | ||||||
| textLW = uicontrol(fig,'Style','text'); | textLW = uicontrol(fig,'Style','text'); | ||||||
| textLW.String = 'Linewidth variations'; | textLW.String = 'Linewidth variations'; | ||||||
| textLW.Units = 'Normalized'; | textLW.Units = 'Normalized'; | ||||||
| @ -349,10 +350,16 @@ uiwait(fig) | |||||||
|         eventdata.simExp.Temperature = eventdata.BestSys.Temperature; |         eventdata.simExp.Temperature = eventdata.BestSys.Temperature; | ||||||
|         %save fitted parameters to struct |         %save fitted parameters to struct | ||||||
|         params.Fitted_Simulation = eventdata.BestSys; |         params.Fitted_Simulation = eventdata.BestSys; | ||||||
|  |         eventdata.SaveStat = eventdata.SaveStat + 1; | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     function SimDoneButtonPushed(~,~) |     function SimDoneButtonPushed(~,~) | ||||||
|         close 'Simulation' |         if eventdata.SaveStat == 0 | ||||||
|  |             params.Fitted_Simulation = eventdata.BestSys; | ||||||
|  |             close 'Simulation' | ||||||
|  |         else | ||||||
|  |             close 'Simulation' | ||||||
|  |         end | ||||||
|     end |     end | ||||||
|   |   | ||||||
| end | end | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user