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. %correct \ for / corrpath = replace(path,"\","/"); %load Bruker data with help of easyspin [bruker_axes,Data,bruker_params] = eprload(corrpath); %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