finished basic functionality for printing figures
This commit is contained in:
		
							parent
							
								
									906acc8bb0
								
							
						
					
					
						commit
						9a5acfd6f3
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,3 @@
 | 
			
		||||
*.asv
 | 
			
		||||
*.pdf
 | 
			
		||||
*.xml
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,60 @@
 | 
			
		||||
function [outputArg1,outputArg2] = print_figure_pdf(inputArg1,inputArg2)
 | 
			
		||||
%PRINT_FIGURE_PDF Summary of this function goes here
 | 
			
		||||
%   Detailed explanation goes here
 | 
			
		||||
outputArg1 = inputArg1;
 | 
			
		||||
outputArg2 = inputArg2;
 | 
			
		||||
function [] = print_figure_pdf(data,params,type)
 | 
			
		||||
%PRINT_FIGURE_PDF creates pdf figures of TREPR data
 | 
			
		||||
%
 | 
			
		||||
%   Usage: PRINT_FIGURE_PDF(data,params,type), where data are TREPR data
 | 
			
		||||
%   loaded by LOAD_MATLAB or LOAD_BRUKER, params is a struct created by
 | 
			
		||||
%   SIMULATION_TREPR and type a number.
 | 
			
		||||
%   
 | 
			
		||||
%   type = 1: 2D plot of data and simulation with magnetic field as x-axis
 | 
			
		||||
%   type = 2: 3D plot of data without simulation
 | 
			
		||||
 | 
			
		||||
if type == 1
 | 
			
		||||
    %getting simulation values
 | 
			
		||||
    Exp.mwFreq = params.mwFreq; % GHz
 | 
			
		||||
    Exp.nPoints = length(params.Field_Vector);
 | 
			
		||||
    Exp.CenterSweep = 0.1*[params.Field_Center params.Field_Sweep]; % mT (converted from Gauss)
 | 
			
		||||
    Exp.Harmonic = 0; % zeroth harmonic
 | 
			
		||||
    Exp.Temperature = params.Triplett_pop;
 | 
			
		||||
    Sys = params.Fitted_Simulation;
 | 
			
		||||
    %calculate simulation
 | 
			
		||||
    [~,spec] = pepper(Sys,Exp);
 | 
			
		||||
    spec_norm = spec/max(spec); % normalize the simulation
 | 
			
		||||
    %plot invisible and print
 | 
			
		||||
    figure('Visible','off')
 | 
			
		||||
    plot(0.1*params.Field_Vector,params.max_mean,'r',...
 | 
			
		||||
         0.1*params.Field_Vector,spec_norm,'b','LineWidth',1.2)
 | 
			
		||||
    xlabel 'Magnetic Field / mT'
 | 
			
		||||
    ylabel 'EPR signal / A. U.'
 | 
			
		||||
    legend('experimental','simulation')
 | 
			
		||||
    title(params.Name, 'Interpreter','none')
 | 
			
		||||
    axis tight
 | 
			
		||||
    set(gcf,'Units','Inches');
 | 
			
		||||
    pos = get(gcf,'Position');
 | 
			
		||||
    set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]);
 | 
			
		||||
    figurepath = strcat(params.Path,"/",params.Name,"_Sim.pdf"); %create full filename
 | 
			
		||||
    print(gcf,figurepath,'-dpdf','-r0');
 | 
			
		||||
    
 | 
			
		||||
elseif type == 2
 | 
			
		||||
    %plot invisible and print
 | 
			
		||||
    figure('Visible','off')
 | 
			
		||||
    surf(0.1*params.Field_Vector, params.TimeBase*1e6, data)
 | 
			
		||||
    colormap default
 | 
			
		||||
    shading interp
 | 
			
		||||
    view(305,10)
 | 
			
		||||
    axis tight
 | 
			
		||||
    xlabel 'Magnetic Field / mT'
 | 
			
		||||
    ylabel 'Time / \mus'
 | 
			
		||||
    zlabel 'EPR Signal / A.U.'
 | 
			
		||||
    title(params.Name, 'Interpreter','none')
 | 
			
		||||
    set(gcf,'Units','Inches');
 | 
			
		||||
    pos = get(gcf,'Position');
 | 
			
		||||
    set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]);
 | 
			
		||||
    figurepath = strcat(params.Path,"/",params.Name,"_3D.pdf"); %create full filename
 | 
			
		||||
    print(gcf,figurepath,'-dpdf','-r0');
 | 
			
		||||
    
 | 
			
		||||
else
 | 
			
		||||
    error('Unknown plot type.');
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user