isetbio / isetbio_v0.1

Tools for modeling image systems engineering in the human visual system front end
MIT License
7 stars 0 forks source link

Dependencies #27

Closed DavidBrainard closed 9 years ago

DavidBrainard commented 9 years ago

A) Nicolas and I have been thinking about isetbio dependencies. We will set things up so that it is easy to copy into isetbio 'external' routines, such as those from the PTB, that isetbio requires. We are (intentionally) setting this up so that any change made to a PTB routine will be clobbered when we copy over -- that is, modifying PTB routines that are supplied with isetbio is in effect not allowed. I think this is a good way to go because when we work on isetbio we should treat PTB routines as read only. We can, of course, modify them if we want, but the way to do that is to let me know what needs to be changed, perhaps by emailing me a modified copy of the routine for review and possible incorporation into PTB. I think other ways of doing this will lead to madness. But, now is the time to suggest something else if you disagree.

B) We have written some utilities that allow us easily to take PTB and other local toolboxes off our path before running isetbio validations. We think this will 'smoke out' whatever oddball dependencies that have crept in. We have this set up so we can also limit which Matlab toolboxes are on the path when we test -- we have them all on our machines by default because they come with the site license. So the question is, what Matlab toolboxes do we want to allow isetbio to depend on. Presumably signal, which is hard to do much of anything without. Anything else? Once we know the answer to that, we can test.

C) Nicolas came up with a slick solution to the name space problem, in which you can point at a local routine temporarily when its name conflicts with something else on the path. I believe he has this illustrated in one of the validation scripts, where the xyz2lab routine in isetbio collides with a recently added Matlab function of the same name. We put the engine that handles this into PTB, as we are likely to want to call it from non isetbio code in our lab, and then copied it over into isetbio's PTB collection.

wandell commented 9 years ago

Regarding part (A), sounds very good. Regarding part (B), image processing toolbox and parallel would both be on our list.
I an wondering about the optimization, but probably we can/should live without that one because key optimization tools are in the main part (I think) and then we also use completely external svm code. Regarding (C), we will try to find the code you describe and see how it works.

Thanks!

npcottaris commented 9 years ago

Hi Brian,

Regarding (B).

There are many more dependencies than Image Processing and the Parallel Computing toolboxes. For example, oiCreate() has the following dependencies: [1]: Image Processing Toolbox [2]: Mapping Toolbox [3]: Parallel Computing Toolbox

[5]: Signal Processing Toolbox
[6]: Statistics Toolbox

Regarding (C).

The function is called overrideBuiltInFunction.m It is located in : Psychtoolbox/PsychOneliners You can see it in action in: isetbio/validation/validationScripts/PTB_vs_ISETBIO/PTB_vs_ISETBIO_Colorimetry.m Usage: functionName = overrideBuiltInFunction('functionName', overridingFunctionPath);

    where the overridingFunctionPath string can be the full path to the overriding
    function or a uniquely-identifying subset of the full path.

    This call must be done in the script where you will use the override. It is a local override.
    To use across several scripts, make it a global function handle:

    global functionName
    functionName = overrideBuiltInFunction('functionName', overridingFunctionPath);

Example Usage: Override Matlab's built-in function lab2xyz with the one supplied by ISETBIO located in '/Users/Shared/Matlab/Toolboxes/ISETBIO/isettools/color/transforms'

    lab2xyz = overrideBuiltInFunction('lab2xyz', 'isetbio');

Nicolas

On Oct 29, 2014, at 5:41 PM, Brian Wandell notifications@github.com wrote:

Regarding part (A), sounds very good. Regarding part (B), image processing toolbox and parallel would both be on our list.

I an wondering about the optimization, but probably we can/should live without that one because key optimization tools are in the main part (I think) and then we also use completely external svm code. Regarding (C), we will try to find the code you describe and see how it works.

Thanks!

— Reply to this email directly or view it on GitHub.

DavidBrainard commented 9 years ago

I think it would be worth seeing if we can easily eliminate the dependency on the mapping toolbox for now, and also we should probably write so that if the parallel toolbox is not present things still run.

I am OK with dependencies on image processing, signal processing, and statistics (and also optimization, as I think some of the functions for optimization in there -- such as fmincon -- are enough better than the builtins that I wouldn't work too hard to avoid them).

PTB dependency we can eliminate by copying over whatever we need from it.

wandell commented 9 years ago

Agreed. What is the dependency on the mapping toolbox? I didn't even think I had that one.

npcottaris commented 9 years ago

OK,

I investigated this a little more. It appears that although MATLAB's built-in function

[requiredFilesList, productsList] = matlab.codetools.requiredFilesAndProducts('oiCreate');

reports the following required productList [1]: Computer Vision System Toolbox [2]: Image Processing Toolbox [3]: Mapping Toolbox [4]: Parallel Computing Toolbox [5]: Signal Processing Toolbox [6]: Statistics Toolbox

removing ALL but the Image Processing Toolbox from the path does not affect 'v_oi.m', which finishes to completion. On the other hand, removing only the Image Processing Toolbox from the path crashes v_oi.m. Same behavior for v_ISETBIO. So it appears that only the Image Processing Toolbox is absolutely required and that either

Nicolas

DavidBrainard commented 9 years ago

The one time I tried to use depfun (which I think was the predecessor to what you are using), it was buggy in the same way you are seeing -- it claimed dependencies that were not there.

I'd say, make the minimal config Matlab + signal + stats + image and then let's see what breaks when we run our ever increasing set of validations. If we need to add optimization then let's add that to the list. If it starts to expand beyond this set, then maybe we can find workarounds for the rest.

wandell commented 9 years ago

Agreed - and if it is of any help, I often run with only image processing and signal processing using a personal version. Things seem OK that way. But I haven't been really systematic about checking.

I tried to keep statistics out of the path, too. There was one or two functions I needed that we re-wrote. One was for percentile calculations (prctile.m) and another was for generating Poisson random variables.

DavidBrainard commented 9 years ago

OK. We will try with just Matlab, isetbio, signal and image and see if it works. Closing this issue, will restart a shorter issue with just this point.