MBB-team / VBA-toolbox

The VBA toolbox
GNU General Public License v3.0
129 stars 67 forks source link

extended and multisource #28

Closed lionel-rigoux closed 7 years ago

lionel-rigoux commented 7 years ago

There are some redundancies in the core and display code to process differentially single or multi-sources data. Part of the switches between these two trails relies on the number of sources, some on an "extended" flag in the options structure. The latter was introduced to test the equivalence of the processing of single source models accross the two versions of codes. Therefore, this flag is not reliable to indicate the number of sources and only add unecessary redundancy in the instructions workflow. I think the redundancy should be reduced to its minimum and the "extended" flag should be removed. In particular, this concerns the following functions:

Part of the redundancy is however required has the treatment of stochastic and multisources models cannot be yet fused (cf. VBA_Iphi.m)

jdaunize commented 7 years ago

Hey Lionel, I agree. I'll remove the 'extended' field where I know it is, namely:

jdaunize commented 7 years ago

Oh and also in VBA_GN...

lionel-rigoux commented 7 years ago

I don't have it all in mind, but an advanced search for text in matlab should be able to point to all occurences of the flag.

Concerning the display, I will take care of merging (respectively for init and update) the two versions into a unique versatile function. Having said that, you could still replace the extended flag by a source number check, it won't hurt!

lionel-rigoux commented 7 years ago

Well, the flag should be in all places the multisource can kick in. I used this flag to extensively check on single source models that the old code (single source) and the new one (intended for multisource but activated by the flag) gave strictly identical results.

jdaunize commented 7 years ago

So i've been replacing the 'extended' flag with a check on the number of sources everywhere I've seen it. I've ran a number of demos, and it all looks fine. I'll commit soon.

jdaunize commented 7 years ago

Re: multi-source display: I'm kind of unhappy here, because it systematically cracks with me. Besides, I think it should be optimized because the current version will look really crap if the number of sources incerases...

lionel-rigoux commented 7 years ago

What do you mean "cracks"? I went up to a dozen sources without problems. A scroll appears on the right to navigate through the sources when it doesn't fit the panel. Having said that, I have no strong feeling about this!

jdaunize commented 7 years ago

:) When I navigate through the tabs, it cracks...

jdaunize commented 7 years ago

Here is a series of screen captures: bugs_VBA.pptx

The 2 first ones ar eduring the inversion:

The 2 last ones are after VBA convergence:

lionel-rigoux commented 7 years ago

Ok I found the problem:

You're using maltab 2013a, I am using the 2016a version. There was a major modification of the graphical engine in the 2014b release. Thoses modifications affect in particular the way "panes" are handled in the hierarchy of graphical obejcts included in the figure. Critically, if you using the wrong system leads to the plots beeing drawn beneath the pane, hence the "white page" effect. In fact the plots are there, hidden behing the white pane...

I applied a patch using a subfunction "getPanes" designed to get the handle to the selected pane irrespective of the Matlab version. Incidently, the patch does not appear in VBA_initDisplay but only in VBA_initDisplay_extended (that's why I hate duplicated code...). Therefore: I have a problem with the stochastic demo but not you, as they rely on VBA_initDisplay which works with the old panes system. You have problem with multisource demo but not I as they rely on VBA_initDisplay_extended which works with the new panes. having said that, I realize that my getPanes trick does not work for Matlab 2013a (but is fine for 2014a).

lionel-rigoux commented 7 years ago

We need to find a better selector to retrieve the handle to the pane correctly irrespective of the Matlab version. Moreover, I really need to merge those display functions as those kind of half bug corrections are quite nasty to identify.

lionel-rigoux commented 7 years ago

And the axes ill positioned, it is also related to the change of the status of panel in the graphical hierarchy. The bug was kind of multisource specific because the multisource panels require a scrolling option for the panes that is badly handled in old versions. A quick workaround would be to add an offset depending on the graphical engine version.

lionel-rigoux commented 7 years ago

We can start there: https://de.mathworks.com/help/matlab/graphics-changes-in-r2014b.html

lionel-rigoux commented 7 years ago

Solved by pull request #32