From 867b874a541f5553f48a1dedd196aa4927e653d5 Mon Sep 17 00:00:00 2001 From: Thomas Hiller Date: Fri, 22 Feb 2019 12:44:44 +0100 Subject: [PATCH] NUCLEUSinv & NUCLEUSmod update: NUCLEUSmod: 1.) NUCLEUSmod_createPanelNMR: removed the %-sign from the noise text field because the noise is now handled as absolute value 2.) updateNMRsignals: cleaned up the forward NMR signal calculation (noise and porosity scaling get handled now within the same routine) NUCLEUSinv: 1.) NUCLEUSinv_updateInterface: fixed a string that changed a text field of the GUI (RTD N/dec -> #/dec) 2.) runInversionJoint: at the beginning of the joint inversion, the error vector "e" is now scaled correctly (accounting for noise and porosity/water content) 3.) all RTDs and PSDs axes have now volumetric water content as y-label 4.) added water content to csv-export of "LIAG archive"-option 5.) when using NUCLEUSmod data in NUCLEUSinv: porosity and surface relaxivity get imported now too 6.) when using NUCLEUSmod data in NUCLEUSinv: when performing a joint inversion to compare forward and inverted PSD, water content on the y-axis is now correct (added a rescaling after scaling by the integral of individual PSDs) --- NUCLEUSinv/NUCLEUSinv.m | 4 +- NUCLEUSinv/NUCLEUSinv_updateInterface.m | 4 +- NUCLEUSmod/NUCLEUSmod.m | 4 +- NUCLEUSmod/NUCLEUSmod_createPanelNMR.m | 4 +- callbacks/edits/onEditValue.m | 14 +- callbacks/listboxes/onListboxData.m | 4 +- doc/nucleus/NUCLEUSinv/NUCLEUSinv.html | 4 +- .../NUCLEUSinv_updateInterface.html | 4 +- doc/nucleus/NUCLEUSmod/NUCLEUSmod.html | 4 +- .../NUCLEUSmod/NUCLEUSmod_createPanelNMR.html | 4 +- doc/nucleus/callbacks/edits/onEditValue.html | 481 +++++----- .../callbacks/listboxes/onListboxData.html | 134 +-- .../functions/interface/calculateNMR.html | 12 +- .../interface/calculateNMRnoise.html | 154 ---- .../interface/calculateNMRporosity.html | 154 ---- .../functions/interface/exportData.html | 844 +++++++++--------- .../functions/interface/exportINV.html | 134 +-- .../functions/interface/importMOD2INV.html | 200 +++-- doc/nucleus/functions/interface/menu.html | 2 +- .../interface/runInversionJoint.html | 10 +- .../functions/interface/updateInfo.html | 6 +- .../functions/interface/updateNMRsignals.html | 165 ++++ .../interface/updatePlotsDistribution.html | 329 ++++--- .../interface/updatePlotsJointInversion.html | 330 +++---- ...dNoiseToNMR.html => addNoiseToSignal.html} | 24 +- doc/nucleus/functions/modeling/menu.html | 2 +- functions/interface/calculateNMR.m | 4 +- functions/interface/calculateNMRporosity.m | 81 -- functions/interface/exportData.m | 22 +- functions/interface/exportINV.m | 4 +- functions/interface/importMOD2INV.m | 2 + functions/interface/runInversionJoint.m | 4 +- functions/interface/updateInfo.m | 6 +- ...calculateNMRnoise.m => updateNMRsignals.m} | 34 +- functions/interface/updatePlotsDistribution.m | 21 +- .../interface/updatePlotsJointInversion.m | 52 +- .../{addNoiseToNMR.m => addNoiseToSignal.m} | 8 +- 37 files changed, 1554 insertions(+), 1715 deletions(-) delete mode 100644 doc/nucleus/functions/interface/calculateNMRnoise.html delete mode 100644 doc/nucleus/functions/interface/calculateNMRporosity.html create mode 100644 doc/nucleus/functions/interface/updateNMRsignals.html rename doc/nucleus/functions/modeling/{addNoiseToNMR.html => addNoiseToSignal.html} (85%) delete mode 100644 functions/interface/calculateNMRporosity.m rename functions/interface/{calculateNMRnoise.m => updateNMRsignals.m} (65%) rename functions/modeling/{addNoiseToNMR.m => addNoiseToSignal.m} (88%) diff --git a/NUCLEUSinv/NUCLEUSinv.m b/NUCLEUSinv/NUCLEUSinv.m index b46bbbf..383efa0 100644 --- a/NUCLEUSinv/NUCLEUSinv.m +++ b/NUCLEUSinv/NUCLEUSinv.m @@ -38,8 +38,8 @@ if ~isempty(h0); close(h0); end %% GUI 'header' info and defaults -myui.version = '0.1.2'; -myui.date = '20.02.2019'; +myui.version = '0.1.3'; +myui.date = '21.02.2019'; myui.author = 'Thomas Hiller'; myui.email = 'thomas.hiller[at]leibniz-liag.de'; myui.fontsize = 10; diff --git a/NUCLEUSinv/NUCLEUSinv_updateInterface.m b/NUCLEUSinv/NUCLEUSinv_updateInterface.m index 964070a..ebe28ea 100644 --- a/NUCLEUSinv/NUCLEUSinv_updateInterface.m +++ b/NUCLEUSinv/NUCLEUSinv_updateInterface.m @@ -685,7 +685,7 @@ case 's' set(gui.radio_handles.process_timescale_s,'Enable','on','Value',1); set(gui.radio_handles.process_timescale_ms,'Enable','on','Value',0); - set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [s] | max [s] | N / dec',... + set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [s] | max [s] | # / dec',... 'FontSize',10); set(gui.text_handles.petro_Tbulk,'String',... ['Tbulk [s] | ',char(hex2dec('03C1')),' [µm/s] | geom']); @@ -693,7 +693,7 @@ case 'ms' set(gui.radio_handles.process_timescale_s,'Enable','on','Value',0); set(gui.radio_handles.process_timescale_ms,'Enable','on','Value',1); - set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [ms] | max [ms] | N / dec',... + set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [ms] | max [ms] | # / dec',... 'FontSize',9); set(gui.text_handles.petro_Tbulk,'String',... ['Tbulk [ms] | ',char(hex2dec('03C1')),' [µm/s] | geom']); diff --git a/NUCLEUSmod/NUCLEUSmod.m b/NUCLEUSmod/NUCLEUSmod.m index b43e329..34d03ae 100644 --- a/NUCLEUSmod/NUCLEUSmod.m +++ b/NUCLEUSmod/NUCLEUSmod.m @@ -41,8 +41,8 @@ if ~isempty(h0); close(h0); end %% GUI 'header' info and defaults -myui.version = '0.1.2'; -myui.date = '20.02.2019'; +myui.version = '0.1.3'; +myui.date = '21.02.2019'; myui.author = 'Thomas Hiller'; myui.email = 'thomas.hiller[at]leibniz-liag.de'; myui.fontsize = 10; diff --git a/NUCLEUSmod/NUCLEUSmod_createPanelNMR.m b/NUCLEUSmod/NUCLEUSmod_createPanelNMR.m index 23c9d77..5755e45 100644 --- a/NUCLEUSmod/NUCLEUSmod_createPanelNMR.m +++ b/NUCLEUSmod/NUCLEUSmod_createPanelNMR.m @@ -105,14 +105,14 @@ %% noise & porosity gui.text_handles.noise = uicontrol('Parent',gui.panels.nmr.HBox4,... 'Style','text','FontSize',myui.fontsize,'HorizontalAlignment','center',... - 'String','add noise [%]'); + 'String','add noise'); tstr = ['Set NMR data noise.

',... 'Hint:
',... 'You do not need to press RUN to add noise to the NMR signals.
',... 'The raw NMR signals are stored internally and the noise is
',... 'applied instantaneously.

',... 'Default value:
',... - '0 %
']; + '0
']; gui.edit_handles.noise = uicontrol('Parent',gui.panels.nmr.HBox4,... 'Style','edit','String',num2str(data.nmr.noise),'FontSize',myui.fontsize,... 'UserData',struct('Tooltipstr',tstr,'defaults',[data.nmr.noise 1 1]),... diff --git a/callbacks/edits/onEditValue.m b/callbacks/edits/onEditValue.m index e5c1f02..327cf0f 100644 --- a/callbacks/edits/onEditValue.m +++ b/callbacks/edits/onEditValue.m @@ -16,8 +16,6 @@ function onEditValue(src,~) % % Other m-files required: % calculateGeometry -% calculateNMRnoise -% calculateNMRporosity % calibratePorosity % clearSingleAxis % NUCLEUSinv_updateInterface @@ -26,6 +24,7 @@ function onEditValue(src,~) % removeInversionFields % processNMRDataControl % updateInfo +% updateNMRsignals % updatePlotsDistribution % updatePlotsNMR % updatePlotsSignal @@ -193,6 +192,7 @@ function onEditValue(src,~) clearSingleAxis(gui.axes_handles.nmr); setappdata(fig,'data',data); calculateGeometry; + case 'pressure' switch out.field case 'range' @@ -207,16 +207,22 @@ function onEditValue(src,~) clearSingleAxis(gui.axes_handles.nmr); setappdata(fig,'data',data); NUCLEUSmod_updateInterface; + case 'nmr' switch out.field case 'noise' if isfield(data.results,'NMR') - calculateNMRnoise; + updateNMRsignals; updatePlotsNMR; end case 'porosity' + if data.nmr.porosity <= 0 || data.nmr.porosity > 1 + data.nmr.porosity = 1; + set(src,'String',num2str(data.nmr.porosity)); + setappdata(fig,'data',data); + end if isfield(data.results,'NMR') - calculateNMRporosity; + updateNMRsignals; updatePlotsNMR; end otherwise diff --git a/callbacks/listboxes/onListboxData.m b/callbacks/listboxes/onListboxData.m index 9b1d210..b800d74 100644 --- a/callbacks/listboxes/onListboxData.m +++ b/callbacks/listboxes/onListboxData.m @@ -149,7 +149,9 @@ function onListboxData(src,~) data.param.sampVol = 1; end if isfield(data.import,'NMRMOD') - data.invstd.Tbulk = data.import.NMR.para{id}.Tbulk; + data.param.rho = data.import.NMR.para{id}.rho*1e6; + data.invstd.Tbulk = data.import.NMR.para{id}.Tbulk; + data.invstd.porosity = data.import.NMR.para{id}.porosity; end % --- diff --git a/doc/nucleus/NUCLEUSinv/NUCLEUSinv.html b/doc/nucleus/NUCLEUSinv/NUCLEUSinv.html index de24a09..f0172c0 100644 --- a/doc/nucleus/NUCLEUSinv/NUCLEUSinv.html +++ b/doc/nucleus/NUCLEUSinv/NUCLEUSinv.html @@ -111,8 +111,8 @@

SOURCE CODE ^if ~isempty(h0); close(h0); end 0039 0040 %% GUI 'header' info and defaults -0041 myui.version = '0.1.2'; -0042 myui.date = '20.02.2019'; +0041 myui.version = '0.1.3'; +0042 myui.date = '21.02.2019'; 0043 myui.author = 'Thomas Hiller'; 0044 myui.email = 'thomas.hiller[at]leibniz-liag.de'; 0045 myui.fontsize = 10; diff --git a/doc/nucleus/NUCLEUSinv/NUCLEUSinv_updateInterface.html b/doc/nucleus/NUCLEUSinv/NUCLEUSinv_updateInterface.html index 9b94224..77df530 100644 --- a/doc/nucleus/NUCLEUSinv/NUCLEUSinv_updateInterface.html +++ b/doc/nucleus/NUCLEUSinv/NUCLEUSinv_updateInterface.html @@ -765,7 +765,7 @@

SOURCE CODE ^case 's' 0686 set(gui.radio_handles.process_timescale_s,'Enable','on','Value',1); 0687 set(gui.radio_handles.process_timescale_ms,'Enable','on','Value',0); -0688 set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [s] | max [s] | N / dec',... +0688 set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [s] | max [s] | # / dec',... 0689 'FontSize',10); 0690 set(gui.text_handles.petro_Tbulk,'String',... 0691 ['Tbulk [s] | ',char(hex2dec('03C1')),' [µm/s] | geom']); @@ -773,7 +773,7 @@

SOURCE CODE ^case 'ms' 0694 set(gui.radio_handles.process_timescale_s,'Enable','on','Value',0); 0695 set(gui.radio_handles.process_timescale_ms,'Enable','on','Value',1); -0696 set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [ms] | max [ms] | N / dec',... +0696 set(gui.text_handles.invstd_RTDtimes,'String','RTD - min [ms] | max [ms] | # / dec',... 0697 'FontSize',9); 0698 set(gui.text_handles.petro_Tbulk,'String',... 0699 ['Tbulk [ms] | ',char(hex2dec('03C1')),' [µm/s] | geom']); diff --git a/doc/nucleus/NUCLEUSmod/NUCLEUSmod.html b/doc/nucleus/NUCLEUSmod/NUCLEUSmod.html index 29c9f92..76df0fa 100644 --- a/doc/nucleus/NUCLEUSmod/NUCLEUSmod.html +++ b/doc/nucleus/NUCLEUSmod/NUCLEUSmod.html @@ -117,8 +117,8 @@

SOURCE CODE ^if ~isempty(h0); close(h0); end 0042 0043 %% GUI 'header' info and defaults -0044 myui.version = '0.1.2'; -0045 myui.date = '20.02.2019'; +0044 myui.version = '0.1.3'; +0045 myui.date = '21.02.2019'; 0046 myui.author = 'Thomas Hiller'; 0047 myui.email = 'thomas.hiller[at]leibniz-liag.de'; 0048 myui.fontsize = 10; diff --git a/doc/nucleus/NUCLEUSmod/NUCLEUSmod_createPanelNMR.html b/doc/nucleus/NUCLEUSmod/NUCLEUSmod_createPanelNMR.html index bd3482d..264bb6a 100644 --- a/doc/nucleus/NUCLEUSmod/NUCLEUSmod_createPanelNMR.html +++ b/doc/nucleus/NUCLEUSmod/NUCLEUSmod_createPanelNMR.html @@ -175,14 +175,14 @@

