Skip to content

Commit

Permalink
1.11.3
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdecyphir committed Nov 13, 2023
1 parent e90e985 commit 1da2957
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Release 1.11.3
- Fix BreachSamplesPlot data tip 3D bug
- Improved BreachProblemGui

# Release 1.11.2
- Fix BreachRequirement Concat method
- Fix LogX in BreachProblem somehow double logging
Expand Down
2 changes: 1 addition & 1 deletion Core/BreachSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function SetP(this, P)
%% Constructor
function this = BreachSet(Sys, params, ranges)
% BreachSet constructor from a legacy P or Sys, parameter names and ranges

InitBreach
this.sigMap = containers.Map();
this.sigMapInv = containers.Map();
this.AliasMap = containers.Map();
Expand Down
2 changes: 1 addition & 1 deletion Core/Gui/BreachGuiClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@

function e = create_table(this,id, data, callback, w,h)

if nargin<3
if nargin<3||isempty(data)
data = {'',[]};
end

Expand Down
68 changes: 62 additions & 6 deletions Core/Gui/BreachProblemGui.m
Original file line number Diff line number Diff line change
@@ -1,39 +1,71 @@
classdef BreachProblemGui < BreachGuiClass
% A class to run, configure, etc, a BreachProblem

properties
pb
pause_requested
Bsearch
end


methods
function this = BreachProblemGui(pb)

set(this.hdle, 'Name', 'BreachProblemGUI'),

%% Linking problem object
this.pb=pb;
this.pb.callback_obj = @(o,e)(this.zcallback('pb',o,e));

params = this.pb.params;
ranges = [this.pb.lb this.pb.ub];

B = BreachSet(params);
B.SetParamRanges(params, ranges);
B.SetParam(params,this.pb.x0);

this.Bsearch = B;


%% Creates all elements

% objective ax
this.create_axes('ax_main',2,8);
this.create_panel('panel_plots', 'Objective', {{'ax_main'}});

% param table
id = 'table_params';
cb =@(o,e)(this.table_params('callback',o,e));
this.create_table(id, {},cb, 2, 4);
this.create_panel('panel_params', 'Search Domain', {{'table_params'}});
this.table_params('init');

% buttons
this.create_button('button_stop','Stop');
this.create_button('button_resume','Start/Resume');
layout = {{'ax_main'};
{'button_resume', 'button_stop'}};
this.create_panel('panel_buttons', 'Controls', {{'button_resume', 'button_stop'}});

layout = {{'panel_plots'};
{'panel_params'};
{'panel_buttons'}};

this.set_layout(layout);
this.enable_resizable();

end

function zcallback(this,id,o,e)

% callback function, called by the problem at each freq_update
switch id
case 'button_stop'
this.pause_requested = 1;

case 'button_resume'
this.pause_requested= 0;
this.pb.is_paused = 0;
this.pb.solve();

case 'pb'
ax=this.uimap('ax_main').hdle;
axes(ax);
enableDefaultInteractivity(ax);
grid on;
plot(1:this.pb.nb_obj_eval, this.pb.obj_log);
drawnow
Expand All @@ -43,7 +75,31 @@ function zcallback(this,id,o,e)
end

end

%% Domain table
function table_params(this, mode,o, e)
switch mode
case 'init'
e = this.uimap('table_params');
htable = e.hdle;
e.hdle = fill_uitable_params(htable,this.Bsearch);
set(e.hdle,'ColumnEditable', false);
case 'callback'
% Todo
end
end

%% Plotting
% TODO more options, axes, etc
% function reset_obj_plot(this)
%
% end

end






end
3 changes: 2 additions & 1 deletion Core/m_src/BreachGui.m
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ function button_edit_prop_Callback(hObject, eventdata, handles)

function handles = update_properties_panel(handles)

if ~isempty(handles.req_sets)
if ~isempty(fieldnames(handles.req_sets))
set(handles.panel_properties, 'Visible','on');
%% Set title
str_name = 'Requirements';
Expand All @@ -784,6 +784,7 @@ function button_edit_prop_Callback(hObject, eventdata, handles)

%% Update listbox_prop
handles.properties = struct;

R = handles.req_sets.(handles.current_req_set);
specs = R.req_monitors;

Expand Down
18 changes: 17 additions & 1 deletion Core/m_src/fill_uitable_params.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
% fill_uitable_params Takes a uitable element and fill it with
% current values of parameters, domains, etc

