T-Matrix trimer test fit fails on Windows x64

Bug #792946 reported by Vinothan N. Manoharan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HoloPy
Status tracked in Dev
Dev
Fix Released
Medium
Unassigned

Bug Description

TestFit.test_tmatrix_noisytrimer_slow fails on Windows 7 x64 (EPD 7.0-1). The fast version works fine, as do the dimer fits (both slow and fast). fit_result.tsv and image0003_fit.yaml are attached.

The fit values seem to be close to the "gold" values. The only major difference seems to be the fit status (I get 3, while gold has 1). Could this be causing the assertion to fail?

Output of "nosetests holopy\tests\test_fit.py:TestFit.test_tmatrix_noisytrimer_slow":

AssertionError:
Arrays are not almost equal
Fit results from the trimer are not approx. equal to the standard fit results.
(mismatch 5.26315789474%)
 x: array([ 1.58940596e+00, 1.59800000e+00, 1.59900000e+00,
         1.00000000e-05, 1.00000000e-05, 1.00000000e-05,
         5.00000000e-07, 5.00000000e-07, 5.00000000e-07,...
 y: array([ 1.58940000e+00, 1.59800000e+00, 1.59900000e+00,
         1.00000000e-05, 1.00000000e-05, 1.00000000e-05,
         5.00000000e-07, 5.00000000e-07, 5.00000000e-07,...

Output file fit_result.tsv:

# Fit results from: c:\Users\vnm\Desktop\Documents\code\holopy-stable\holopy\tests/exampledata/TmatTrimer_input_deck_slow.yaml @ Sat Jun 04 18:11:18 2011
Image n_particle_real_1 n_particle_real_2 n_particle_real_3 n_particle_imag_1 n_particle_imag_2 n_particle_imag_3 radius_1 radius_2 radius_3 x_com y_com z_com scaling_alpha euler_alpha euler_beta euler_gamma fnorm status timestamp
c:\Users\vnm\Desktop\Documents\code\holopy-stable\holopy\tests/exampledata\.\image0003.npy 1.58940596022 1.598 1.599 1e-05 1e-05 1e-05 5e-07 5e-07 5e-07 6.00052562811e-06 5.99926633938e-06 7.01799602893e-06 0.609476829727 40.6781729548 12.0806137666 4.43837307261 4.7950756001 3 0.0

Tags: fit testing
Revision history for this message
Vinothan N. Manoharan (vnm) wrote :
Revision history for this message
Rebecca W. Perry (perry-becca) wrote :

Yes. The fit status (1 vs. 3) is what caused that test to fail. For a trimer, the fit returns 19 parameters. We check each of these parameters against results obtained previously (the gold standard).

The fit status parameter is certainly important as far as "<5" vs. "=5". When the status equals 5, it means that the fitting algorithm stopped iterating because it reached the maximum allowed number of iterations (the fit did not necessarily converge to a good solution). When the status is less than 5, it means that the fitter had a different (probably better) reason to not do any more iterations.

Does it make sense that different machines would come up with different codes 1-4?

We could relax the test to check that the fit status parameter is simply <5 if it makes sense for different machines to have different codes 1-4 when running the same fit.

Revision history for this message
Tom Dimiduk (tdimiduk) wrote :

I think it makes sense that the fit status could be different for different computers. I think compiler differences might affect how numpy or the c/fortran code does calculations down near the limits of machine precision. This could in turn affect the path that the fitter takes to the solution, and thus potentially the termination conditions it reaches.

Someone who actually knows what the termination conditions means well (Jerome?) should weigh in, but it seems to me that Becca's idea of treating fit status 1-4 as equivalent should be safe, since we are testing that all the parameter values (the results we care about) agree to good precision.

Revision history for this message
Vinothan N. Manoharan (vnm) wrote : Re: [Bug 792946] Re: T-Matrix trimer test fit fails on Windows x64

According to the nmpfit code at
http://stsdas.stsci.edu/pyraf/stscidocs/pytools_pkg/pytools_api/pytools.nmpfit.mpfit-class.html
, fit status 3 means that criteria for both fit status 1 (sum of squares
has converged) and status 2 (parameter vector has converged) apply. So
it certainly makes sense to change the test to allow fit status to be
either 1 or 3. We probably also want to allow fit status 2 and 4. Note
that there are other fit failure codes besides status=5.

Could someone make the change and commit to stable?

On 06/09/2011 04:54 PM, Tom Dimiduk wrote:
> I think it makes sense that the fit status could be different for
> different computers. I think compiler differences might affect how
> numpy or the c/fortran code does calculations down near the limits of
> machine precision. This could in turn affect the path that the fitter
> takes to the solution, and thus potentially the termination conditions
> it reaches.
>
> Someone who actually knows what the termination conditions means well
> (Jerome?) should weigh in, but it seems to me that Becca's idea of
> treating fit status 1-4 as equivalent should be safe, since we are
> testing that all the parameter values (the results we care about) agree
> to good precision.
>

Revision history for this message
Rebecca W. Perry (perry-becca) wrote :

I uploaded a fix to the stable branch-- could someone please try running the tests on Windows 7 x64 (EPD 7.0-1) to make sure I they pass? They still pass on Ubuntu.

Revision history for this message
Vinothan N. Manoharan (vnm) wrote :

Test passes now. Thanks!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.