smiths / caseStudies

Case studies of (manual) documentation for scientific computing software
3 stars 2 forks source link

Ensure Tests Work for SSP #95

Open niazim3 opened 6 years ago

niazim3 commented 6 years ago

This issue comes up from implementation of #92 for SSP. The following tests need to be checked to see if running them results in the same results as before restructuring the folder and file structure:

niazim3 commented 6 years ago

Many of the tests pass in functions as arguments using '@' for function handling. This creates an issue since for instance in SSA_RFEMSliceTester.m:

...
[E1] = SSA_SliceTesterAlgorithm (@RFEMSolver, slip, params_layers,... % compute F and lam for slip surface
    params_piez, params_soln, params_load, 1.319, nStar);

[E1MP] = SSA_SliceTesterAlgorithm (@MorgPriceSolver, slip, params_layers,... % compute F and lam for slip surface
    params_piez, params_soln, params_load, 1.319, nStar);
...

SSA_SliceTesterAlgorithm is in the same directory as SSA_RFEMSliceTester, which is why the easier fixes of adding cd ../src will not work in this case.

MorgPriceTester and RFEMSolver are passed in as arguments into the SSA_SliceTesterAlgorithm, but it is unable to find the definitions for said functions since they are not in the same directory. It is not possible to pass in something like @ ../src/MorgPriceTester because the syntax @ expects does not match.

Therefore, a solution like the one provided at the following link may be an option: https://www.mathworks.com/matlabcentral/answers/97571-how-do-i-specify-an-absolute-pathname-for-a-function-when-using-str2func-to-capture-its-handle.

Edit: Also a problem for SSA_MPSliceTester.

niazim3 commented 6 years ago

Update: such an implementation will not work, since the function that is passed in will expect arguments to be passed into the function right away (i.e. when it's passed in as an argument) as well, which is not possible since the arguments to pass into the passed in function are determined in a separate testing file.

For now, will continue to work on #92 as if SSA_MPSliceTester.m and SSA_RFEMSliceTester.m were fixed. (Keeping in mind that SSA_MPSliceTester resulted in segmentation violation before the file standardization task and that SSA_RFEMSliceTester produces a multitude of warnings of the following nature

In RFEMSolver (line 309)
  In SSA_SliceTesterAlgorithm (line 39)
  In SSA_RFEMSliceTester (line 51)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =  1.827556e-16.

before the standardization task as well, this issue can close upon getting these results).

smiths commented 6 years ago

Matlab can be tricky to work with for tasks such as this. If you can get it to work with the tests in a separate folder, that would be great, but if we have to change the file structure to something simpler, that is a viable option.

Some thoughts that come to mind for dealing with the matlab headaches is to play with the matlab path environment variables. There may be a way to tell it to search the folder you want it to search. Another option might be to create symbolic links to the files that you need. This isn't a pretty option, and I don't think it would be easy to maintain.