Skip to content

Commit

Permalink
see CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
ThoHiller committed May 22, 2020
1 parent 1026318 commit 4e156b4
Show file tree
Hide file tree
Showing 31 changed files with 1,333 additions and 707 deletions.
4 changes: 2 additions & 2 deletions BLOCHUS/BLOCHUS.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
%------------- BEGIN CODE --------------

%% GUI 'header' info and default GUI settings
myui.version = '0.1.2';
myui.date = '17.05.2020';
myui.version = '0.1.3';
myui.date = '22.05.2020';
myui.author = 'Thomas Hiller';
myui.email = 'thomas.hiller[at]leibniz-liag.de';

Expand Down
6 changes: 3 additions & 3 deletions BLOCHUS/BLOCHUS_createGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ function BLOCHUS_createGUI(h,wbon)
set(gui.main,'Visible','on');

%% enable all menus
set(gui.menu.file,'Enable','on');
set(gui.menu.view,'Enable','on');
set(gui.menu.help,'Enable','on');
set(gui.menu_handles.file,'Enable','on');
set(gui.menu_handles.view,'Enable','on');
set(gui.menu_handles.help,'Enable','on');

%% update the GUI data
gui.myui = myui;
Expand Down
88 changes: 50 additions & 38 deletions BLOCHUS/BLOCHUS_createMenus.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,65 +30,77 @@
%------------- BEGIN CODE --------------

%% 1. File
gui.menu.file = uimenu(gui.figh,...
'Label','File','Enable','off');
gui.menu_handles.file = uimenu(gui.figh,...
'Label','File',...
'Enable','off');

% 1.1 Import
gui.menu.file_import = uimenu(gui.menu.file,...
'Label','Import','Enable','on');

% 1.1.1 BLOCHUS session file
gui.menu.file_import_session = uimenu(gui.menu.file_import,...
'Label','Session file','Callback',@onMenuImport);
gui.menu_handles.file_import = uimenu(gui.menu_handles.file,...
'Label','Import Data',...
'Callback',@onMenuImport);

% 1.2 Export
gui.menu.file_export = uimenu(gui.menu.file,...
'Label','Export');

% 1.2.1 BLOCHUS session file
gui.menu.file_export_session = uimenu(gui.menu.file_export,...
'Label','Session file','Callback',@onMenuExport);
gui.menu_handles.file_export = uimenu(gui.menu_handles.file,...
'Label','Export Data',...
'Callback',@onMenuExport);

% 1.3 Restart
gui.menu.file_restart = uimenu(gui.menu.file,...
'Label','Restart','Separator','on','Callback',@onMenuRestartQuit);
gui.menu_handles.file_restart = uimenu(gui.menu_handles.file,...
'Label','Restart',...
'Separator','on',...
'Callback',@onMenuRestartQuit);

% 1.4 Quit
gui.menu.file_quit = uimenu(gui.menu.file,...
'Label','Quit','Separator','on','Callback',@onMenuRestartQuit);
gui.menu_handles.file_quit = uimenu(gui.menu_handles.file,...
'Label','Quit',...
'Callback',@onMenuRestartQuit);

%% 2. Extras
gui.menu.view = uimenu(gui.figh,...
'Label','View','Enable','off');
gui.menu_handles.view = uimenu(gui.figh,...
'Label','View',...
'Enable','off');

% 2.1 Tooltips (on/off)
gui.menu.view_tooltips = uimenu(gui.menu.view,...
'Label','Tooltips','Checked','on','Callback',@onMenuViewShow);
gui.menu_handles.view_tooltips = uimenu(gui.menu_handles.view,...
'Label','Tooltips',...
'Checked','on',...
'Callback',@onMenuView);