if nargin ==2&& isa(params, 'BreachSet')
B = params;
params =B.GetParamList();
p0 = B.GetParam(params,1);
domains = B.GetDomain(params);
end

is_signal = zeros(1, numel(p0));
if exist('issignal' , 'var')
is_signal(issignal) = true;
Expand All @@ -19,7 +26,8 @@
data = cell(numel(params), 5);
for ip = 1:numel(params)
data{ip, 1} = params{ip};

sz(ip) = numel(params{ip});

if is_signal(ip)
data{ip,2} = '(signal)';
else
Expand Down Expand Up @@ -51,5 +59,13 @@

end
set(h_uitable, 'data', data);
max_sz = max(sz); % longest param names in table
if ismac
SZ = {max_sz*7 80 80 80 80} ;
else
SZ = {max_sz*8 100 100 100 100} ;
end

set(h_uitable, 'ColumnWidth', SZ, 'Unit', 'pixel');

end
2 changes: 0 additions & 2 deletions Core/m_src/read_uitable_params.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
% read_uitable_params Takes a uitable element and reads parameter values and domains

data = get(h_uitable, 'Data');

for irow = 1:size(data,1)

% param name
params{irow} = data{irow,1};


if isnumeric(data{irow,2})
p0(irow,1) =data{irow,2};
else
Expand Down
24 changes: 18 additions & 6 deletions Plots/BreachSamplesPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ function update_plot(this)
~isempty(this.summary.requirements.rob);
end


function update_brset_plot(this)
B = this.BrSet;
idx = this.data.pos_pts.idx;
Expand Down Expand Up @@ -307,7 +308,8 @@ function update_brset_plot(this)
end

% zdata
none_z = 'none (2D plot)';
none_z = {'none (2D plot)', 'none','', '2D'};

switch this.z_axis
case none_z
this.pos_plot = plot(xdata,ydata,'.b', 'MarkerSize', 20);
Expand All @@ -333,7 +335,12 @@ function update_brset_plot(this)

function [txt] = myupdatefcn(obj,event_obj)
pos = event_obj.Position;
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2),1);
if ismember(this.z_axis,none_z)
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2),1);
else
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2)&event_obj.Target.ZData==pos(3),1);
end

i_pts = idx(ipos);

this.idx_tipped = i_pts;
Expand Down Expand Up @@ -371,7 +378,7 @@ function update_brset_plot(this)
end

top_z = uimenu(cm_proj, 'Label', ['Change z-axis']);
uimenu(top_z, 'Label', none_z,'Callback',@(o,e)(this.set_z_axis(none_z)));
uimenu(top_z, 'Label', none_z{1},'Callback',@(o,e)(this.set_z_axis(none_z{1})));
for ip = 1:numel(this.data.variables)
uimenu(top_z, 'Label', this.data.variables{ip},'Callback',@(o,e)(this.set_z_axis(this.data.variables{ip})));
end
Expand Down Expand Up @@ -410,7 +417,7 @@ function ctxtfn_signals_plot(o,e)
end

top_z = uimenu(cm, 'Label', ['Change z-axis']);
uimenu(top_z, 'Label', none_z,'Callback',@(o,e)(this.set_z_axis(none_z)));
uimenu(top_z, 'Label', none_z{1},'Callback',@(o,e)(this.set_z_axis(none_z{1})));
for ip = 1:numel(this.data.variables)
uimenu(top_z, 'Label', this.data.variables{ip},'Callback',@(o,e)(this.set_z_axis(this.data.variables{ip})));
end
Expand All @@ -421,7 +428,7 @@ function ctxtfn_signals_plot(o,e)
function update_req_plot(this)

B = this.BrSet.BrSet;
none_z = {'none (2D plot)', 'none', '', '2D'};
none_z = {'none (2D plot)', 'none','', '2D'};

has_pos = isfield(this.data, 'pos_pts');
has_vac = isfield(this.data, 'vac_pts');
Expand Down Expand Up @@ -803,7 +810,12 @@ function plot3_num()

function [txt] = myupdatefcn(obj,event_obj)
pos = event_obj.Position;
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2),1);
if ismember(this.z_axis,none_z)
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2),1);
else
ipos = find(event_obj.Target.XData==pos(1)&event_obj.Target.YData==pos(2)&event_obj.Target.ZData==pos(3),1);
end

is_neg = 0;
is_pos = 0;
is_vac = 0;
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.2
1.11.3

0 comments on commit 1da2957

Please sign in to comment.