spitschan / SilentSubstitutionToolbox

Toolbox to simulate colorimetric observers for evaluation of photoreceptor isolation
Other
7 stars 5 forks source link

ComputeAndReportContrastsFromSpds broken #34

Closed spitschan closed 6 years ago

spitschan commented 6 years ago

As of 1192cb7108068f7caac9a233694e0a70cd81e75e, some of my code using ComputeAndReportContrastsFromSpds is broken. @JorisVincent can you look into this?

spitschan commented 6 years ago

... and potentially offer some demo code for the new functionality.

JorisVincent commented 6 years ago

Bug fixed by https://github.com/spitschan/SilentSubstitutionToolbox/commit/63d5ce1002bc974abf306e5ffd2e39e3f3b49bc2

JorisVincent commented 6 years ago

And examples added by https://github.com/spitschan/SilentSubstitutionToolbox/commit/6b7b9825062f4b77b0a8b9c8914a7a71edd7b7d1.

spitschan commented 6 years ago

I think the routine is still broken. onsider the following:

backgroundSpd = 0.5*ones(401, 1);
modulationSpd = ones(401, 1);
T_receptors = ones(1, 401);

 ComputeAndReportContrastsFromSpds('','',T_receptors,backgroundSpd,modulationSpd,'doPostreceptoral', false)

An error is thrown:


Cell contents reference from a
non-cell array object.

Error in
ComputeAndReportContrastsFromSpds
(line 63)
        fprintf('  * %s: contrast =
        %0.1f%%\n',receptorStrings{j},100*receptorContrasts(j)); 

and


receptorContrasts =

     1
    -1

Where it clearly should just be 1x1.

I'm reverting to the old way of calculating it in HEAD for now, but happy to use the SPDToReceptorContrast machinery.

JorisVincent commented 6 years ago

That error has to do with the receptorStings:

% Input:
%    photoreceptorClasses - Names of the photoreceptor classes in a **cell array**.

Running the following (with photoreceptorClasses as cell-array) does not throw the error:

backgroundSpd = 0.5*ones(401, 1);
modulationSpd = ones(401, 1);
T_receptors = ones(1, 401);

 ComputeAndReportContrastsFromSpds('',{''},T_receptors,backgroundSpd,modulationSpd,'doPostreceptoral', false)
JorisVincent commented 6 years ago

I'm looking into the other issue now.

JorisVincent commented 6 years ago

Other issue was unique to the situation of a single receptor. Fixed now.

spitschan commented 6 years ago

Thank you.

On 30 March 2018 17:06:23 Joris Vincent notifications@github.com wrote: Other issue was unique to the situation of a single receptor. Fixed now. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.