% 2.2 Figure Toolbar
gui.menu.view_toolbar = uimenu(gui.menu.view,...
'Label','Figure Toolbar','Callback',@onMenuViewShow);
% 2.3.1 Tigures
gui.menu.view_figures = uimenu(gui.menu.view,...
gui.menu_handles.view_toolbar = uimenu(gui.menu_handles.view,...
'Label','Figure Toolbar',...
'Callback',@onMenuView);
% 2.3.1 Figures
gui.menu_handles.view_figures = uimenu(gui.menu_handles.view,...
'Label','Figures','Separator','on');
% 2.3.1.1 current
gui.menu.view_figures_current = uimenu(gui.menu.view_figures,...
'Label','Current View','Callback',@onMenuViewFigure);
gui.menu_handles.view_figures_current = uimenu(gui.menu_handles.view_figures,...
'Label','Current View',...
'Callback',@onMenuViewFigure);
% 2.3.1.2 only magnetization
gui.menu.view_figures_mag = uimenu(gui.menu.view_figures,...
'Label','Magnetization','Callback',@onMenuViewFigure);
gui.menu_handles.view_figures_mag = uimenu(gui.menu_handles.view_figures,...
'Label','Magnetization',...
'Callback',@onMenuViewFigure);
% 2.3.1.3 only ramp
gui.menu.view_figures_ramp = uimenu(gui.menu.view_figures,...
'Label','Switch-off Ramp','Enable','off','Callback',@onMenuViewFigure);
gui.menu_handles.view_figures_ramp = uimenu(gui.menu_handles.view_figures,...
'Label','Switch-off Ramp',...
'Enable','off',...
'Callback',@onMenuViewFigure);
% 2.3.1.4 only pulse
gui.menu.view_figures_pulse = uimenu(gui.menu.view_figures,...
'Label','Pulse','Enable','off','Callback',@onMenuViewFigure);
gui.menu_handles.view_figures_pulse = uimenu(gui.menu_handles.view_figures,...
'Label','Pulse',...
'Enable','off',...
'Callback',@onMenuViewFigure);

%% 3. Help
gui.menu.help = uimenu(gui.figh,...
'Label','Help','Enable','off');
gui.menu_handles.help = uimenu(gui.figh,...
'Label','Help',...
'Enable','off');

% 3.1 About
gui.menu.help_about = uimenu(gui.menu.help,...
'Label','About','Callback',@onMenuHelp);
gui.menu_handles.help_about = uimenu(gui.menu_handles.help,...
'Label','About',...
'Callback',@onMenuHelp);

return

Expand Down
2 changes: 2 additions & 0 deletions BLOCHUS/BLOCHUS_createPanelPulse.m
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@
jh.setVerticalAlignment(javax.swing.JLabel.CENTER)
jh = findjobj(gui.text_handles.PulseAxis);
jh.setVerticalAlignment(javax.swing.JLabel.CENTER)
jh = findjobj(gui.text_handles.PulsePolarization);
jh.setVerticalAlignment(javax.swing.JLabel.CENTER)
jh = findjobj(gui.text_handles.PulseB1Factor);
jh.setVerticalAlignment(javax.swing.JLabel.CENTER)
jh = findjobj(gui.text_handles.PulseTtau);
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.1.3] - 2020-05-22

### Added
- Two additional examples that demonstrate the creation of lookup tables (one example for pre-polarization switch-off ramps and one example for adiabatic excitation pulses).

### Changed
- Minor GUI improvements and consistency clean ups.

## [0.1.2] - 2020-05-17

### Changed
Expand All @@ -24,6 +32,7 @@

Initial Version

[0.1.3]: https://github.com/ThoHiller/nmr-blochus/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/ThoHiller/nmr-blochus/compare/v.0.1.1...v0.1.2
[0.1.1]: https://github.com/ThoHiller/nmr-blochus/compare/v.0.1.0...v.0.1.1
[0.1.0]: https://github.com/ThoHiller/nmr-blochus/releases/tag/v.0.1.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ In no particular order and without guarantee that it will ever happen :-) :
### Cite as
If you use BLOCHUS for your research, please cite it as:

