diff --git a/load_bruker.m b/load_bruker.m index b352d9d..f2a5aef 100644 --- a/load_bruker.m +++ b/load_bruker.m @@ -1,7 +1,36 @@ -function [outputArg1,outputArg2] = load_bruker(inputArg1,inputArg2) -%LOAD_BRUKER Summary of this function goes here -% Detailed explanation goes here -outputArg1 = inputArg1; -outputArg2 = inputArg2; +function [Data,params] = load_bruker(path) +%LOAD_MATLAB imports TR-EPR data recorded with Bruker's xEPR +% Usage: ['data_as_double','struct_with_parameters'] = load_bruker('C:/full/path/to/file.mat') +% +% Imports data recorded by xEPR, where x axis is time and y axis is +% magnetic field. +% PATH can be either pointing to .DSC or .DTA, but both need to be there +% and in the same folder. PATH must also contain forwardslashes only. +% The params struct contains metadata of the measurement and is displayed +% in the command window when calling the function. +% +% Note that this funtion is dependent on easyspin. + +%load Bruker data with help of easyspin +[bruker_axes,Data,bruker_params] = eprload(path); + +%assign metadata to custom params struct +params.Field_Center = bruker_params.YMIN + 0.5*bruker_params.YWID; +params.Field_Sweep = bruker_params.YWID; +params.Field_Step = bruker_params.YWID / (bruker_params.YPTS-1); +params.Accumulations = bruker_params.AVGS; +params.laser_shotreprate = "NOT RECORDED"; +params.Field_Start = bruker_params.YMIN; +params.Field_End = bruker_params.YMIN + bruker_params.YWID; +params.Field_Vector = cell2mat(bruker_axes(1,2)); +params.mwFreq = bruker_params.MWFQ / 1e9; +params.mwPower = bruker_params.MWPW * 1e3; +params.QValue = "NOT RECORDED"; +params.mwAtten = str2double(extractBefore(string(bruker_params.PowerAtten),' ')); +params.mwFreqs = "NOT RECORDED"; +params.Name = string(bruker_params.TITL); + +%echo what information is contained in the structure called 'params' +params end