SOURCE CODE ^%% noise & porosity 0106 gui.text_handles.noise = uicontrol('Parent',gui.panels.nmr.HBox4,... 0107 'Style','text','FontSize',myui.fontsize,'HorizontalAlignment','center',... -0108 'String','add noise [%]'); +0108 'String','add noise'); 0109 tstr = ['<HTML>Set NMR data noise.<br><br>',... 0110 '<u>Hint:</u><br>',... 0111 'You do not need to press RUN to add noise to the NMR signals.<br>',... 0112 'The raw NMR signals are stored internally and the noise is<br>',... 0113 'applied instantaneously.<br><br>',... 0114 '<u>Default value:</u><br>',... -0115 '<b>0 %</b><br>']; +0115 '<b>0</b><br>']; 0116 gui.edit_handles.noise = uicontrol('Parent',gui.panels.nmr.HBox4,... 0117 'Style','edit','String',num2str(data.nmr.noise),'FontSize',myui.fontsize,... 0118 'UserData',struct('Tooltipstr',tstr,'defaults',[data.nmr.noise 1 1]),... diff --git a/doc/nucleus/callbacks/edits/onEditValue.html b/doc/nucleus/callbacks/edits/onEditValue.html index 23f9098..1f5344b 100644 --- a/doc/nucleus/callbacks/edits/onEditValue.html +++ b/doc/nucleus/callbacks/edits/onEditValue.html @@ -43,8 +43,6 @@

DESCRIPTION ^DESCRIPTION ^DESCRIPTION ^CROSS-REFERENCE INFORMATION ^

This function calls: +
  • NUCLEUSinv_updateInterface updates all GUI elements
  • NUCLEUSmod_updateInterface updates all GUI elements
  • calculateGeometry calculates the shape dependent geometry parameters
  • calibratePorosity determines a sample's porosity from a calibration
  • clearSingleAxis clears an individual axis
  • processNMRDataControl prepares simple NMR raw data processing
  • removeCalculationFields deletes corresponding fields from NUCLEUSmod
  • removeInversionFields deletes all inversion result fields from NUCLEUSinv
  • updateInfo updates the information shown in all information list boxes
  • updateNMRsignals adds noise to the forward NMR signals and scales the
  • updatePlotsDistribution plots the RTD and PSD curves into NUCLEUSinv
  • updatePlotsNMR plots the forward modeled NMR data in NUCLEUSmod
  • updatePlotsSignal plots the raw and processed NMR signals in NUCLEUSinv
  • This function is called by: @@ -101,183 +100,183 @@

    SOURCE CODE ^% 0017 % Other m-files required: 0018 % calculateGeometry -0019 % calculateNMRnoise -0020 % calculateNMRporosity -0021 % calibratePorosity -0022 % clearSingleAxis -0023 % NUCLEUSinv_updateInterface -0024 % NUCLEUSmod_updateInterface -0025 % removeCalculationFields -0026 % removeInversionFields -0027 % processNMRDataControl -0028 % updateInfo -0029 % updatePlotsDistribution -0030 % updatePlotsNMR -0031 % updatePlotsSignal -0032 % -0033 % Subfunctions: -0034 % createDataString -0035 % -0036 % MAT-files required: -0037 % none -0038 % -0039 % See also: NUCLEUSinv -0040 % Author: Thomas Hiller -0041 % email: thomas.hiller[at]leibniz-liag.de -0042 % License: MIT License (at end) -0043 -0044 %------------- BEGIN CODE -------------- -0045 -0046 %% get GUI handle and data -0047 fig = ancestor(src,'figure','toplevel'); -0048 fig_tag = get(fig,'Tag'); -0049 gui = getappdata(fig,'gui'); -0050 data = getappdata(fig,'data'); -0051 -0052 %% the generic part thw works for both GUIS -0053 % get the value of the field -0054 value = str2double(get(src,'String')); -0055 % get the user data of the field -0056 userdata = get(src,'UserData'); -0057 -0058 % check if the value is numeric -0059 % if not reset to defaults stored in user data -0060 defaults = userdata.defaults; -0061 if isnan(value) -0062 set(src,'String',num2str(defaults(1))); -0063 value = str2double(get(src,'String')); -0064 end -0065 -0066 % get the tag -0067 tag = get(src,'Tag'); -0068 out = createDataString(tag); -0069 -0070 % update the corresponding data field -0071 updstr = [out.updstr,'(',num2str(defaults(2)),',',... -0072 num2str(defaults(3)),')','=value;']; -0073 eval(updstr); -0074 % update the data inside the GUI -0075 setappdata(fig,'data',data); -0076 -0077 % switch depending on what figure called -0078 switch fig_tag -0079 case 'INV' -0080 % switch depending on the parent panel -0081 switch out.panel -0082 case 'process' -0083 switch out.field -0084 case 'start' -0085 % remove temporary data fields -0086 data = removeInversionFields(data); -0087 setappdata(fig,'data',data); -0088 % process the current selected signal -0089 id = get(gui.listbox_handles.signal,'Value'); -0090 processNMRDataControl(fig,id); -0091 updatePlotsSignal; -0092 case 'end' -0093 % remove temporary data fields -0094 data = removeInversionFields(data); -0095 setappdata(fig,'data',data); -0096 % check if the first sample is really smaller than -0097 % the last one; if not reset everything -0098 first = str2double(get(gui.edit_handles.process_start,'String')); -0099 last = value; -0100 id = get(gui.listbox_handles.signal,'Value'); -0101 maxL = length(data.import.NMR.data{id}.signal); -0102 if last == 0 || last <= first || last > maxL -0103 data.process.end = maxL; -0104 set(src,'String',num2str(data.process.end)); -0105 setappdata(fig,'data',data); -0106 end -0107 % process the current selected signal -0108 processNMRDataControl(fig,id); -0109 updatePlotsSignal; -0110 end -0111 case 'invstd' -0112 switch out.field -0113 case 'lambdaR' -0114 data.invstd.lambda = data.invstd.lambdaR(1); -0115 setappdata(fig,'data',data); -0116 case 'Tbulk' -0117 if data.invstd.Tbulk <=0 -0118 data.invstd.Tbulk = 2; -0119 setappdata(fig,'data',data); -0120 set(src,'String',num2str(data.invstd.Tbulk)); -0121 end -0122 case 'porosity' -0123 if data.invstd.porosity < 0 || data.invstd.porosity > 1 -0124 data.invstd.porosity = 1; -0125 setappdata(fig,'data',data); -0126 set(src,'String',num2str(data.invstd.porosity)); -0127 end -0128 updatePlotsDistribution; -0129 end -0130 case 'param' -0131 switch out.field -0132 case {'rho','a','CBWcutoff','BVIcutoff'} -0133 updatePlotsDistribution; -0134 updateInfo(gui.plots.SignalPanel); -0135 case 'calibAmp' -0136 data.calib.amp = data.param.calibAmp; -0137 setappdata(fig,'data',data); -0138 case 'calibVol' -0139 data.calib.vol = data.param.calibVol; -0140 setappdata(fig,'data',data); -0141 case 'sampVol' -0142 calibratePorosity; -0143 end -0144 case 'invjoint' -0145 switch out.field -0146 case 'lambdaR' -0147 data.invjoint.lambda = data.invjoint.lambdaR(1); -0148 setappdata(fig,'data',data); -0149 case 'beta' -0150 if value < 0.1 -0151 value = 1; -0152 elseif value > 89.9 -0153 value = 89; -0154 end -0155 eval(updstr); -0156 data.invjoint.gamma = data.invjoint.alpha - data.invjoint.beta; -0157 setappdata(fig,'data',data); -0158 NUCLEUSinv_updateInterface; -0159 case 'rhostart' -0160 case 'anglestart' -0161 if value < 0.1 -0162 value = 1; -0163 elseif value > 89.9 -0164 value = 89; -0165 end -0166 eval(updstr); -0167 data.invjoint.beta = value; -0168 data.invjoint.gamma = data.invjoint.alpha - data.invjoint.beta; -0169 setappdata(fig,'data',data); -0170 NUCLEUSinv_updateInterface; -0171 end -0172 end % switch out.panel -0173 setappdata(fig,'gui',gui); -0174 case 'MOD' -0175 % switch depending on the parent panel -0176 switch out.panel -0177 case 'geometry' -0178 switch out.field -0179 case 'beta' -0180 if value < 0.5 -0181 value = 1; -0182 elseif value > 89.5 -0183 value = 89; -0184 end -0185 eval(updstr); -0186 setappdata(fig,'data',data); -0187 otherwise -0188 % nothing to do -0189 end -0190 data = removeCalculationFields(data,'cps'); -0191 data = removeCalculationFields(data,'nmr'); -0192 clearSingleAxis(gui.axes_handles.cps); -0193 clearSingleAxis(gui.axes_handles.nmr); -0194 setappdata(fig,'data',data); -0195 calculateGeometry; +0019 % calibratePorosity +0020 % clearSingleAxis +0021 % NUCLEUSinv_updateInterface +0022 % NUCLEUSmod_updateInterface +0023 % removeCalculationFields +0024 % removeInversionFields +0025 % processNMRDataControl +0026 % updateInfo +0027 % updateNMRsignals +0028 % updatePlotsDistribution +0029 % updatePlotsNMR +0030 % updatePlotsSignal +0031 % +0032 % Subfunctions: +0033 % createDataString +0034 % +0035 % MAT-files required: +0036 % none +0037 % +0038 % See also: NUCLEUSinv +0039 % Author: Thomas Hiller +0040 % email: thomas.hiller[at]leibniz-liag.de +0041 % License: MIT License (at end) +0042 +0043 %------------- BEGIN CODE -------------- +0044 +0045 %% get GUI handle and data +0046 fig = ancestor(src,'figure','toplevel'); +0047 fig_tag = get(fig,'Tag'); +0048 gui = getappdata(fig,'gui'); +0049 data = getappdata(fig,'data'); +0050 +0051 %% the generic part thw works for both GUIS +0052 % get the value of the field +0053 value = str2double(get(src,'String')); +0054 % get the user data of the field +0055 userdata = get(src,'UserData'); +0056 +0057 % check if the value is numeric +0058 % if not reset to defaults stored in user data +0059 defaults = userdata.defaults; +0060 if isnan(value) +0061 set(src,'String',num2str(defaults(1))); +0062 value = str2double(get(src,'String')); +0063 end +0064 +0065 % get the tag +0066 tag = get(src,'Tag'); +0067 out = createDataString(tag); +0068 +0069 % update the corresponding data field +0070 updstr = [out.updstr,'(',num2str(defaults(2)),',',... +0071 num2str(defaults(3)),')','=value;']; +0072 eval(updstr); +0073 % update the data inside the GUI +0074 setappdata(fig,'data',data); +0075 +0076 % switch depending on what figure called +0077 switch fig_tag +0078 case 'INV' +0079 % switch depending on the parent panel +0080 switch out.panel +0081 case 'process' +0082 switch out.field +0083 case 'start' +0084 % remove temporary data fields +0085 data = removeInversionFields(data); +0086 setappdata(fig,'data',data); +0087 % process the current selected signal +0088 id = get(gui.listbox_handles.signal,'Value'); +0089 processNMRDataControl(fig,id); +0090 updatePlotsSignal; +0091 case 'end' +0092 % remove temporary data fields +0093 data = removeInversionFields(data); +0094 setappdata(fig,'data',data); +0095 % check if the first sample is really smaller than +0096 % the last one; if not reset everything +0097 first = str2double(get(gui.edit_handles.process_start,'String')); +0098 last = value; +0099 id = get(gui.listbox_handles.signal,'Value'); +0100 maxL = length(data.import.NMR.data{id}.signal); +0101 if last == 0 || last <= first || last > maxL +0102 data.process.end = maxL; +0103 set(src,'String',num2str(data.process.end)); +0104 setappdata(fig,'data',data); +0105 end +0106 % process the current selected signal +0107 processNMRDataControl(fig,id); +0108 updatePlotsSignal; +0109 end +0110 case 'invstd' +0111 switch out.field +0112 case 'lambdaR' +0113 data.invstd.lambda = data.invstd.lambdaR(1); +0114 setappdata(fig,'data',data); +0115 case 'Tbulk' +0116 if data.invstd.Tbulk <=0 +0117 data.invstd.Tbulk = 2; +0118 setappdata(fig,'data',data); +0119 set(src,'String',num2str(data.invstd.Tbulk)); +0120 end +0121 case 'porosity' +0122 if data.invstd.porosity < 0 || data.invstd.porosity > 1 +0123 data.invstd.porosity = 1; +0124 setappdata(fig,'data',data); +0125 set(src,'String',num2str(data.invstd.porosity)); +0126 end +0127 updatePlotsDistribution; +0128 end +0129 case 'param' +0130 switch out.field +0131 case {'rho','a','CBWcutoff','BVIcutoff'} +0132 updatePlotsDistribution; +0133 updateInfo(gui.plots.SignalPanel); +0134 case 'calibAmp' +0135 data.calib.amp = data.param.calibAmp; +0136 setappdata(fig,'data',data); +0137 case 'calibVol' +0138 data.calib.vol = data.param.calibVol; +0139 setappdata(fig,'data',data); +0140 case 'sampVol' +0141 calibratePorosity; +0142 end +0143 case 'invjoint' +0144 switch out.field +0145 case 'lambdaR' +0146 data.invjoint.lambda = data.invjoint.lambdaR(1); +0147 setappdata(fig,'data',data); +0148 case 'beta' +0149 if value < 0.1 +0150 value = 1; +0151 elseif value > 89.9 +0152 value = 89; +0153 end +0154 eval(updstr); +0155 data.invjoint.gamma = data.invjoint.alpha - data.invjoint.beta; +0156 setappdata(fig,'data',data); +0157 NUCLEUSinv_updateInterface; +0158 case 'rhostart' +0159 case 'anglestart' +0160 if value < 0.1 +0161 value = 1; +0162 elseif value > 89.9 +0163 value = 89; +0164 end +0165 eval(updstr); +0166 data.invjoint.beta = value; +0167 data.invjoint.gamma = data.invjoint.alpha - data.invjoint.beta; +0168 setappdata(fig,'data',data); +0169 NUCLEUSinv_updateInterface; +0170 end +0171 end % switch out.panel +0172 setappdata(fig,'gui',gui); +0173 case 'MOD' +0174 % switch depending on the parent panel +0175 switch out.panel +0176 case 'geometry' +0177 switch out.field +0178 case 'beta' +0179 if value < 0.5 +0180 value = 1; +0181 elseif value > 89.5 +0182 value = 89; +0183 end +0184 eval(updstr); +0185 setappdata(fig,'data',data); +0186 otherwise +0187 % nothing to do +0188 end +0189 data = removeCalculationFields(data,'cps'); +0190 data = removeCalculationFields(data,'nmr'); +0191 clearSingleAxis(gui.axes_handles.cps); +0192 clearSingleAxis(gui.axes_handles.nmr); +0193 setappdata(fig,'data',data); +0194 calculateGeometry; +0195 0196 case 'pressure' 0197 switch out.field 0198 case 'range' @@ -292,64 +291,70 @@

    SOURCE CODE ^clearSingleAxis(gui.axes_handles.nmr); 0208 setappdata(fig,'data',data); 0209 NUCLEUSmod_updateInterface; -0210 case 'nmr' -0211 switch out.field -0212 case 'noise' -0213 if isfield(data.results,'NMR') -0214 calculateNMRnoise; -0215 updatePlotsNMR; -0216 end -0217 case 'porosity' -0218 if isfield(data.results,'NMR') -0219 calculateNMRporosity; -0220 updatePlotsNMR; -0221 end -0222 otherwise -0223 data = removeCalculationFields(data,'nmr'); -0224 clearSingleAxis(gui.axes_handles.nmr); -0225 setappdata(fig,'data',data); -0226 NUCLEUSmod_updateInterface; -0227 end -0228 end -0229 otherwise -0230 helpdlg({'function: onEditValue','Something is utterly wrong.'},... -0231 'wrong fig tag'); -0232 end -0233 -0234 end -0235 -0236 function out = createDataString(tag) -0237 ind = strfind(tag,'_'); -0238 out.panel = tag(1:ind(1)-1); -0239 out.field = tag(ind(1)+1:end); -0240 tag(ind) = '.'; -0241 out.updstr = ['data.',tag]; -0242 end -0243 -0244 %------------- END OF CODE -------------- -0245 -0246 %% License: -0247 % MIT License -0248 % -0249 % Copyright (c) 2018 Thomas Hiller -0250 % -0251 % Permission is hereby granted, free of charge, to any person obtaining a copy -0252 % of this software and associated documentation files (the "Software"), to deal -0253 % in the Software without restriction, including without limitation the rights -0254 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -0255 % copies of the Software, and to permit persons to whom the Software is -0256 % furnished to do so, subject to the following conditions: -0257 % -0258 % The above copyright notice and this permission notice shall be included in all -0259 % copies or substantial portions of the Software. -0260 % -0261 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -0262 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -0263 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -0264 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -0265 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -0266 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -0267 % SOFTWARE. +0210 +0211 case 'nmr' +0212 switch out.field +0213 case 'noise' +0214 if isfield(data.results,'NMR') +0215 updateNMRsignals; +0216 updatePlotsNMR; +0217 end +0218 case 'porosity' +0219 if data.nmr.porosity <= 0 || data.nmr.porosity > 1 +0220 data.nmr.porosity = 1; +0221 set(src,'String',num2str(data.nmr.porosity)); +0222 setappdata(fig,'data',data); +0223 end +0224 if isfield(data.results,'NMR') +0225 updateNMRsignals; +0226 updatePlotsNMR; +0227 end +0228 otherwise +0229 data = removeCalculationFields(data,'nmr'); +0230 clearSingleAxis(gui.axes_handles.nmr); +0231 setappdata(fig,'data',data); +0232 NUCLEUSmod_updateInterface; +0233 end +0234 end +0235 otherwise +0236 helpdlg({'function: onEditValue','Something is utterly wrong.'},... +0237 'wrong fig tag'); +0238 end +0239 +0240 end +0241 +0242 function out = createDataString(tag) +0243 ind = strfind(tag,'_'); +0244 out.panel = tag(1:ind(1)-1); +0245 out.field = tag(ind(1)+1:end); +0246 tag(ind) = '.'; +0247 out.updstr = ['data.',tag]; +0248 end +0249 +0250 %------------- END OF CODE -------------- +0251 +0252 %% License: +0253 % MIT License +0254 % +0255 % Copyright (c) 2018 Thomas Hiller +0256 % +0257 % Permission is hereby granted, free of charge, to any person obtaining a copy +0258 % of this software and associated documentation files (the "Software"), to deal +0259 % in the Software without restriction, including without limitation the rights +0260 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +0261 % copies of the Software, and to permit persons to whom the Software is +0262 % furnished to do so, subject to the following conditions: +0263 % +0264 % The above copyright notice and this permission notice shall be included in all +0265 % copies or substantial portions of the Software. +0266 % +0267 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +0268 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +0269 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +0270 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +0271 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +0272 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +0273 % SOFTWARE.
    Generated by m2html © 2005
    \ No newline at end of file diff --git a/doc/nucleus/callbacks/listboxes/onListboxData.html b/doc/nucleus/callbacks/listboxes/onListboxData.html index b839f02..5940d41 100644 --- a/doc/nucleus/callbacks/listboxes/onListboxData.html +++ b/doc/nucleus/callbacks/listboxes/onListboxData.html @@ -227,76 +227,78 @@

    SOURCE CODE ^end 0151 if isfield(data.import,'NMRMOD') -0152 data.invstd.Tbulk = data.import.NMR.para{id}.Tbulk; -0153 end -0154 % --- -0155 -0156 % update the figure data -0157 setappdata(fig,'data',data); -0158 -0159 % process the NMR data -0160 processNMRDataControl(fig,id); -0161 % update interface -0162 NUCLEUSinv_updateInterface; -0163 -0164 % update the data plot axes -0165 updatePlotsSignal; -0166 % update the info fields -0167 updateInfo(gui.plots.SignalPanel); -0168 gui = getappdata(fig,'gui'); -0169 -0170 % clear inversion axes -0171 clearSingleAxis(gui.axes_handles.rtd); -0172 clearSingleAxis(gui.axes_handles.psd); -0173 end -0174 -0175 % set focus on data -0176 set(gui.plots.SignalPanel,'Selection',1); -0177 set(gui.plots.DistPanel,'Selection',1); -0178 -0179 % reset all RUN buttons -0180 set(gui.push_handles.invstd_run,'String','<HTML><u>R</u>UN',... -0181 'BackgroundColor','g','Enable','on','Callback',@onPushRun); -0182 set(gui.push_handles.invjoint_run,'String','<HTML><u>R</u>UN',... +0152 data.param.rho = data.import.NMR.para{id}.rho*1e6; +0153 data.invstd.Tbulk = data.import.NMR.para{id}.Tbulk; +0154 data.invstd.porosity = data.import.NMR.para{id}.porosity; +0155 end +0156 % --- +0157 +0158 % update the figure data +0159 setappdata(fig,'data',data); +0160 +0161 % process the NMR data +0162 processNMRDataControl(fig,id); +0163 % update interface +0164 NUCLEUSinv_updateInterface; +0165 +0166 % update the data plot axes +0167 updatePlotsSignal; +0168 % update the info fields +0169 updateInfo(gui.plots.SignalPanel); +0170 gui = getappdata(fig,'gui'); +0171 +0172 % clear inversion axes +0173 clearSingleAxis(gui.axes_handles.rtd); +0174 clearSingleAxis(gui.axes_handles.psd); +0175 end +0176 +0177 % set focus on data +0178 set(gui.plots.SignalPanel,'Selection',1); +0179 set(gui.plots.DistPanel,'Selection',1); +0180 +0181 % reset all RUN buttons +0182 set(gui.push_handles.invstd_run,'String','<HTML><u>R</u>UN',... 0183 'BackgroundColor','g','Enable','on','Callback',@onPushRun); -0184 else -0185 helpdlg({'onListboxData:','Only choose one data set at a time.'},... -0186 'too many data'); -0187 end -0188 else -0189 helpdlg('Nothing to do because there is no data loaded!',... -0190 'onListboxData: Load NMR data first.'); -0191 end -0192 -0193 % update the figure data -0194 setappdata(fig,'gui',gui); -0195 -0196 end +0184 set(gui.push_handles.invjoint_run,'String','<HTML><u>R</u>UN',... +0185 'BackgroundColor','g','Enable','on','Callback',@onPushRun); +0186 else +0187 helpdlg({'onListboxData:','Only choose one data set at a time.'},... +0188 'too many data'); +0189 end +0190 else +0191 helpdlg('Nothing to do because there is no data loaded!',... +0192 'onListboxData: Load NMR data first.'); +0193 end +0194 +0195 % update the figure data +0196 setappdata(fig,'gui',gui); 0197 -0198 %------------- END OF CODE -------------- +0198 end 0199 -0200 %% License: -0201 % MIT License -0202 % -0203 % Copyright (c) 2018 Thomas Hiller +0200 %------------- END OF CODE -------------- +0201 +0202 %% License: +0203 % MIT License 0204 % -0205 % Permission is hereby granted, free of charge, to any person obtaining a copy -0206 % of this software and associated documentation files (the "Software"), to deal -0207 % in the Software without restriction, including without limitation the rights -0208 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -0209 % copies of the Software, and to permit persons to whom the Software is -0210 % furnished to do so, subject to the following conditions: -0211 % -0212 % The above copyright notice and this permission notice shall be included in all -0213 % copies or substantial portions of the Software. -0214 % -0215 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -0216 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -0217 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -0218 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -0219 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -0220 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -0221 % SOFTWARE. +0205 % Copyright (c) 2018 Thomas Hiller +0206 % +0207 % Permission is hereby granted, free of charge, to any person obtaining a copy +0208 % of this software and associated documentation files (the "Software"), to deal +0209 % in the Software without restriction, including without limitation the rights +0210 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +0211 % copies of the Software, and to permit persons to whom the Software is +0212 % furnished to do so, subject to the following conditions: +0213 % +0214 % The above copyright notice and this permission notice shall be included in all +0215 % copies or substantial portions of the Software. +0216 % +0217 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +0218 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +0219 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +0220 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +0221 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +0222 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +0223 % SOFTWARE.
    Generated by m2html © 2005
    \ No newline at end of file diff --git a/doc/nucleus/functions/interface/calculateNMR.html b/doc/nucleus/functions/interface/calculateNMR.html index 6510333..f9abbd4 100644 --- a/doc/nucleus/functions/interface/calculateNMR.html +++ b/doc/nucleus/functions/interface/calculateNMR.html @@ -43,9 +43,9 @@

    DESCRIPTION ^DESCRIPTION ^CROSS-REFERENCE INFORMATION ^

    This function calls: +
  • displayStatusText clears all axes of a given figure
  • updateNMRsignals adds noise to the forward NMR signals and scales the
  • updatePlotsNMR plots the forward modeled NMR data in NUCLEUSmod
  • getNMRSignal calculates the NMR signal of a fully or partially saturated
  • getNMRTimeVector Creates a NMR time vector depending on the given echo
  • This function is called by:
    • onPushRun handles the callbacks to all RUN push buttons in both GUIs and
    @@ -90,9 +90,9 @@

    SOURCE CODE ^% 0017 % Other m-files required: 0018 % displayStatusText -0019 % calculateNMRnoise -0020 % getNMRTimeVector -0021 % getNMRSignal +0019 % getNMRTimeVector +0020 % getNMRSignal +0021 % updateNMRsignals 0022 % updatePlotsNMR 0023 % 0024 % Subfunctions: @@ -139,7 +139,7 @@

    SOURCE CODE ^'data',data); 0066 0067 % add noise to the NMR signals -0068 calculateNMRnoise; +0068 updateNMRsignals; 0069 displayStatusText(gui,'Calculating NMR signals ... done'); 0070 updatePlotsNMR; 0071 % enable the RUN button again diff --git a/doc/nucleus/functions/interface/calculateNMRnoise.html b/doc/nucleus/functions/interface/calculateNMRnoise.html deleted file mode 100644 index 471e32a..0000000 --- a/doc/nucleus/functions/interface/calculateNMRnoise.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - Description of calculateNMRnoise - - - - - - - - - - - -

    calculateNMRnoise -

    - -

    PURPOSE ^

    -
    calculates the noise for the forward NMR signals
    - -

    SYNOPSIS ^

    -
    function calculateNMRnoise
    - -

    DESCRIPTION ^

    -
    calculateNMRnoise calculates the noise for the forward NMR signals
    -
    - Syntax:
    -       calculateNMRnoise
    -
    - Inputs:
    -       none
    -
    - Outputs:
    -       none
    -
    - Example:
    -       calculateNMRnoise
    -
    - Other m-files required:
    -       addNoiseToNMR
    -
    - Subfunctions:
    -       none
    -
    - MAT-files required:
    -       none
    -
    - See also: NUCLEUSmod
    - Author: Thomas Hiller
    - email: thomas.hiller[at]leibniz-liag.de
    - License: MIT License (at end)
    - - -

    CROSS-REFERENCE INFORMATION ^

    -This function calls: - -This function is called by: - - - - - -

    SOURCE CODE ^

    -
    0001 function calculateNMRnoise
    -0002 %calculateNMRnoise calculates the noise for the forward NMR signals
    -0003 %
    -0004 % Syntax:
    -0005 %       calculateNMRnoise
    -0006 %
    -0007 % Inputs:
    -0008 %       none
    -0009 %
    -0010 % Outputs:
    -0011 %       none
    -0012 %
    -0013 % Example:
    -0014 %       calculateNMRnoise
    -0015 %
    -0016 % Other m-files required:
    -0017 %       addNoiseToNMR
    -0018 %
    -0019 % Subfunctions:
    -0020 %       none
    -0021 %
    -0022 % MAT-files required:
    -0023 %       none
    -0024 %
    -0025 % See also: NUCLEUSmod
    -0026 % Author: Thomas Hiller
    -0027 % email: thomas.hiller[at]leibniz-liag.de
    -0028 % License: MIT License (at end)
    -0029 
    -0030 %------------- BEGIN CODE --------------
    -0031 
    -0032 %% get GUI handle and data
    -0033 fig = findobj('Tag','MOD');
    -0034 data = getappdata(fig,'data');
    -0035 
    -0036 %% only proceed if the noise is larger than 0
    -0037 if data.nmr.noise > 0
    -0038     % because noise is given in percentage inside the GUI convert to a value
    -0039     % between [0,1]
    -0040     [data.results.NMR.EiT1,~] = addNoiseToNMR(data.results.NMR.raw.EiT1,0,data.nmr.noise/100);
    -0041     [data.results.NMR.EdT1,~] = addNoiseToNMR(data.results.NMR.raw.EdT1,0,data.nmr.noise/100);
    -0042     [data.results.NMR.EiT2,~] = addNoiseToNMR(data.results.NMR.raw.EiT2,0,data.nmr.noise/100);
    -0043     [data.results.NMR.EdT2,~] = addNoiseToNMR(data.results.NMR.raw.EdT2,0,data.nmr.noise/100);
    -0044 else
    -0045     % reset the NMR signals with the raw data (without noise)
    -0046     data.results.NMR.EiT1 = data.results.NMR.raw.EiT1;
    -0047     data.results.NMR.EdT1 = data.results.NMR.raw.EdT1;
    -0048     data.results.NMR.EiT2 = data.results.NMR.raw.EiT2;
    -0049     data.results.NMR.EdT2 = data.results.NMR.raw.EdT2;
    -0050 end
    -0051 
    -0052 % save the noise value
    -0053 data.results.NMR.noise = data.nmr.noise/100;
    -0054 % update the GUI data
    -0055 setappdata(fig,'data',data);
    -0056 
    -0057 end
    -0058 
    -0059 %------------- END OF CODE --------------
    -0060 
    -0061 %% License:
    -0062 % MIT License
    -0063 %
    -0064 % Copyright (c) 2018 Thomas Hiller
    -0065 %
    -0066 % Permission is hereby granted, free of charge, to any person obtaining a copy
    -0067 % of this software and associated documentation files (the "Software"), to deal
    -0068 % in the Software without restriction, including without limitation the rights
    -0069 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    -0070 % copies of the Software, and to permit persons to whom the Software is
    -0071 % furnished to do so, subject to the following conditions:
    -0072 %
    -0073 % The above copyright notice and this permission notice shall be included in all
    -0074 % copies or substantial portions of the Software.
    -0075 %
    -0076 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    -0077 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    -0078 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    -0079 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    -0080 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    -0081 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    -0082 % SOFTWARE.
    -
    Generated by m2html © 2005
    - - \ No newline at end of file diff --git a/doc/nucleus/functions/interface/calculateNMRporosity.html b/doc/nucleus/functions/interface/calculateNMRporosity.html deleted file mode 100644 index 1b523ce..0000000 --- a/doc/nucleus/functions/interface/calculateNMRporosity.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - Description of calculateNMRporosity - - - - - - - - - - - -

    calculateNMRporosity -

    - -

    PURPOSE ^

    -
    rescales the NMR signals from saturation (0,1) to
    - -

    SYNOPSIS ^

    -
    function calculateNMRporosity
    - -

    DESCRIPTION ^

    -
    calculateNMRporosity rescales the NMR signals from saturation (0,1) to
    -water content by multiplying with the given porosity value
    -
    - Syntax:
    -       calculateNMRporosity
    -
    - Inputs:
    -       none
    -
    - Outputs:
    -       none
    -
    - Example:
    -       calculateNMRporosity
    -
    - Other m-files required:
    -       none
    -
    - Subfunctions:
    -       none
    -
    - MAT-files required:
    -       none
    -
    - See also: NUCLEUSmod
    - Author: Thomas Hiller
    - email: thomas.hiller[at]leibniz-liag.de
    - License: MIT License (at end)
    - - -

    CROSS-REFERENCE INFORMATION ^

    -This function calls: - -This function is called by: - - - - - -

    SOURCE CODE ^

    -
    0001 function calculateNMRporosity
    -0002 %calculateNMRporosity rescales the NMR signals from saturation (0,1) to
    -0003 %water content by multiplying with the given porosity value
    -0004 %
    -0005 % Syntax:
    -0006 %       calculateNMRporosity
    -0007 %
    -0008 % Inputs:
    -0009 %       none
    -0010 %
    -0011 % Outputs:
    -0012 %       none
    -0013 %
    -0014 % Example:
    -0015 %       calculateNMRporosity
    -0016 %
    -0017 % Other m-files required:
    -0018 %       none
    -0019 %
    -0020 % Subfunctions:
    -0021 %       none
    -0022 %
    -0023 % MAT-files required:
    -0024 %       none
    -0025 %
    -0026 % See also: NUCLEUSmod
    -0027 % Author: Thomas Hiller
    -0028 % email: thomas.hiller[at]leibniz-liag.de
    -0029 % License: MIT License (at end)
    -0030 
    -0031 %------------- BEGIN CODE --------------
    -0032 
    -0033 %% get GUI handle and data
    -0034 fig = findobj('Tag','MOD');
    -0035 data = getappdata(fig,'data');
    -0036 
    -0037 %% only proceed if the porosity is smaller than 1
    -0038 if data.nmr.porosity < 1
    -0039     data.results.NMR.EiT1 = data.nmr.porosity.*data.results.NMR.raw.EiT1;
    -0040     data.results.NMR.EdT1 = data.nmr.porosity.*data.results.NMR.raw.EdT1;
    -0041     data.results.NMR.EiT2 = data.nmr.porosity.*data.results.NMR.raw.EiT2;
    -0042     data.results.NMR.EdT2 = data.nmr.porosity.*data.results.NMR.raw.EdT2;
    -0043 else
    -0044     % reset the NMR signals with the raw data (without noise)
    -0045     data.results.NMR.EiT1 = data.results.NMR.raw.EiT1;
    -0046     data.results.NMR.EdT1 = data.results.NMR.raw.EdT1;
    -0047     data.results.NMR.EiT2 = data.results.NMR.raw.EiT2;
    -0048     data.results.NMR.EdT2 = data.results.NMR.raw.EdT2;
    -0049 end
    -0050 
    -0051 % save the porosity value
    -0052 data.results.NMR.porosity = data.nmr.porosity;
    -0053 % update the GUI data
    -0054 setappdata(fig,'data',data);
    -0055 
    -0056 end
    -0057 
    -0058 %------------- END OF CODE --------------
    -0059 
    -0060 %% License:
    -0061 % MIT License
    -0062 %
    -0063 % Copyright (c) 2018 Thomas Hiller
    -0064 %
    -0065 % Permission is hereby granted, free of charge, to any person obtaining a copy
    -0066 % of this software and associated documentation files (the "Software"), to deal
    -0067 % in the Software without restriction, including without limitation the rights
    -0068 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    -0069 % copies of the Software, and to permit persons to whom the Software is
    -0070 % furnished to do so, subject to the following conditions:
    -0071 %
    -0072 % The above copyright notice and this permission notice shall be included in all
    -0073 % copies or substantial portions of the Software.
    -0074 %
    -0075 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    -0076 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    -0077 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    -0078 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    -0079 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    -0080 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    -0081 % SOFTWARE.
    -
    Generated by m2html © 2005
    - - \ No newline at end of file diff --git a/doc/nucleus/functions/interface/exportData.html b/doc/nucleus/functions/interface/exportData.html index 5248997..b2b23f7 100644 --- a/doc/nucleus/functions/interface/exportData.html +++ b/doc/nucleus/functions/interface/exportData.html @@ -216,435 +216,445 @@

    SOURCE CODE ^case 'LIAG' 0141 -0142 if isfield(data.import,'LIAG') -0143 % find id of sample -0144 id = 1; -0145 spath = data.import.LIAG.workpaths{id}; -0146 sfilename = ['INV_',data.import.NMR.filesShort{id}]; -0147 -0148 % session output -0149 silent.sname = fullfile(spath,[sfilename,'_session.mat']); -0150 exportINV('session',silent); -0151 -0152 % csv output -0153 csvname = fullfile(spath,[sfilename,'.csv']); -0154 exportINV_CSV(INVdata{id},csvname); -0155 -0156 % png graphics -0157 pngname = fullfile(spath,[sfilename,'.png']); -0158 [f,ax]=exportGraphics('INV','fig'); -0159 -0160 figure(f); -0161 por = INVdata{id}.invstd.porosity; -0162 tname = [sfilename(5:end),' (porosity: ',... -0163 sprintf('%2.1f',por*100),' vol. %)']; -0164 set(get(ax(1),'Title'),'String',tname,'Interpreter','none'); -0165 -0166 yy = get(ax(2),'YLim'); -0167 TLGM = INVdata{id}.results.invstd.Tlgm; -0168 T = INVdata{id}.results.invstd.T1T2me; -0169 F = INVdata{id}.results.invstd.T1T2f; -0170 F = por.*F./sum(F); -0171 amp = findApproxTlgmAmplitude(T,F,TLGM); -0172 stem(TLGM,amp,... -0173 'x-','Color',[0.3 0.3 0.3],'LineWidth',2,... -0174 'Tag','TLGM','Parent',ax(2)); -0175 -0176 switch INVdata{id}.process.timescale -0177 case 's' -0178 CBW = INVdata{id}.param.CBWcutoff/1000; -0179 BVI = INVdata{id}.param.BVIcutoff/1000; -0180 case 'ms' -0181 CBW = INVdata{id}.param.CBWcutoff; -0182 BVI = INVdata{id}.param.BVIcutoff; -0183 end -0184 line([CBW CBW],[yy(1) yy(2)],'Color',[0.3 0.3 0.3],'LineStyle','--',... -0185 'LineWidth',1,'Parent',ax(2),'Tag','infolines'); -0186 line([BVI BVI],[yy(1) yy(2)],'Color',[0.3 0.3 0.3],'LineStyle','--',... -0187 'LineWidth',1,'Parent',ax(2),'Tag','infolines'); -0188 legend(ax(2),'RTD','TLGM','cutoffs'); -0189 -0190 CBWa = abs(sum(F(T<=CBW))/sum(F)); -0191 BVIa = abs(sum(F(T>CBW & T<=BVI))/sum(F)); -0192 BVMa = abs(sum(F(T>BVI))/sum(F)); -0193 % tname2 = ['CBW: ',sprintf('%2.1f',por*100*CBWa),... -0194 % ' | BVI: ',sprintf('%2.1f',por*100*BVIa),... -0195 % ' | BVM: ',sprintf('%2.1f',por*100*BVMa),... -0196 % ' vol. % | TLGM: ',sprintf('%4.3f',TLGM),' [s]']; -0197 tname2 = ['CBW / BVI / BVM: ',sprintf('%2.1f',por*100*CBWa),... -0198 ' / ',sprintf('%2.1f',por*100*BVIa),... -0199 ' / ',sprintf('%2.1f',por*100*BVMa),... -0200 ' vol. % | TLGM: ',sprintf('%4.3f',TLGM),' [s]']; -0201 set(get(ax(2),'Title'),'String',tname2,'Interpreter','none'); -0202 -0203 set(f,'PaperType','A4','PaperUnits','centimeters',... -0204 'PaperOrientation','portrait'); -0205 set(f,'PaperPositionMode','manual',... -0206 'PaperPosition',[0.6 6.2 19.7 17.2]); -0207 set(f,'Renderer','painter'); -0208 print(f,pngname,'-r300','-dpng'); -0209 close(f); -0210 -0211 else -0212 helpdlg({'function: exportData',... -0213 'This routine works only on LIAG specific project data.'},... -0214 'No LIAG data'); -0215 end -0216 end -0217 end -0218 -0219 case 'MOD' -0220 % check if data can be exported -0221 doexport = checkMOD(data); -0222 if doexport -0223 % different export formats -0224 switch format -0225 case 'mat' -0226 % gather all relevant data -0227 out = data.results; -0228 if isfield(out.NMR.raw,'Tb') -0229 out.NMR.raw = rmfield(out.NMR.raw,'Tb'); -0230 end -0231 if isfield(out.NMR.raw,'rho') -0232 out.NMR.raw = rmfield(out.NMR.raw,'rho'); -0233 end -0234 out.NMRMOD_GUI.geometry = data.geometry; -0235 out.NMRMOD_GUI.pressure = data.pressure; -0236 out.NMRMOD_GUI.nmr = data.nmr; -0237 out.NMRMOD_GUI.myui = gui.myui; -0238 -0239 displayStatusText(gui,'Saving to MAT-file ...'); -0240 [FileName,PathName,~] = uiputfile({'*.mat','Matlab file'},'NUCLEUSmod: Save Data',fullfile(pwd,'NUCLEUSmod_forward.mat')); -0241 -0242 if ~isequal(FileName,0) || ~isequal(PathName,0) -0243 clear data -0244 data = out; %#ok<NASGU> -0245 save(fullfile(PathName,FileName),'data'); -0246 displayStatusText(gui,'Saving to MAT-file ... done.'); -0247 else -0248 displayStatusText(gui,'Saving to MAT-file ... canceled.'); -0249 end -0250 -0251 case 'xls' -0252 indd = data.pressure.DrainLevels; -0253 indi = data.pressure.ImbLevels; -0254 results = data.results; -0255 -0256 displayStatusText(gui,'Saving to XLS-file ...'); -0257 [FileName,PathName,~] = uiputfile({'*.xls','XLS file'},'NUCLEUSmod: Save Data',fullfile(pwd,'NUCLEUSmod_forward.xls')); -0258 -0259 if ~isequal(FileName,0) || ~isequal(PathName,0) -0260 exportMOD_EXCEL; -0261 displayStatusText(gui,'Saving to XLS-file ... done.'); -0262 else -0263 displayStatusText(gui,'Saving to XLS-file ... canceled.'); -0264 end +0142 if isfield(data.import,'LIAG') +0143 % display info text +0144 displayStatusText(gui,... +0145 'Exporting LIAG archive data ...'); +0146 % find id of sample +0147 id = 1; +0148 spath = data.import.LIAG.workpaths{id}; +0149 sfilename = ['INV_',data.import.NMR.filesShort{id}]; +0150 +0151 % session output +0152 silent.sname = fullfile(spath,[sfilename,'_session.mat']); +0153 exportINV('session',silent); +0154 +0155 % csv output +0156 csvname = fullfile(spath,[sfilename,'.csv']); +0157 exportINV_CSV(INVdata{id},csvname); +0158 +0159 % png graphics +0160 pngname = fullfile(spath,[sfilename,'.png']); +0161 [f,ax] = exportGraphics('INV','fig'); +0162 +0163 figure(f); +0164 por = INVdata{id}.invstd.porosity; +0165 tname = [sfilename(5:end),' (water content: ',... +0166 sprintf('%2.1f',por*100),' vol. %)']; +0167 set(get(ax(1),'Title'),'String',tname,'Interpreter','none'); +0168 +0169 yy = get(ax(2),'YLim'); +0170 TLGM = INVdata{id}.results.invstd.Tlgm; +0171 T = INVdata{id}.results.invstd.T1T2me; +0172 F = INVdata{id}.results.invstd.T1T2f; +0173 F = 100.*por.*F./sum(F); +0174 amp = findApproxTlgmAmplitude(T,F,TLGM); +0175 stem(TLGM,amp,... +0176 'x-','Color',[0.3 0.3 0.3],'LineWidth',2,... +0177 'Tag','TLGM','Parent',ax(2)); +0178 +0179 switch INVdata{id}.process.timescale +0180 case 's' +0181 CBW = INVdata{id}.param.CBWcutoff/1000; +0182 BVI = INVdata{id}.param.BVIcutoff/1000; +0183 case 'ms' +0184 CBW = INVdata{id}.param.CBWcutoff; +0185 BVI = INVdata{id}.param.BVIcutoff; +0186 end +0187 line([CBW CBW],[yy(1) yy(2)],'Color',[0.3 0.3 0.3],'LineStyle','--',... +0188 'LineWidth',1,'Parent',ax(2),'Tag','infolines'); +0189 line([BVI BVI],[yy(1) yy(2)],'Color',[0.3 0.3 0.3],'LineStyle','--',... +0190 'LineWidth',1,'Parent',ax(2),'Tag','infolines'); +0191 legend(ax(2),'RTD','TLGM','cutoffs'); +0192 +0193 CBWa = abs(sum(F(T<=CBW))/sum(F)); +0194 BVIa = abs(sum(F(T>CBW & T<=BVI))/sum(F)); +0195 BVMa = abs(sum(F(T>BVI))/sum(F)); +0196 % tname2 = ['CBW: ',sprintf('%2.1f',por*100*CBWa),... +0197 % ' | BVI: ',sprintf('%2.1f',por*100*BVIa),... +0198 % ' | BVM: ',sprintf('%2.1f',por*100*BVMa),... +0199 % ' vol. % | TLGM: ',sprintf('%4.3f',TLGM),' [s]']; +0200 tname2 = ['CBW / BVI / BVM: ',sprintf('%2.1f',por*100*CBWa),... +0201 ' / ',sprintf('%2.1f',por*100*BVIa),... +0202 ' / ',sprintf('%2.1f',por*100*BVMa),... +0203 ' vol. % | TLGM: ',sprintf('%4.3f',TLGM),' [s]']; +0204 set(get(ax(2),'Title'),'String',tname2,'Interpreter','none'); +0205 +0206 set(f,'PaperType','A4','PaperUnits','centimeters',... +0207 'PaperOrientation','portrait'); +0208 set(f,'PaperPositionMode','manual',... +0209 'PaperPosition',[0.6 6.2 19.7 17.2]); +0210 set(f,'Renderer','painter'); +0211 print(f,pngname,'-r300','-dpng'); +0212 close(f); +0213 +0214 % display info text +0215 displayStatusText(gui,... +0216 'Exporting LIAG archive data ... done'); +0217 +0218 else +0219 helpdlg({'function: exportData',... +0220 'This routine works only on LIAG specific project data.'},... +0221 'No LIAG data'); +0222 end +0223 end +0224 end +0225 +0226 case 'MOD' +0227 % check if data can be exported +0228 doexport = checkMOD(data); +0229 if doexport +0230 % different export formats +0231 switch format +0232 case 'mat' +0233 % gather all relevant data +0234 out = data.results; +0235 if isfield(out.NMR.raw,'Tb') +0236 out.NMR.raw = rmfield(out.NMR.raw,'Tb'); +0237 end +0238 if isfield(out.NMR.raw,'rho') +0239 out.NMR.raw = rmfield(out.NMR.raw,'rho'); +0240 end +0241 out.NMRMOD_GUI.geometry = data.geometry; +0242 out.NMRMOD_GUI.pressure = data.pressure; +0243 out.NMRMOD_GUI.nmr = data.nmr; +0244 out.NMRMOD_GUI.myui = gui.myui; +0245 +0246 displayStatusText(gui,'Saving to MAT-file ...'); +0247 [FileName,PathName,~] = uiputfile({'*.mat','Matlab file'},'NUCLEUSmod: Save Data',fullfile(pwd,'NUCLEUSmod_forward.mat')); +0248 +0249 if ~isequal(FileName,0) || ~isequal(PathName,0) +0250 clear data +0251 data = out; %#ok<NASGU> +0252 save(fullfile(PathName,FileName),'data'); +0253 displayStatusText(gui,'Saving to MAT-file ... done.'); +0254 else +0255 displayStatusText(gui,'Saving to MAT-file ... canceled.'); +0256 end +0257 +0258 case 'xls' +0259 indd = data.pressure.DrainLevels; +0260 indi = data.pressure.ImbLevels; +0261 results = data.results; +0262 +0263 displayStatusText(gui,'Saving to XLS-file ...'); +0264 [FileName,PathName,~] = uiputfile({'*.xls','XLS file'},'NUCLEUSmod: Save Data',fullfile(pwd,'NUCLEUSmod_forward.xls')); 0265 -0266 otherwise -0267 helpdlg({'exportData:','Not yet implemented.'},'NUCLEUSmod info:'); -0268 -0269 end -0270 end -0271 end -0272 -0273 end -0274 -0275 %% -0276 function exportINV_EXCEL(gui,INVdata,id,sfile,spath) -0277 unit = INVdata{id}.process.timescale; -0278 -0279 % gather all data -0280 % raw data -0281 tmp1(:,1) = INVdata{id}.results.nmrraw.t(:); -0282 header1{1} = ['time [',unit,']']; -0283 if isreal(INVdata{id}.results.nmrraw.s(:)) -0284 header1{2} = 'amplitude [a.u.]'; -0285 tmp1(:,2) = INVdata{id}.results.nmrraw.s(:); -0286 -0287 b1 = {'raw data',''}; -0288 b1(2,:) = header1; -0289 b1(3:2+size(tmp1,1),:) = [num2cell(tmp1(:,1)),num2cell(tmp1(:,2))]; -0290 else -0291 header1{2} = 'real [a.u.]'; -0292 header1{3} = 'imag [a.u.]'; -0293 tmp1(:,2) = real(INVdata{id}.results.nmrraw.s(:)); -0294 tmp1(:,3) = imag(INVdata{id}.results.nmrraw.s(:)); -0295 -0296 b1 = {'raw data','',''}; -0297 b1(2,:) = header1; -0298 b1(3:2+size(tmp1,1),:) = [num2cell(tmp1(:,1)),num2cell(tmp1(:,2)),... -0299 num2cell(tmp1(:,3))]; -0300 end -0301 -0302 % proc data -0303 tmp2(:,1) = INVdata{id}.results.nmrproc.t(:); -0304 tmp2(:,2) = INVdata{id}.results.nmrproc.s(:); -0305 header2{1} = ['time [',unit,']']; -0306 header2{2} = 'amplitude [a.u.]'; -0307 -0308 b2 = {'proc data',''}; -0309 b2(2,:) = header2; -0310 b2(3:2+size(tmp2,1),:) = [num2cell(tmp2(:,1)),num2cell(tmp2(:,2))]; -0311 -0312 % fit data (incl. residuals) -0313 tmp3(:,1) = INVdata{id}.results.invstd.fit_t(:); -0314 tmp3(:,2) = INVdata{id}.results.invstd.fit_s(:); -0315 tmp3(:,3) = INVdata{id}.results.invstd.residual(:); -0316 header3{1} = ['time [',unit,']']; -0317 header3{2} = 'amplitude [a.u.]'; -0318 header3{3} = 'residual [-]'; -0319 -0320 b3 = {'fit data','',''}; -0321 b3(2,:) = header3; -0322 b3(3:2+size(tmp3,1),:) = [num2cell(tmp3(:,1)),num2cell(tmp3(:,2)),... -0323 num2cell(tmp3(:,3))]; -0324 -0325 % relaxation times -0326 switch INVdata{id}.invstd.invtype -0327 case {'mono','free'} -0328 switch INVdata{id}.results.nmrproc.T1T2 -0329 case 'T1' -0330 tmp4 = [INVdata{id}.results.invstd.T1(:)... -0331 INVdata{id}.results.invstd.E0(:)]; -0332 header4 = {['T1 [',unit,']'],'amplitude [a.u.]'}; -0333 case 'T2' -0334 tmp4 = [INVdata{id}.results.invstd.T2(:)... -0335 INVdata{id}.results.invstd.E0(:)]; -0336 header4 = {['T2 [',unit,']'],'amplitude [a.u.]'}; -0337 end -0338 -0339 case {'ILA','NNLS'} -0340 tmp4 = [INVdata{id}.results.invstd.T1T2me(:)... -0341 INVdata{id}.results.invstd.T1T2f(:)]; -0342 header4 = {['relaxation times [',unit,']'],'amplitudes [a.u.]'}; -0343 -0344 otherwise -0345 disp('Something is utterly wrong.') -0346 end -0347 -0348 b4 = {'relaxation times',''}; -0349 b4(2,:) = header4; -0350 b4(3:2+size(tmp4,1),:) = [num2cell(tmp4(:,1)),num2cell(tmp4(:,2))]; -0351 -0352 % glue together the output matrix -0353 out(1:size(b1,1),1:size(b1,2)) = b1; -0354 yi = size(b1,2)+2; -0355 out(1:size(b2,1),yi:yi-1+size(b2,2)) = b2; -0356 yi = yi + size(b2,2)+1; -0357 out(1:size(b3,1),yi:yi-1+size(b3,2)) = b3; -0358 yi = yi + size(b3,2)+1; -0359 out(1:size(b4,1),yi:yi-1+size(b4,2)) = b4; -0360 -0361 % display info text -0362 displayStatusText(gui,... -0363 'Exporting inversion data to Excel-file ...'); -0364 % save to file -0365 xlswrite(fullfile(spath,sfile),out,'NMRdata','A1'); -0366 -0367 % remove the first standard excel sheet -0368 [~,sheets] = xlsfinfo(fullfile(spath,sfile)); -0369 objExcel = actxserver('Excel.Application'); -0370 objExcel.Workbooks.Open(fullfile(spath,sfile)); -0371 objExcel.ActiveWorkbook.Worksheets.Item(sheets{1}).Delete; -0372 objExcel.ActiveWorkbook.Save; -0373 objExcel.ActiveWorkbook.Close; -0374 objExcel.Quit; -0375 objExcel.delete; -0376 % display info text -0377 displayStatusText(gui,... -0378 'Exporting inversion data to Excel-file ... done'); -0379 end -0380 -0381 %% -0382 function exportINV_CSV(INVdata,sfile) -0383 unit = INVdata.process.timescale; -0384 -0385 % gather all data -0386 % proc data -0387 tmp2(:,1) = INVdata.results.nmrproc.t(:); -0388 tmp2(:,2) = INVdata.results.nmrproc.s(:); -0389 header2{1} = ['time [',unit,']']; -0390 header2{2} = 'signal [a.u.]'; +0266 if ~isequal(FileName,0) || ~isequal(PathName,0) +0267 exportMOD_EXCEL; +0268 displayStatusText(gui,'Saving to XLS-file ... done.'); +0269 else +0270 displayStatusText(gui,'Saving to XLS-file ... canceled.'); +0271 end +0272 +0273 otherwise +0274 helpdlg({'exportData:','Not yet implemented.'},'NUCLEUSmod info:'); +0275 +0276 end +0277 end +0278 end +0279 +0280 end +0281 +0282 %% +0283 function exportINV_EXCEL(gui,INVdata,id,sfile,spath) +0284 unit = INVdata{id}.process.timescale; +0285 +0286 % gather all data +0287 % raw data +0288 tmp1(:,1) = INVdata{id}.results.nmrraw.t(:); +0289 header1{1} = ['time [',unit,']']; +0290 if isreal(INVdata{id}.results.nmrraw.s(:)) +0291 header1{2} = 'amplitude [a.u.]'; +0292 tmp1(:,2) = INVdata{id}.results.nmrraw.s(:); +0293 +0294 b1 = {'raw data',''}; +0295 b1(2,:) = header1; +0296 b1(3:2+size(tmp1,1),:) = [num2cell(tmp1(:,1)),num2cell(tmp1(:,2))]; +0297 else +0298 header1{2} = 'real [a.u.]'; +0299 header1{3} = 'imag [a.u.]'; +0300 tmp1(:,2) = real(INVdata{id}.results.nmrraw.s(:)); +0301 tmp1(:,3) = imag(INVdata{id}.results.nmrraw.s(:)); +0302 +0303 b1 = {'raw data','',''}; +0304 b1(2,:) = header1; +0305 b1(3:2+size(tmp1,1),:) = [num2cell(tmp1(:,1)),num2cell(tmp1(:,2)),... +0306 num2cell(tmp1(:,3))]; +0307 end +0308 +0309 % proc data +0310 tmp2(:,1) = INVdata{id}.results.nmrproc.t(:); +0311 tmp2(:,2) = INVdata{id}.results.nmrproc.s(:); +0312 header2{1} = ['time [',unit,']']; +0313 header2{2} = 'amplitude [a.u.]'; +0314 +0315 b2 = {'proc data',''}; +0316 b2(2,:) = header2; +0317 b2(3:2+size(tmp2,1),:) = [num2cell(tmp2(:,1)),num2cell(tmp2(:,2))]; +0318 +0319 % fit data (incl. residuals) +0320 tmp3(:,1) = INVdata{id}.results.invstd.fit_t(:); +0321 tmp3(:,2) = INVdata{id}.results.invstd.fit_s(:); +0322 tmp3(:,3) = INVdata{id}.results.invstd.residual(:); +0323 header3{1} = ['time [',unit,']']; +0324 header3{2} = 'amplitude [a.u.]'; +0325 header3{3} = 'residual [-]'; +0326 +0327 b3 = {'fit data','',''}; +0328 b3(2,:) = header3; +0329 b3(3:2+size(tmp3,1),:) = [num2cell(tmp3(:,1)),num2cell(tmp3(:,2)),... +0330 num2cell(tmp3(:,3))]; +0331 +0332 % relaxation times +0333 switch INVdata{id}.invstd.invtype +0334 case {'mono','free'} +0335 switch INVdata{id}.results.nmrproc.T1T2 +0336 case 'T1' +0337 tmp4 = [INVdata{id}.results.invstd.T1(:)... +0338 INVdata{id}.results.invstd.E0(:)]; +0339 header4 = {['T1 [',unit,']'],'amplitude [a.u.]'}; +0340 case 'T2' +0341 tmp4 = [INVdata{id}.results.invstd.T2(:)... +0342 INVdata{id}.results.invstd.E0(:)]; +0343 header4 = {['T2 [',unit,']'],'amplitude [a.u.]'}; +0344 end +0345 +0346 case {'ILA','NNLS'} +0347 tmp4 = [INVdata{id}.results.invstd.T1T2me(:)... +0348 INVdata{id}.results.invstd.T1T2f(:)]; +0349 header4 = {['relaxation times [',unit,']'],'amplitudes [a.u.]'}; +0350 +0351 otherwise +0352 disp('Something is utterly wrong.') +0353 end +0354 +0355 b4 = {'relaxation times',''}; +0356 b4(2,:) = header4; +0357 b4(3:2+size(tmp4,1),:) = [num2cell(tmp4(:,1)),num2cell(tmp4(:,2))]; +0358 +0359 % glue together the output matrix +0360 out(1:size(b1,1),1:size(b1,2)) = b1; +0361 yi = size(b1,2)+2; +0362 out(1:size(b2,1),yi:yi-1+size(b2,2)) = b2; +0363 yi = yi + size(b2,2)+1; +0364 out(1:size(b3,1),yi:yi-1+size(b3,2)) = b3; +0365 yi = yi + size(b3,2)+1; +0366 out(1:size(b4,1),yi:yi-1+size(b4,2)) = b4; +0367 +0368 % display info text +0369 displayStatusText(gui,... +0370 'Exporting inversion data to Excel-file ...'); +0371 % save to file +0372 xlswrite(fullfile(spath,sfile),out,'NMRdata','A1'); +0373 +0374 % remove the first standard excel sheet +0375 [~,sheets] = xlsfinfo(fullfile(spath,sfile)); +0376 objExcel = actxserver('Excel.Application'); +0377 objExcel.Workbooks.Open(fullfile(spath,sfile)); +0378 objExcel.ActiveWorkbook.Worksheets.Item(sheets{1}).Delete; +0379 objExcel.ActiveWorkbook.Save; +0380 objExcel.ActiveWorkbook.Close; +0381 objExcel.Quit; +0382 objExcel.delete; +0383 % display info text +0384 displayStatusText(gui,... +0385 'Exporting inversion data to Excel-file ... done'); +0386 end +0387 +0388 %% +0389 function exportINV_CSV(INVdata,sfile) +0390 unit = INVdata.process.timescale; 0391 -0392 % fit data (incl. residuals) -0393 tmp3(:,1) = INVdata.results.invstd.fit_t(:); -0394 tmp3(:,2) = INVdata.results.invstd.fit_s(:); -0395 tmp3(:,3) = INVdata.results.invstd.residual(:); -0396 header3{1} = ['time [',unit,']']; -0397 header3{2} = 'fit [a.u.]'; -0398 header3{3} = 'residual [-]'; -0399 -0400 % relaxation times -0401 switch INVdata.invstd.invtype -0402 case {'ILA','NNLS'} -0403 tmp4 = [INVdata.results.invstd.T1T2me(:)... -0404 INVdata.results.invstd.T1T2f(:)]; -0405 header4 = {['relaxation times [',unit,']'],'frequency [-]'}; -0406 -0407 otherwise -0408 % Nothing to do -0409 end -0410 -0411 % glue together headers -0412 cHeader = [header2 header3 header4]; -0413 % insert commas -0414 commaHeader = [cHeader;repmat({','},1,numel(cHeader))]; -0415 commaHeader = commaHeader(:)'; -0416 % cHeader as string with commas -0417 textHeader = cell2mat(commaHeader(1:numel(commaHeader)-1)); -0418 -0419 maxrows = max([size(tmp2,1) size(tmp3,1) size(tmp4,1)]); -0420 % glue together data -0421 if size(tmp2,1) < maxrows -0422 tmp2(end+1:maxrows,:) = NaN; -0423 end -0424 if size(tmp3,1) < maxrows -0425 tmp3(end+1:maxrows,:) = NaN; -0426 end -0427 if size(tmp4,1) < maxrows -0428 tmp4(end+1:maxrows,:) = NaN; -0429 end -0430 out(1:maxrows,1:size(tmp2,2)) = tmp2; -0431 yi = size(tmp2,2)+1; -0432 out(1:maxrows,yi:yi-1+size(tmp3,2)) = tmp3; -0433 yi = yi + size(tmp3,2); -0434 out(1:maxrows,yi:yi-1+size(tmp4,2)) = tmp4; -0435 -0436 % save to file -0437 %write header to file -0438 fid = fopen(sfile,'w'); -0439 fprintf(fid,'%s\n',textHeader); -0440 fclose(fid); -0441 %write data to end of file -0442 dlmwrite(sfile,out,'-append','precision','%.5f'); -0443 -0444 end +0392 % gather all data +0393 % proc data +0394 tmp2(:,1) = INVdata.results.nmrproc.t(:); +0395 tmp2(:,2) = INVdata.results.nmrproc.s(:); +0396 header2{1} = ['time [',unit,']']; +0397 header2{2} = 'signal [a.u.]'; +0398 +0399 % fit data (incl. residuals) +0400 tmp3(:,1) = INVdata.results.invstd.fit_t(:); +0401 tmp3(:,2) = INVdata.results.invstd.fit_s(:); +0402 tmp3(:,3) = INVdata.results.invstd.residual(:); +0403 header3{1} = ['time [',unit,']']; +0404 header3{2} = 'fit [a.u.]'; +0405 header3{3} = 'residual [-]'; +0406 +0407 % relaxation times +0408 switch INVdata.invstd.invtype +0409 case {'ILA','NNLS'} +0410 por = INVdata.invstd.porosity; +0411 F = INVdata.results.invstd.T1T2f(:); +0412 F = 100*por.*F./sum(F); +0413 tmp4 = [INVdata.results.invstd.T1T2me(:)... +0414 INVdata.results.invstd.T1T2f(:) F]; +0415 header4 = {['relaxation times [',unit,']'],'frequency [-]',' water content [vol. %]'}; +0416 +0417 otherwise +0418 % Nothing to do +0419 end +0420 +0421 % glue together headers +0422 cHeader = [header2 header3 header4]; +0423 % insert commas +0424 commaHeader = [cHeader;repmat({','},1,numel(cHeader))]; +0425 commaHeader = commaHeader(:)'; +0426 % cHeader as string with commas +0427 textHeader = cell2mat(commaHeader(1:numel(commaHeader)-1)); +0428 +0429 maxrows = max([size(tmp2,1) size(tmp3,1) size(tmp4,1)]); +0430 % glue together data +0431 if size(tmp2,1) < maxrows +0432 tmp2(end+1:maxrows,:) = NaN; +0433 end +0434 if size(tmp3,1) < maxrows +0435 tmp3(end+1:maxrows,:) = NaN; +0436 end +0437 if size(tmp4,1) < maxrows +0438 tmp4(end+1:maxrows,:) = NaN; +0439 end +0440 out(1:maxrows,1:size(tmp2,2)) = tmp2; +0441 yi = size(tmp2,2)+1; +0442 out(1:maxrows,yi:yi-1+size(tmp3,2)) = tmp3; +0443 yi = yi + size(tmp3,2); +0444 out(1:maxrows,yi:yi-1+size(tmp4,2)) = tmp4; 0445 -0446 %% -0447 function exportMOD_EXCEL() -0448 xlswrite(fullfile(PathName,FileName),{'pressure [Pa]','saturation (drain)','saturation (imb)'},'CPS','A1'); -0449 xlswrite(fullfile(PathName,FileName),[results.SAT.pressure(:) results.SAT.Sdfull(:) results.SAT.Sifull(:)],'CPS','A2'); -0450 -0451 out = zeros(numel(results.NMR.t),numel(indd)+1); -0452 out(:,1) = results.NMR.t(:); -0453 header = cell(1,1); -0454 header{1} = 'time [s]'; -0455 for i = 1:numel(indd) -0456 out(:,i+1) = results.NMR.EdT1(indd(i),:)'; -0457 header{i+1} = ['S',num2str(i)]; -0458 end -0459 xlswrite(fullfile(PathName,FileName),header,'NMR_T1_drain','A1'); -0460 xlswrite(fullfile(PathName,FileName),out,'NMR_T1_drain','A2'); +0446 % save to file +0447 %write header to file +0448 fid = fopen(sfile,'w'); +0449 fprintf(fid,'%s\n',textHeader); +0450 fclose(fid); +0451 %write data to end of file +0452 dlmwrite(sfile,out,'-append','precision','%.5f'); +0453 +0454 end +0455 +0456 %% +0457 function exportMOD_EXCEL() +0458 xlswrite(fullfile(PathName,FileName),{'pressure [Pa]','saturation (drain)','saturation (imb)'},'CPS','A1'); +0459 xlswrite(fullfile(PathName,FileName),[results.SAT.pressure(:) results.SAT.Sdfull(:) results.SAT.Sifull(:)],'CPS','A2'); +0460 0461 out = zeros(numel(results.NMR.t),numel(indd)+1); 0462 out(:,1) = results.NMR.t(:); 0463 header = cell(1,1); 0464 header{1} = 'time [s]'; 0465 for i = 1:numel(indd) -0466 out(:,i+1) = results.NMR.EdT2(indd(i),:)'; +0466 out(:,i+1) = results.NMR.EdT1(indd(i),:)'; 0467 header{i+1} = ['S',num2str(i)]; 0468 end -0469 xlswrite(fullfile(PathName,FileName),header,'NMR_T2_drain','A1'); -0470 xlswrite(fullfile(PathName,FileName),out,'NMR_T2_drain','A2'); -0471 -0472 out = zeros(numel(results.NMR.t),numel(indi)+1); -0473 out(:,1) = results.NMR.t(:); -0474 header = cell(1,1); -0475 header{1} = 'time [s]'; -0476 for i = 1:numel(indi) -0477 out(:,i+1) = results.NMR.EiT1(indi(i),:)'; -0478 header{i+1} = ['S',num2str(i)]; -0479 end -0480 xlswrite(fullfile(PathName,FileName),header,'NMR_T1_imb','A1'); -0481 xlswrite(fullfile(PathName,FileName),out,'NMR_T1_imb','A2'); -0482 -0483 out = zeros(numel(results.NMR.t),numel(indi)+1); -0484 out(:,1) = results.NMR.t(:); -0485 header = cell(1,1); -0486 header{1} = 'time [s]'; -0487 for i = 1:numel(indi) -0488 out(:,i+1) = results.NMR.EiT2(indi(i),:)'; -0489 header{i+1} = ['S',num2str(i)]; -0490 end -0491 xlswrite(fullfile(PathName,FileName),header,'NMR_T2_imb','A1'); -0492 xlswrite(fullfile(PathName,FileName),out,'NMR_T2_imb','A2'); -0493 -0494 % remove the first standard excel sheet -0495 [~,sheets] = xlsfinfo(fullfile(PathName,FileName)); -0496 objExcel = actxserver('Excel.Application'); -0497 objExcel.Workbooks.Open(fullfile(PathName,FileName)); -0498 objExcel.ActiveWorkbook.Worksheets.Item(sheets{1}).Delete; -0499 objExcel.ActiveWorkbook.Save; -0500 objExcel.ActiveWorkbook.Close; -0501 objExcel.Quit; -0502 objExcel.delete; -0503 end -0504 -0505 %% -0506 function doexport = checkINV(INVdata,id) -0507 -0508 doexport = false; -0509 if ~isempty(INVdata) && ~isempty(id) -0510 if isstruct(INVdata{id}) -0511 doexport = true; -0512 else -0513 helpdlg({'exportData:','No inversion data to save'},... -0514 'Nothing to save'); -0515 end -0516 else -0517 helpdlg({'exportData:','No inversion data to save'},... -0518 'Nothing to save'); -0519 end -0520 -0521 end -0522 -0523 %% -0524 function doexport = checkMOD(data) -0525 -0526 doexport = false; -0527 if isfield(data,'results') -0528 if isfield(data.results,'NMR') -0529 doexport = true; -0530 else -0531 helpdlg({'exportData:',... -0532 'No data to save. Generate some data first.'},'NUCLEUSmod info:'); -0533 end -0534 else -0535 helpdlg({'exportData:',... -0536 'No data to save. Generate some data first.'},'NUCLEUSmod info:'); -0537 end -0538 -0539 end -0540 -0541 %% -0542 function amp = findApproxTlgmAmplitude(t,f,TLGM) -0543 index = find(abs(t-TLGM)==min(abs(t-TLGM))); -0544 amp = interp1(t(index-1:index+1),f(index-1:index+1),TLGM); -0545 end -0546 -0547 %------------- END OF CODE -------------- +0469 xlswrite(fullfile(PathName,FileName),header,'NMR_T1_drain','A1'); +0470 xlswrite(fullfile(PathName,FileName),out,'NMR_T1_drain','A2'); +0471 out = zeros(numel(results.NMR.t),numel(indd)+1); +0472 out(:,1) = results.NMR.t(:); +0473 header = cell(1,1); +0474 header{1} = 'time [s]'; +0475 for i = 1:numel(indd) +0476 out(:,i+1) = results.NMR.EdT2(indd(i),:)'; +0477 header{i+1} = ['S',num2str(i)]; +0478 end +0479 xlswrite(fullfile(PathName,FileName),header,'NMR_T2_drain','A1'); +0480 xlswrite(fullfile(PathName,FileName),out,'NMR_T2_drain','A2'); +0481 +0482 out = zeros(numel(results.NMR.t),numel(indi)+1); +0483 out(:,1) = results.NMR.t(:); +0484 header = cell(1,1); +0485 header{1} = 'time [s]'; +0486 for i = 1:numel(indi) +0487 out(:,i+1) = results.NMR.EiT1(indi(i),:)'; +0488 header{i+1} = ['S',num2str(i)]; +0489 end +0490 xlswrite(fullfile(PathName,FileName),header,'NMR_T1_imb','A1'); +0491 xlswrite(fullfile(PathName,FileName),out,'NMR_T1_imb','A2'); +0492 +0493 out = zeros(numel(results.NMR.t),numel(indi)+1); +0494 out(:,1) = results.NMR.t(:); +0495 header = cell(1,1); +0496 header{1} = 'time [s]'; +0497 for i = 1:numel(indi) +0498 out(:,i+1) = results.NMR.EiT2(indi(i),:)'; +0499 header{i+1} = ['S',num2str(i)]; +0500 end +0501 xlswrite(fullfile(PathName,FileName),header,'NMR_T2_imb','A1'); +0502 xlswrite(fullfile(PathName,FileName),out,'NMR_T2_imb','A2'); +0503 +0504 % remove the first standard excel sheet +0505 [~,sheets] = xlsfinfo(fullfile(PathName,FileName)); +0506 objExcel = actxserver('Excel.Application'); +0507 objExcel.Workbooks.Open(fullfile(PathName,FileName)); +0508 objExcel.ActiveWorkbook.Worksheets.Item(sheets{1}).Delete; +0509 objExcel.ActiveWorkbook.Save; +0510 objExcel.ActiveWorkbook.Close; +0511 objExcel.Quit; +0512 objExcel.delete; +0513 end +0514 +0515 %% +0516 function doexport = checkINV(INVdata,id) +0517 +0518 doexport = false; +0519 if ~isempty(INVdata) && ~isempty(id) +0520 if isstruct(INVdata{id}) +0521 doexport = true; +0522 else +0523 helpdlg({'exportData:','No inversion data to save'},... +0524 'Nothing to save'); +0525 end +0526 else +0527 helpdlg({'exportData:','No inversion data to save'},... +0528 'Nothing to save'); +0529 end +0530 +0531 end +0532 +0533 %% +0534 function doexport = checkMOD(data) +0535 +0536 doexport = false; +0537 if isfield(data,'results') +0538 if isfield(data.results,'NMR') +0539 doexport = true; +0540 else +0541 helpdlg({'exportData:',... +0542 'No data to save. Generate some data first.'},'NUCLEUSmod info:'); +0543 end +0544 else +0545 helpdlg({'exportData:',... +0546 'No data to save. Generate some data first.'},'NUCLEUSmod info:'); +0547 end 0548 -0549 %% License: -0550 % MIT License -0551 % -0552 % Copyright (c) 2018 Thomas Hiller -0553 % -0554 % Permission is hereby granted, free of charge, to any person obtaining a copy -0555 % of this software and associated documentation files (the "Software"), to deal -0556 % in the Software without restriction, including without limitation the rights -0557 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -0558 % copies of the Software, and to permit persons to whom the Software is -0559 % furnished to do so, subject to the following conditions: -0560 % -0561 % The above copyright notice and this permission notice shall be included in all -0562 % copies or substantial portions of the Software. +0549 end +0550 +0551 %% +0552 function amp = findApproxTlgmAmplitude(t,f,TLGM) +0553 index = find(abs(t-TLGM)==min(abs(t-TLGM))); +0554 amp = interp1(t(index-1:index+1),f(index-1:index+1),TLGM); +0555 end +0556 +0557 %------------- END OF CODE -------------- +0558 +0559 %% License: +0560 % MIT License +0561 % +0562 % Copyright (c) 2018 Thomas Hiller 0563 % -0564 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -0565 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -0566 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -0567 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -0568 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -0569 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -0570 % SOFTWARE. +0564 % Permission is hereby granted, free of charge, to any person obtaining a copy +0565 % of this software and associated documentation files (the "Software"), to deal +0566 % in the Software without restriction, including without limitation the rights +0567 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +0568 % copies of the Software, and to permit persons to whom the Software is +0569 % furnished to do so, subject to the following conditions: +0570 % +0571 % The above copyright notice and this permission notice shall be included in all +0572 % copies or substantial portions of the Software. +0573 % +0574 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +0575 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +0576 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +0577 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +0578 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +0579 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +0580 % SOFTWARE.
    Generated by m2html © 2005
    \ No newline at end of file diff --git a/doc/nucleus/functions/interface/exportINV.html b/doc/nucleus/functions/interface/exportINV.html index 6ca87bc..f8c7d40 100644 --- a/doc/nucleus/functions/interface/exportINV.html +++ b/doc/nucleus/functions/interface/exportINV.html @@ -156,76 +156,78 @@

    SOURCE CODE ^% proceed if there is data 0081 if ~isempty(INVdata) 0082 % display info text -0083 displayStatusText(gui,'Exporting GUI session to mat-file ...'); -0084 savedata.myui = gui.myui; -0085 savedata.data = data; -0086 savedata.INVdata = INVdata; -0087 savedata.id = get(gui.listbox_handles.signal,'Value'); -0088 -0089 -0090 if dosilent -0091 save(fullfile(sfile),'savedata'); -0092 clear savedata; -0093 else -0094 % session file name -0095 sfilename = 'NUCLEUSinv_session'; -0096 -0097 % ask for folder and maybe new name -0098 if isfield(data.import,'path') -0099 [sfile,spath] = uiputfile('*.mat',... -0100 'Save session file',... -0101 fullfile(data.import.path,[sfilename,'.mat'])); -0102 else -0103 [sfile,spath] = uiputfile('*.mat',... -0104 'Save session file',... -0105 fullfile(pwd,[sfilename,'.mat'])); -0106 end -0107 -0108 % if user didn't cancel save session -0109 if sum([sfile spath]) > 0 -0110 save(fullfile(spath,sfile),'savedata'); -0111 clear savedata; -0112 -0113 % display info text -0114 displayStatusText(gui,'Exporting GUI session to mat-file ... done'); -0115 else -0116 % display info text -0117 displayStatusText(gui,'Exporting GUI session to mat-file ... canceled'); -0118 end -0119 end -0120 else -0121 helpdlg({'function: exportINV',... -0122 'Cannot continue because no data is loaded!'},... -0123 'Load NMR data first.'); -0124 end -0125 end -0126 +0083 if ~dosilent +0084 displayStatusText(gui,'Exporting GUI session to mat-file ...'); +0085 end +0086 savedata.myui = gui.myui; +0087 savedata.data = data; +0088 savedata.INVdata = INVdata; +0089 savedata.id = get(gui.listbox_handles.signal,'Value'); +0090 +0091 +0092 if dosilent +0093 save(fullfile(sfile),'savedata'); +0094 clear savedata; +0095 else +0096 % session file name +0097 sfilename = 'NUCLEUSinv_session'; +0098 +0099 % ask for folder and maybe new name +0100 if isfield(data.import,'path') +0101 [sfile,spath] = uiputfile('*.mat',... +0102 'Save session file',... +0103 fullfile(data.import.path,[sfilename,'.mat'])); +0104 else +0105 [sfile,spath] = uiputfile('*.mat',... +0106 'Save session file',... +0107 fullfile(pwd,[sfilename,'.mat'])); +0108 end +0109 +0110 % if user didn't cancel save session +0111 if sum([sfile spath]) > 0 +0112 save(fullfile(spath,sfile),'savedata'); +0113 clear savedata; +0114 +0115 % display info text +0116 displayStatusText(gui,'Exporting GUI session to mat-file ... done'); +0117 else +0118 % display info text +0119 displayStatusText(gui,'Exporting GUI session to mat-file ... canceled'); +0120 end +0121 end +0122 else +0123 helpdlg({'function: exportINV',... +0124 'Cannot continue because no data is loaded!'},... +0125 'Load NMR data first.'); +0126 end 0127 end 0128 -0129 %------------- END OF CODE -------------- +0129 end 0130 -0131 %% License: -0132 % MIT License -0133 % -0134 % Copyright (c) 2018 Thomas Hiller +0131 %------------- END OF CODE -------------- +0132 +0133 %% License: +0134 % MIT License 0135 % -0136 % Permission is hereby granted, free of charge, to any person obtaining a copy -0137 % of this software and associated documentation files (the "Software"), to deal -0138 % in the Software without restriction, including without limitation the rights -0139 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -0140 % copies of the Software, and to permit persons to whom the Software is -0141 % furnished to do so, subject to the following conditions: -0142 % -0143 % The above copyright notice and this permission notice shall be included in all -0144 % copies or substantial portions of the Software. -0145 % -0146 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -0147 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -0148 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -0149 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -0150 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -0151 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -0152 % SOFTWARE. +0136 % Copyright (c) 2018 Thomas Hiller +0137 % +0138 % Permission is hereby granted, free of charge, to any person obtaining a copy +0139 % of this software and associated documentation files (the "Software"), to deal +0140 % in the Software without restriction, including without limitation the rights +0141 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +0142 % copies of the Software, and to permit persons to whom the Software is +0143 % furnished to do so, subject to the following conditions: +0144 % +0145 % The above copyright notice and this permission notice shall be included in all +0146 % copies or substantial portions of the Software. +0147 % +0148 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +0149 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +0150 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +0151 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +0152 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +0153 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +0154 % SOFTWARE.
    Generated by m2html © 2005
    \ No newline at end of file diff --git a/doc/nucleus/functions/interface/importMOD2INV.html b/doc/nucleus/functions/interface/importMOD2INV.html index 70f97ce..6140faf 100644 --- a/doc/nucleus/functions/interface/importMOD2INV.html +++ b/doc/nucleus/functions/interface/importMOD2INV.html @@ -254,109 +254,111 @@

    SOURCE CODE ^'D'; -0190 end -0191 -0192 % now we import imbibition NMR data -0193 for i = 1:numel(iL) -0194 % the individual file names -0195 c = c + 1; -0196 fnames(c).parfile = ''; -0197 fnames(c).datafile = data.import.file; -0198 fnames(c).T2specfile = ''; -0199 -0200 shownames{c} = ['NUCLEUSmod_',T1T2,'_imb_',num2str(i)]; -0201 -0202 % the 'header' data -0203 data.import.NMR.data{c}.datfile = fileID.name; -0204 data.import.NMR.data{c}.date = fileID.date; -0205 data.import.NMR.data{c}.datenum = fileID.datenum; -0206 data.import.NMR.data{c}.bytes = fileID.bytes; -0207 % the NMR data -0208 data.import.NMR.data{c}.flag = T1T2; -0209 data.import.NMR.data{c}.T1IRfac = T1IRfac; -0210 data.import.NMR.data{c}.time = data.import.NMRMOD.nmr.t(:); -0211 switch T1T2 -0212 case 'T1' -0213 data.import.NMR.data{c}.signal = data.import.NMRMOD.nmr.EiT1(iL(i),:)'; -0214 case 'T2' -0215 data.import.NMR.data{c}.signal = data.import.NMRMOD.nmr.EiT2(iL(i),:)'; -0216 end -0217 data.import.NMR.data{c}.raw.time = data.import.NMR.data{c}.time; -0218 data.import.NMR.data{c}.raw.signal = data.import.NMR.data{c}.signal; -0219 -0220 data.import.NMR.para{c}.geom = data.import.NMRMOD.geom.type; -0221 data.import.NMR.para{c}.Tbulk = data.import.NMRMOD.nmr.Tb; -0222 data.import.NMR.para{c}.rho = data.import.NMRMOD.nmr.rho; -0223 -0224 table{c,1} = true; -0225 table{c,2} = data.import.NMRMOD.p(iL(i)); -0226 table{c,3} = data.import.NMRMOD.Si(iL(i)); -0227 table{c,4} = 'I'; -0228 end -0229 -0230 data.import.NMR.files = fnames; -0231 data.import.NMR.filesShort = shownames; -0232 -0233 % import pressure / saturation data -0234 data.pressure.unit = data.import.NMRMOD.gui_pressure.unit; -0235 data.pressure.unitfac = data.import.NMRMOD.gui_pressure.unitfac; -0236 data.pressure.table = table; -0237 -0238 % update the list of file names -0239 set(gui.listbox_handles.signal,'String',data.import.NMR.filesShort); -0240 set(gui.listbox_handles.signal,'Value',[],'Max',2,'Min',0); -0241 -0242 % create a global INVdata struct for every file in the list -0243 if isstruct(getappdata(fig,'INVdata')) -0244 setappdata(fig,'INVdata',[]); -0245 end -0246 INVdata = cell(length(data.import.NMR.filesShort),1); -0247 setappdata(fig,'INVdata',INVdata); -0248 -0249 % clear all axes -0250 clearAllAxes(gui.figh); -0251 -0252 % enable GUI data and interface -0253 setappdata(fig,'data',data); -0254 setappdata(fig,'gui',gui); -0255 enableGUIelements('MOD'); -0256 NUCLEUSinv_updateInterface; -0257 else -0258 helpdlg({'importNUCLEUSmod:',... -0259 'NUCLEUSmod data import unsuccessful.'},'import error'); -0260 end -0261 +0185 data.import.NMR.para{c}.porosity = data.import.NMRMOD.nmr.porosity; +0186 +0187 table{c,1} = true; +0188 table{c,2} = data.import.NMRMOD.p(dL(i)); +0189 table{c,3} = data.import.NMRMOD.Sd(dL(i)); +0190 table{c,4} = 'D'; +0191 end +0192 +0193 % now we import imbibition NMR data +0194 for i = 1:numel(iL) +0195 % the individual file names +0196 c = c + 1; +0197 fnames(c).parfile = ''; +0198 fnames(c).datafile = data.import.file; +0199 fnames(c).T2specfile = ''; +0200 +0201 shownames{c} = ['NUCLEUSmod_',T1T2,'_imb_',num2str(i)]; +0202 +0203 % the 'header' data +0204 data.import.NMR.data{c}.datfile = fileID.name; +0205 data.import.NMR.data{c}.date = fileID.date; +0206 data.import.NMR.data{c}.datenum = fileID.datenum; +0207 data.import.NMR.data{c}.bytes = fileID.bytes; +0208 % the NMR data +0209 data.import.NMR.data{c}.flag = T1T2; +0210 data.import.NMR.data{c}.T1IRfac = T1IRfac; +0211 data.import.NMR.data{c}.time = data.import.NMRMOD.nmr.t(:); +0212 switch T1T2 +0213 case 'T1' +0214 data.import.NMR.data{c}.signal = data.import.NMRMOD.nmr.EiT1(iL(i),:)'; +0215 case 'T2' +0216 data.import.NMR.data{c}.signal = data.import.NMRMOD.nmr.EiT2(iL(i),:)'; +0217 end +0218 data.import.NMR.data{c}.raw.time = data.import.NMR.data{c}.time; +0219 data.import.NMR.data{c}.raw.signal = data.import.NMR.data{c}.signal; +0220 +0221 data.import.NMR.para{c}.geom = data.import.NMRMOD.geom.type; +0222 data.import.NMR.para{c}.Tbulk = data.import.NMRMOD.nmr.Tb; +0223 data.import.NMR.para{c}.rho = data.import.NMRMOD.nmr.rho; +0224 data.import.NMR.para{c}.porosity = data.import.NMRMOD.nmr.porosity; +0225 +0226 table{c,1} = true; +0227 table{c,2} = data.import.NMRMOD.p(iL(i)); +0228 table{c,3} = data.import.NMRMOD.Si(iL(i)); +0229 table{c,4} = 'I'; +0230 end +0231 +0232 data.import.NMR.files = fnames; +0233 data.import.NMR.filesShort = shownames; +0234 +0235 % import pressure / saturation data +0236 data.pressure.unit = data.import.NMRMOD.gui_pressure.unit; +0237 data.pressure.unitfac = data.import.NMRMOD.gui_pressure.unitfac; +0238 data.pressure.table = table; +0239 +0240 % update the list of file names +0241 set(gui.listbox_handles.signal,'String',data.import.NMR.filesShort); +0242 set(gui.listbox_handles.signal,'Value',[],'Max',2,'Min',0); +0243 +0244 % create a global INVdata struct for every file in the list +0245 if isstruct(getappdata(fig,'INVdata')) +0246 setappdata(fig,'INVdata',[]); +0247 end +0248 INVdata = cell(length(data.import.NMR.filesShort),1); +0249 setappdata(fig,'INVdata',INVdata); +0250 +0251 % clear all axes +0252 clearAllAxes(gui.figh); +0253 +0254 % enable GUI data and interface +0255 setappdata(fig,'data',data); +0256 setappdata(fig,'gui',gui); +0257 enableGUIelements('MOD'); +0258 NUCLEUSinv_updateInterface; +0259 else +0260 helpdlg({'importNUCLEUSmod:',... +0261 'NUCLEUSmod data import unsuccessful.'},'import error'); 0262 end 0263 -0264 %------------- END OF CODE -------------- +0264 end 0265 -0266 %% License: -0267 % MIT License -0268 % -0269 % Copyright (c) 2018 Thomas Hiller +0266 %------------- END OF CODE -------------- +0267 +0268 %% License: +0269 % MIT License 0270 % -0271 % Permission is hereby granted, free of charge, to any person obtaining a copy -0272 % of this software and associated documentation files (the "Software"), to deal -0273 % in the Software without restriction, including without limitation the rights -0274 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -0275 % copies of the Software, and to permit persons to whom the Software is -0276 % furnished to do so, subject to the following conditions: -0277 % -0278 % The above copyright notice and this permission notice shall be included in all -0279 % copies or substantial portions of the Software. -0280 % -0281 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -0282 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -0283 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -0284 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -0285 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -0286 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -0287 % SOFTWARE. +0271 % Copyright (c) 2018 Thomas Hiller +0272 % +0273 % Permission is hereby granted, free of charge, to any person obtaining a copy +0274 % of this software and associated documentation files (the "Software"), to deal +0275 % in the Software without restriction, including without limitation the rights +0276 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +0277 % copies of the Software, and to permit persons to whom the Software is +0278 % furnished to do so, subject to the following conditions: +0279 % +0280 % The above copyright notice and this permission notice shall be included in all +0281 % copies or substantial portions of the Software. +0282 % +0283 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +0284 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +0285 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +0286 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +0287 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +0288 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +0289 % SOFTWARE.
    Generated by m2html © 2005
    \ No newline at end of file diff --git a/doc/nucleus/functions/interface/menu.html b/doc/nucleus/functions/interface/menu.html index ffc6710..9edeaa5 100644 --- a/doc/nucleus/functions/interface/menu.html +++ b/doc/nucleus/functions/interface/menu.html @@ -18,7 +18,7 @@

    Index for nucleus\functions\interface

    Matlab files in this directory:

    +
  • beautifyAxes
  • calculateGeometry
  • calculateGuiOnMonitorPosition
  • calculateNMR
  • calibratePorosity
  • caluclatePressureSaturation
  • changeColorTheme
  • checkIfInversionExists
  • cleanupGUIData
  • clearAllAxes
  • clearInversion
  • clearSingleAxis
  • displayStatusText
  • enableGUIelements
  • exportData
  • exportGraphics
  • exportINV
  • findParentOfType
  • fixAxes
  • getColorIndex
  • getColorTheme
  • importASCIIdata
  • importCPSdata
  • importCalibrationData
  • importEXCELdata
  • importINV2INV
  • importMOD2INV
  • importMOD2MOD
  • importNMRdata
  • makeINIfile
  • minimizePanel
  • moveEntryInList
  • onFigureSizeChange
  • processNMRData
  • processNMRDataControl
  • readINIfile
  • removeCalculationFields
  • removeInversionFields
  • removeSignalFromList
  • resortDataList
  • runInversionBatch
  • runInversionJoint
  • runInversionStd
  • showExtraGraphics
  • showFitStatistics
  • showParameterInfo
  • switchToolTips
  • uncheckImportMenus
  • updateCPSTable
  • updateCPSTableSize
  • updateInfo
  • updateNMRsignals
  • updatePlotsCPS
  • updatePlotsDistribution
  • updatePlotsDistributionInfo
  • updatePlotsGeometryType
  • updatePlotsIterChi
  • updatePlotsJointInversion
  • updatePlotsLcurve
  • updatePlotsNMR
  • updatePlotsPSD
  • updatePlotsSignal
  • updateStatusInformation
  • useSignalAsCalibration
  • Other Matlab-specific files in this directory:

    +
  • updateNMRsignals adds noise to the forward NMR signals and scales the
  • SOURCE CODE ^

    -
    0001 function [signalN,noise] = addNoiseToNMR(signal,mu,sigma)
    -0002 %addNoiseToNMR adds noise with mean 'mu' and standard deviation 'sigma' to
    +
    0001 function [signalN,noise] = addNoiseToSignal(signal,mu,sigma)
    +0002 %addNoiseToSignal adds noise with mean 'mu' and standard deviation 'sigma' to
     0003 %a synthetic NMR signal
     0004 %
     0005 % Syntax:
    -0006 %       addNoiseToNMR(time,signal,varargin)
    +0006 %       addNoiseToSignal(time,signal,varargin)
     0007 %
     0008 % Inputs:
     0009 %       signal - vector or matrix containing the NMR data
    @@ -88,7 +88,7 @@ 

    SOURCE CODE ^% noise - noise vector/matrix 0016 % 0017 % Example: -0018 % [sN,e] = applyGatesToSignal(time,signal,'type','log') +0018 % [sN,noise] = addNoiseToSignal(signal,0,0.01) 0019 % 0020 % Other m-files required: 0021 % none diff --git a/doc/nucleus/functions/modeling/menu.html b/doc/nucleus/functions/modeling/menu.html index 53ebcf0..e4e4a95 100644 --- a/doc/nucleus/functions/modeling/menu.html +++ b/doc/nucleus/functions/modeling/menu.html @@ -18,7 +18,7 @@

    Index for nucleus\functions\modeling

    Matlab files in this directory:

    +
  • addNoiseToSignal
  • createPSD
  • getAngularityFactor
  • getConstants
  • getCornerNMRparameter
  • getCornerSaturation
  • getCriticalPressure
  • getGeometryParameter
  • getNMRSignal
  • getNMRTimeVector
  • getPartialSaturationMatrix
  • getPointCoordinates
  • getPressureRangeFromPSD
  • getSaturationFromPressure
  • getSaturationFromPressureBatch
  • getSaturationLevelData
  • getShapeFactor
  • diff --git a/functions/interface/calculateNMR.m b/functions/interface/calculateNMR.m index 616f214..b139c58 100644 --- a/functions/interface/calculateNMR.m +++ b/functions/interface/calculateNMR.m @@ -16,9 +16,9 @@ % % Other m-files required: % displayStatusText -% calculateNMRnoise % getNMRTimeVector % getNMRSignal +% updateNMRsignals % updatePlotsNMR % % Subfunctions: @@ -65,7 +65,7 @@ setappdata(fig,'data',data); % add noise to the NMR signals - calculateNMRnoise; + updateNMRsignals; displayStatusText(gui,'Calculating NMR signals ... done'); updatePlotsNMR; % enable the RUN button again diff --git a/functions/interface/calculateNMRporosity.m b/functions/interface/calculateNMRporosity.m deleted file mode 100644 index 269ce2d..0000000 --- a/functions/interface/calculateNMRporosity.m +++ /dev/null @@ -1,81 +0,0 @@ -function calculateNMRporosity -%calculateNMRporosity rescales the NMR signals from saturation (0,1) to -%water content by multiplying with the given porosity value -% -% Syntax: -% calculateNMRporosity -% -% Inputs: -% none -% -% Outputs: -% none -% -% Example: -% calculateNMRporosity -% -% Other m-files required: -% none -% -% Subfunctions: -% none -% -% MAT-files required: -% none -% -% See also: NUCLEUSmod -% Author: Thomas Hiller -% email: thomas.hiller[at]leibniz-liag.de -% License: MIT License (at end) - -%------------- BEGIN CODE -------------- - -%% get GUI handle and data -fig = findobj('Tag','MOD'); -data = getappdata(fig,'data'); - -%% only proceed if the porosity is smaller than 1 -if data.nmr.porosity < 1 - data.results.NMR.EiT1 = data.nmr.porosity.*data.results.NMR.raw.EiT1; - data.results.NMR.EdT1 = data.nmr.porosity.*data.results.NMR.raw.EdT1; - data.results.NMR.EiT2 = data.nmr.porosity.*data.results.NMR.raw.EiT2; - data.results.NMR.EdT2 = data.nmr.porosity.*data.results.NMR.raw.EdT2; -else - % reset the NMR signals with the raw data (without noise) - data.results.NMR.EiT1 = data.results.NMR.raw.EiT1; - data.results.NMR.EdT1 = data.results.NMR.raw.EdT1; - data.results.NMR.EiT2 = data.results.NMR.raw.EiT2; - data.results.NMR.EdT2 = data.results.NMR.raw.EdT2; -end - -% save the porosity value -data.results.NMR.porosity = data.nmr.porosity; -% update the GUI data -setappdata(fig,'data',data); - -end - -%------------- END OF CODE -------------- - -%% License: -% MIT License -% -% Copyright (c) 2018 Thomas Hiller -% -% Permission is hereby granted, free of charge, to any person obtaining a copy -% of this software and associated documentation files (the "Software"), to deal -% in the Software without restriction, including without limitation the rights -% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -% copies of the Software, and to permit persons to whom the Software is -% furnished to do so, subject to the following conditions: -% -% The above copyright notice and this permission notice shall be included in all -% copies or substantial portions of the Software. -% -% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -% SOFTWARE. \ No newline at end of file diff --git a/functions/interface/exportData.m b/functions/interface/exportData.m index a2910b4..d569bd7 100644 --- a/functions/interface/exportData.m +++ b/functions/interface/exportData.m @@ -139,7 +139,10 @@ function exportData(fig_tag,format) case 'LIAG' - if isfield(data.import,'LIAG') + if isfield(data.import,'LIAG') + % display info text + displayStatusText(gui,... + 'Exporting LIAG archive data ...'); % find id of sample id = 1; spath = data.import.LIAG.workpaths{id}; @@ -155,11 +158,11 @@ function exportData(fig_tag,format) % png graphics pngname = fullfile(spath,[sfilename,'.png']); - [f,ax]=exportGraphics('INV','fig'); + [f,ax] = exportGraphics('INV','fig'); figure(f); por = INVdata{id}.invstd.porosity; - tname = [sfilename(5:end),' (porosity: ',... + tname = [sfilename(5:end),' (water content: ',... sprintf('%2.1f',por*100),' vol. %)']; set(get(ax(1),'Title'),'String',tname,'Interpreter','none'); @@ -167,7 +170,7 @@ function exportData(fig_tag,format) TLGM = INVdata{id}.results.invstd.Tlgm; T = INVdata{id}.results.invstd.T1T2me; F = INVdata{id}.results.invstd.T1T2f; - F = por.*F./sum(F); + F = 100.*por.*F./sum(F); amp = findApproxTlgmAmplitude(T,F,TLGM); stem(TLGM,amp,... 'x-','Color',[0.3 0.3 0.3],'LineWidth',2,... @@ -208,6 +211,10 @@ function exportData(fig_tag,format) print(f,pngname,'-r300','-dpng'); close(f); + % display info text + displayStatusText(gui,... + 'Exporting LIAG archive data ... done'); + else helpdlg({'function: exportData',... 'This routine works only on LIAG specific project data.'},... @@ -400,9 +407,12 @@ function exportINV_CSV(INVdata,sfile) % relaxation times switch INVdata.invstd.invtype case {'ILA','NNLS'} + por = INVdata.invstd.porosity; + F = INVdata.results.invstd.T1T2f(:); + F = 100*por.*F./sum(F); tmp4 = [INVdata.results.invstd.T1T2me(:)... - INVdata.results.invstd.T1T2f(:)]; - header4 = {['relaxation times [',unit,']'],'frequency [-]'}; + INVdata.results.invstd.T1T2f(:) F]; + header4 = {['relaxation times [',unit,']'],'frequency [-]',' water content [vol. %]'}; otherwise % Nothing to do diff --git a/functions/interface/exportINV.m b/functions/interface/exportINV.m index 867b42b..7568505 100644 --- a/functions/interface/exportINV.m +++ b/functions/interface/exportINV.m @@ -80,7 +80,9 @@ function exportINV(format,varargin) % proceed if there is data if ~isempty(INVdata) % display info text - displayStatusText(gui,'Exporting GUI session to mat-file ...'); + if ~dosilent + displayStatusText(gui,'Exporting GUI session to mat-file ...'); + end savedata.myui = gui.myui; savedata.data = data; savedata.INVdata = INVdata; diff --git a/functions/interface/importMOD2INV.m b/functions/interface/importMOD2INV.m index b38b109..3f2f764 100644 --- a/functions/interface/importMOD2INV.m +++ b/functions/interface/importMOD2INV.m @@ -182,6 +182,7 @@ function importMOD2INV(src) data.import.NMR.para{c}.geom = data.import.NMRMOD.geom.type; data.import.NMR.para{c}.Tbulk = data.import.NMRMOD.nmr.Tb; data.import.NMR.para{c}.rho = data.import.NMRMOD.nmr.rho; + data.import.NMR.para{c}.porosity = data.import.NMRMOD.nmr.porosity; table{c,1} = true; table{c,2} = data.import.NMRMOD.p(dL(i)); @@ -220,6 +221,7 @@ function importMOD2INV(src) data.import.NMR.para{c}.geom = data.import.NMRMOD.geom.type; data.import.NMR.para{c}.Tbulk = data.import.NMRMOD.nmr.Tb; data.import.NMR.para{c}.rho = data.import.NMRMOD.nmr.rho; + data.import.NMR.para{c}.porosity = data.import.NMRMOD.nmr.porosity; table{c,1} = true; table{c,2} = data.import.NMRMOD.p(iL(i)); diff --git a/functions/interface/runInversionJoint.m b/functions/interface/runInversionJoint.m index 3c0c784..ac6fa89 100644 --- a/functions/interface/runInversionJoint.m +++ b/functions/interface/runInversionJoint.m @@ -126,11 +126,11 @@ idata.nmr{levels(i)}.t = INVdata{levels(i)}.results.nmrproc.t; idata.nmr{levels(i)}.g = S(i).*... (INVdata{levels(i)}.results.nmrproc.s./E0(levels(i))); - idata.nmr{levels(i)}.e = INVdata{levels(i)}.results.nmrproc.noise./... - sqrt(INVdata{levels(i)}.results.nmrproc.N); idata.nmr{levels(i)}.N = INVdata{levels(i)}.results.nmrproc.N; idata.nmr{levels(i)}.noise = S(i).*... (INVdata{levels(i)}.results.nmrproc.noise./E0(levels(i))); + idata.nmr{levels(i)}.e = idata.nmr{levels(i)}.noise./... + sqrt(idata.nmr{levels(i)}.N); % switch depending on inversion method switch data.invjoint.invtype diff --git a/functions/interface/updateInfo.m b/functions/interface/updateInfo.m index a3db092..10211e5 100644 --- a/functions/interface/updateInfo.m +++ b/functions/interface/updateInfo.m @@ -335,11 +335,11 @@ function updateInfo(src,~) %#ok BVI = abs(sum(invstd.T1T2f(invstd.T1T2me>ccut & invstd.T1T2me<=tcut))/sum(invstd.T1T2f)); BVM = abs(sum(invstd.T1T2f(invstd.T1T2me>tcut))/sum(invstd.T1T2f)); info{end+1,1} = ['CBW(',sprintf('%2d',data.param.CBWcutoff),... - ') = ',sprintf('%5.2f',por*CBW*100),' [Vol. %]']; + ') = ',sprintf('%5.2f',por*CBW*100),' [vol. %]']; info{end+1,1} = ['BVI(',sprintf('%2d',data.param.BVIcutoff),... - ') = ',sprintf('%5.2f',por*BVI*100),' [Vol. %]']; - info{end+1,1} = ['BVM = ',sprintf('%5.2f',por*BVM*100),' [Vol. %]']; + ') = ',sprintf('%5.2f',por*BVI*100),' [vol. %]']; + info{end+1,1} = ['BVM = ',sprintf('%5.2f',por*BVM*100),' [vol. %]']; end end diff --git a/functions/interface/calculateNMRnoise.m b/functions/interface/updateNMRsignals.m similarity index 65% rename from functions/interface/calculateNMRnoise.m rename to functions/interface/updateNMRsignals.m index 25997d0..e44dccb 100644 --- a/functions/interface/calculateNMRnoise.m +++ b/functions/interface/updateNMRsignals.m @@ -1,8 +1,9 @@ -function calculateNMRnoise -%calculateNMRnoise calculates the noise for the forward NMR signals +function updateNMRsignals +%updateNMRsignals adds noise to the forward NMR signals and scales the +%signals by porosity (if any) % % Syntax: -% calculateNMRnoise +% updateNMRsignals % % Inputs: % none @@ -11,10 +12,10 @@ % none % % Example: -% calculateNMRnoise +% updateNMRsignals % % Other m-files required: -% addNoiseToNMR +% addNoiseToSignal % % Subfunctions: % none @@ -35,12 +36,13 @@ %% only proceed if the noise is larger than 0 if data.nmr.noise > 0 - % because noise is given in percentage inside the GUI convert to a value - % between [0,1] - [data.results.NMR.EiT1,~] = addNoiseToNMR(data.results.NMR.raw.EiT1,0,data.nmr.noise/100); - [data.results.NMR.EdT1,~] = addNoiseToNMR(data.results.NMR.raw.EdT1,0,data.nmr.noise/100); - [data.results.NMR.EiT2,~] = addNoiseToNMR(data.results.NMR.raw.EiT2,0,data.nmr.noise/100); - [data.results.NMR.EdT2,~] = addNoiseToNMR(data.results.NMR.raw.EdT2,0,data.nmr.noise/100); + % scale noise by porosity + noise = data.nmr.noise/data.nmr.porosity; + % add noise to NMR signals + [data.results.NMR.EiT1,~] = addNoiseToSignal(data.results.NMR.raw.EiT1,0,noise); + [data.results.NMR.EdT1,~] = addNoiseToSignal(data.results.NMR.raw.EdT1,0,noise); + [data.results.NMR.EiT2,~] = addNoiseToSignal(data.results.NMR.raw.EiT2,0,noise); + [data.results.NMR.EdT2,~] = addNoiseToSignal(data.results.NMR.raw.EdT2,0,noise); else % reset the NMR signals with the raw data (without noise) data.results.NMR.EiT1 = data.results.NMR.raw.EiT1; @@ -49,8 +51,16 @@ data.results.NMR.EdT2 = data.results.NMR.raw.EdT2; end +% scale NMR signals by porosity +data.results.NMR.EiT1 = data.nmr.porosity.*data.results.NMR.EiT1; +data.results.NMR.EdT1 = data.nmr.porosity.*data.results.NMR.EdT1; +data.results.NMR.EiT2 = data.nmr.porosity.*data.results.NMR.EiT2; +data.results.NMR.EdT2 = data.nmr.porosity.*data.results.NMR.EdT2; + % save the noise value -data.results.NMR.noise = data.nmr.noise/100; +data.results.NMR.noise = data.nmr.noise; +% save the porosity value +data.results.NMR.porosity = data.nmr.porosity; % update the GUI data setappdata(fig,'data',data); diff --git a/functions/interface/updatePlotsDistribution.m b/functions/interface/updatePlotsDistribution.m index 27ebef2..b01ad39 100644 --- a/functions/interface/updatePlotsDistribution.m +++ b/functions/interface/updatePlotsDistribution.m @@ -106,7 +106,7 @@ % scale distribution by porosity F = invstd.T1T2f; if sum(F)>0 - F = data.invstd.porosity.*F./sum(F); + F = (data.invstd.porosity*100).*F./sum(F); ylims = [0 max(F)*1.05]; else ylims = [-1 1]; @@ -125,7 +125,7 @@ % y-limits set(ax,'YScale','lin','YLim',ylims); % y-label - set(get(ax,'YLabel'),'String','frequency [-]'); + set(get(ax,'YLabel'),'String','water content [vol. %]'); case 'cum' plot(invstd.T1T2me,cumsum(F),'o-','Color',col.FIT,... @@ -138,8 +138,7 @@ % y-limits set(ax,'YScale','lin','YLim',[0 sum(F)*1.05]); % y-label - set(get(ax,'YLabel'),'String','cumulative [-]'); - + set(get(ax,'YLabel'),'String','cumulative water content [vol. %]'); end % x-limits @@ -221,14 +220,6 @@ requiv = invstd.T1T2me.*rho.*a; Rlgm = invstd.Tlgm.*rho.*a; - F = invstd.T1T2f; - if sum(F)>0 - F = F./sum(F); - ylims = [0 max(F)*1.05]; - else - ylims = [-1 1]; - end - switch data.info.PSDflag case 'freq' plot(requiv,F,'o-','Color',col.FIT,... @@ -240,7 +231,7 @@ % y-limits set(ax,'YScale','lin','YLim',ylims); % y-label - set(get(ax,'YLabel'),'String','frequency [-]'); + set(get(ax,'YLabel'),'String','water content [vol. %]'); case 'cum' plot(requiv,cumsum(F),'o-','Color',col.FIT,... @@ -250,9 +241,9 @@ stem(Rlgm,amp,'x-','Color',[0.3 0.3 0.3],'LineWidth',2,'Tag','TLGM','Parent',ax); % y-limits - set(ax,'YScale','lin','YLim',[0 sum(invstd.T1T2f)*1.05]); + set(ax,'YScale','lin','YLim',[0 sum(F)*1.05]); % y-label - set(get(ax,'YLabel'),'String','cumulative [-]'); + set(get(ax,'YLabel'),'String','cumulative water content [vol. %]'); end % x-limits diff --git a/functions/interface/updatePlotsJointInversion.m b/functions/interface/updatePlotsJointInversion.m index d9aed7e..d6ef035 100644 --- a/functions/interface/updatePlotsJointInversion.m +++ b/functions/interface/updatePlotsJointInversion.m @@ -217,19 +217,31 @@ xlstring = 'equiv. pore size [mm]'; end + % inverted PSD amplitudes + F = invjoint.iF; + switch data.info.PSDJflag - case 'freq' - % data - iF = invjoint.iF./trapz(iGEOM.radius,invjoint.iF); - plot(iGEOM.radius,iF,'o-','Color',col.FIT,'LineWidth',2,'Parent',ax); - ylim = max(iF); + case 'freq' + F = (data.invstd.porosity*100).*F./sum(F); + maxF1 = max(F); + if isfield(data.import,'NMRMOD') + F = F./trapz(iGEOM.radius,F); + maxF2 = max(F); + fac1 = (maxF1/maxF2); + else + fac1 = 1; + end + plot(iGEOM.radius,F.*fac1,'o-','Color',col.FIT,'LineWidth',2,'Parent',ax); + ylim = max(F.*fac1); if isfield(data.import,'NMRMOD') modr = data.import.NMRMOD.psddata.r; modf = data.import.NMRMOD.psddata.psd; + modf = (data.invstd.porosity*100).*modf./sum(modf); modf = modf./trapz(modr,modf); - plot(modr,modf,'k--','LineWidth',1,'Parent',ax); - ylim = max([ylim max(modf)]); + fac2 = ylim/maxF2; + plot(modr,modf.*fac2,'k--','LineWidth',1,'Parent',ax); + ylim = max([ylim max(modf.*fac2)]); lgdstr = {'fit','model'}; else lgdstr = {'fit'}; @@ -238,19 +250,21 @@ % y-limits set(ax,'YScale','lin','YLim',[0 ylim*1.05]); % y-label - set(get(ax,'YLabel'),'String','frequency [-]'); + if isfield(data.import,'NMRMOD') + set(get(ax,'YLabel'),'String','water content [vol. %]'); + else + set(get(ax,'YLabel'),'String','water content [vol. %]'); + end - - case 'cum' - % data - iF = invjoint.iF;%./trapz(iGEOM.radius,invjoint.iF); - plot(iGEOM.radius,cumsum(iF),'o-','Color',col.FIT,'LineWidth',2,'Parent',ax); - ylim = sum(iF); + case 'cum' + F = (data.invstd.porosity*100).*F./sum(F); + plot(iGEOM.radius,cumsum(F),'o-','Color',col.FIT,'LineWidth',2,'Parent',ax); + ylim = sum(F); if isfield(data.import,'NMRMOD') modr = data.import.NMRMOD.psddata.r; modf = data.import.NMRMOD.psddata.psd; -% modf = modf./trapz(modr,modf); + modf = (data.invstd.porosity*100).*modf./sum(modf); plot(modr,cumsum(modf),'k--','LineWidth',1,'Parent',ax); ylim = max([ylim sum(modf)]); lgdstr = {'fit','model'}; @@ -261,7 +275,7 @@ % y-limits set(ax,'YScale','lin','YLim',[0 ylim*1.05]); % y-label - set(get(ax,'YLabel'),'String','cumulative [-]'); + set(get(ax,'YLabel'),'String','cumulative water content [vol. %]'); end % x-limits @@ -289,7 +303,7 @@ xlstring = ['pressure [',data.pressure.unit,']']; if data.invstd.porosity < 1 - WRCfac = data.invstd.porosity; + WRCfac = data.invstd.porosity*100; else WRCfac = 1; end @@ -329,14 +343,14 @@ set(ax,'XLim',[plotpress(1) plotpress(end)],'XTick',10.^xticks); % y-limits if data.invstd.porosity < 1 - set(ax,'YLim',[-0.1 data.invstd.porosity.*1.1],'YTickMode','auto'); + set(ax,'YLim',[-WRCfac/10 WRCfac.*1.1],'YTickMode','auto'); else set(ax,'YLim',[-0.1 1.1],'YTick',linspace(0,1,5)); end % labels set(get(ax,'XLabel'),'String',xlstring); if data.invstd.porosity < 1 - set(get(ax,'YLabel'),'String','water content [-]'); + set(get(ax,'YLabel'),'String','water content [vol. %]'); else set(get(ax,'YLabel'),'String','saturation [-]'); end diff --git a/functions/modeling/addNoiseToNMR.m b/functions/modeling/addNoiseToSignal.m similarity index 88% rename from functions/modeling/addNoiseToNMR.m rename to functions/modeling/addNoiseToSignal.m index 4e731cd..6c7c265 100644 --- a/functions/modeling/addNoiseToNMR.m +++ b/functions/modeling/addNoiseToSignal.m @@ -1,9 +1,9 @@ -function [signalN,noise] = addNoiseToNMR(signal,mu,sigma) -%addNoiseToNMR adds noise with mean 'mu' and standard deviation 'sigma' to +function [signalN,noise] = addNoiseToSignal(signal,mu,sigma) +%addNoiseToSignal adds noise with mean 'mu' and standard deviation 'sigma' to %a synthetic NMR signal % % Syntax: -% addNoiseToNMR(time,signal,varargin) +% addNoiseToSignal(time,signal,varargin) % % Inputs: % signal - vector or matrix containing the NMR data @@ -15,7 +15,7 @@ % noise - noise vector/matrix % % Example: -% [sN,e] = applyGatesToSignal(time,signal,'type','log') +% [sN,noise] = addNoiseToSignal(signal,0,0.01) % % Other m-files required: % none