Thomas Hiller. (2020, May 17). ThoHiller/nmr-blochus: v0.1.2 (Version v0.1.2). Zenodo. [https://doi.org/10.5281/zenodo.3829464]
Thomas Hiller. (2020, May 22). ThoHiller/nmr-blochus: v0.1.3 (Version v0.1.3). Zenodo. [https://doi.org/10.5281/zenodo.3829464]

Note: Even though the version number might change due to updates, this DOI is permanent (represents all versions) and always links to the latest version.


### References

1. Hiller, T., Dlugosch, R. and Müller-Petke, M., "Utilizing pre-polarization to enhance SNMR signals - effect of imperfect switch-off", Geophysical Journal International **0**(0), p.1-15, 2020, [DOI](https://doi.org/10.1093/gji/ggaa216)
1. Hiller, T., Dlugosch, R. and Müller-Petke, M., "Utilizing pre-polarization to enhance SNMR signals - effect of imperfect switch-off", Geophysical Journal International **222**(2), p.815-826, 2020, [DOI](https://doi.org/10.1093/gji/ggaa216)

- - -
<p style="text-align: center;"> MATLAB is a registered trademark of The Mathworks, Inc. </p>
16 changes: 8 additions & 8 deletions callbacks/checkbox/onCheckPrePolPulse.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function onCheckPrePolPulse(src,~)
data.basic.type = 'std';

% menu settings
set(gui.menu.view_figures_ramp,'Enable','off');
set(gui.menu.view_figures_pulse,'Enable','off');
set(gui.menu_handles.view_figures_ramp,'Enable','off');
set(gui.menu_handles.view_figures_pulse,'Enable','off');

% std settings
data.basic.Minit = [1 0 0];
Expand Down Expand Up @@ -111,8 +111,8 @@ function onCheckPrePolPulse(src,~)
data.basic.type = 'prepol';

% menu settings
set(gui.menu.view_figures_ramp,'Enable','on');
set(gui.menu.view_figures_pulse,'Enable','off');
set(gui.menu_handles.view_figures_ramp,'Enable','on');
set(gui.menu_handles.view_figures_pulse,'Enable','off');

% std settings
data.basic.Tsim = data.prepol.Tramp;
Expand Down Expand Up @@ -173,8 +173,8 @@ function onCheckPrePolPulse(src,~)
data.basic.type = 'pulse';

% menu settings
set(gui.menu.view_figures_ramp,'Enable','off');
set(gui.menu.view_figures_pulse,'Enable','on');
set(gui.menu_handles.view_figures_ramp,'Enable','off');
set(gui.menu_handles.view_figures_pulse,'Enable','on');

% std settings
data.basic.Tsim = data.pulse.Ttau;
Expand Down Expand Up @@ -223,8 +223,8 @@ function onCheckPrePolPulse(src,~)
data.basic.type = 'prepolpulse';

% menu settings
set(gui.menu.view_figures_ramp,'Enable','on');
set(gui.menu.view_figures_pulse,'Enable','on');
set(gui.menu_handles.view_figures_ramp,'Enable','on');
set(gui.menu_handles.view_figures_pulse,'Enable','on');

% std settings
data.basic.Minit = [1 0 0];
Expand Down
5 changes: 4 additions & 1 deletion callbacks/menus/onMenuHelp.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function onMenuHelp(src,~)
% create Figure
hf = figure('Name','About BLOCHUS',...
'NumberTitle','off','Tag','Help','ToolBar','none','MenuBar','none',...
'Resize','off','Position',[xp yp ww hh]);
'Resize','off','Position',[xp yp ww hh],'Visible','off');
v1 = uix.VBox('Parent',hf,'Padding',10,'Spacing',10);

% text area
Expand Down Expand Up @@ -116,6 +116,9 @@ function onMenuHelp(src,~)
% text hack
jh = findjobj(t1);
jh.setVerticalAlignment(javax.swing.JLabel.CENTER)

% make the figure content visible
set(hf,'Visible','on');

else
warndlg({'onMenuHelp:','There is no figure with the BLOCHUS Tag open.'},...
Expand Down
33 changes: 16 additions & 17 deletions callbacks/menus/onMenuViewShow.m → callbacks/menus/onMenuView.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function onMenuViewShow(src,~)
%onMenuViewShow handles the extra menu entries
function onMenuView(src,~)
%onMenuView handles the extra menu entries
%
% Syntax:
% onMenuViewShow(src)
% onMenuView(src)
%
% Inputs:
% src - handle of the calling object
Expand All @@ -11,7 +11,7 @@ function onMenuViewShow(src,~)
% none
%
% Example:
% onMenuViewShow(src,~)
% onMenuView(src,~)
%
% Other m-files required:
% switchToolTips
Expand Down Expand Up @@ -39,26 +39,25 @@ function onMenuViewShow(src,~)
data = getappdata(fig,'data');

switch get(src,'Label')
case 'Tooltips' % switch on/off Tooltips
onoff = get(gui.menu.view_tooltips,'Checked');
switchToolTips(gui,onoff);
switch onoff
case 'on'
set(gui.menu.view_tooltips,'Checked','off');
case 'Tooltips' % switch on/off Tooltips
switch get(src,'Checked')
case 'on' % if it is on, switch it off
switchToolTips(gui,'off');
set(src,'Checked','off');
data.info.ToolTips = 0;
case 'off'
set(gui.menu.view_tooltips,'Checked','on');
switchToolTips(gui,'on');
set(src,'Checked','on');
data.info.ToolTips = 1;
end

case 'Figure Toolbar' % switch on/off the default Figure Toolbar
onoff = get(gui.menu.view_toolbar,'Checked');
switch onoff
case 'on'
set(gui.menu.view_toolbar,'Checked','off');
switch get(src,'Checked')
case 'on' % if it is on, switch it off
set(src,'Checked','off');
viewmenufcn('FigureToolbar');
case 'off'
set(gui.menu.view_toolbar,'Checked','on');
set(src,'Checked','on');
viewmenufcn('FigureToolbar');
end
end
Expand All @@ -70,7 +69,7 @@ function onMenuViewShow(src,~)
updateStatusInformation(fig);

else
warndlg({'onMenuViewShow:','There is no figure with the BLOCHUS Tag open.'},...
warndlg({'onMenuView:','There is no figure with the BLOCHUS Tag open.'},...
'BLOCHUS error');
end

Expand Down
23 changes: 12 additions & 11 deletions callbacks/push/onPushRun.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ function onPushRun(src,~)
pulseparam.PulseType = data.pulse.Type;
% gyromagnetic ratio [rad/s/T]
pulseparam.gamma = odeparam.gamma;
% Larmor frequency [rad]
% Larmor frequency [rad/s]
pulseparam.omega0 = getOmega0(odeparam.gamma,odeparam.B0);
% pulse amplitude [B0]
% pulse amplitude [T]
pulseparam.Amp = odeparam.B0*data.pulse.B1Factor;
% pulse frequency modulation [struct]
pulseparam.fmod = data.results.pulse.fmod;
Expand Down Expand Up @@ -263,7 +263,7 @@ function onPushRun(src,~)
% set theta for all time steps after the pulse simply to
% omega0*t
theta(indT) = getOmega0(odeparam.gamma,odeparam.B0).*TT(indT);
% rotate M into rotating frame of reference
% get M(T) in rotating frame of reference
Mrot = getMrot(MM,theta,dphi);
% get FFT of M in the laboratory frame of reference
[Xm,fmx] = getFFT(TT,MM(:,1:2));
Expand All @@ -274,7 +274,7 @@ function onPushRun(src,~)
set(gui.text_handles.Status,'String','Calculation of excitation pulse & relaxation ... finished.');
pause(0.01);
else
% rotate M into rotating frame of reference
% get M(T) in rotating frame of reference
Mrot = getMrot(MM,theta);
% get FFT of M in the laboratory frame of reference
[Xm,fmx] = getFFT(TT,MM(:,1:2));
Expand Down Expand Up @@ -518,9 +518,8 @@ function onPushRun(src,~)
% set theta for all time steps after the pulse simply to
% omega0*t
theta(indT) = getOmega0(odeparam.gamma,odeparam.B0).*TT(indT);
% rotate M into rotating frame of reference
% and account for the phase from the wait time before the
% pulse
% get M(T) in rotating frame of reference and account for
% the phase from the wait time before the pulse
MM3rot = getMrot(MM,theta,dphi+phiWait);
% get FFT of the pulse
[Xb,fbx] = getFFT(TT(TT<=Ttau),Bpulse(TT<=Ttau,1:2));
Expand All @@ -530,9 +529,8 @@ function onPushRun(src,~)
' & relaxation ... finished.']);
pause(0.01);
else
% rotate M into rotating frame of reference
% and account for the phase from the wait time before the
% pulse
% get M(T) in rotating frame of reference and account for
% the phase from the wait time before the pulse
MM3rot = getMrot(MM,theta,phiWait);
% get FFT of the pulse
[Xb,fbx] = getFFT(TT,Bpulse(:,1:2));
Expand All @@ -555,13 +553,16 @@ function onPushRun(src,~)
% combine data from all stages
TT = [TT1;TT2;TT3];
MM = [MM1;MM2;MM3];

% because there is no M in the rotating frame of reference
% during the switch-off ramp, use the lab-frame data instead
% --- IMPORTANT NOTE: ----------------------------------------
% The pre-polarization switch-off only "lives" in the laboratory
% frame of reference. However, for convenience reasons I plot
% the lab-frame pre-polarization data also in the rotating
% frame of reference! This is u-n-p-h-y-s-i-c-a-l and pure "eye candy"
% frame of reference! This is u-n-p-h-y-s-i-c-a-l and pure
% "eye candy"
%
% MM1 is lab-frame data!
% -------------------------------------------------------------
MMrot = [MM1;MM2rot;MM3rot];
Expand Down
Loading

0 comments on commit 4e156b4

Please sign in to comment.