Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckWorkspacesMatch should use tolerance property on NumericAxis comparison #309

Merged

Conversation

DanNixon
Copy link
Member

Fixes #11179.

To test:

  • Review code changes and unit test
  • Load the files attached to the Trac ticket
  • Run CheckWorkspacesMatch on both pairs of workspaces, ensuring CheckAxis is enabled, CheckSpectraMap is disabled and tolerance is set to 1e-10
  • On master this fails, with this fix it should pass

All being well this should fix the failing system test on OSX 10.9.

@DanNixon DanNixon added High Priority An issue or pull request that if not addressed is severe enough to postponse a release. In Progress Framework Issues and pull requests related to components in the Framework labels Feb 26, 2015
@DanNixon DanNixon added this to the Release 3.4 milestone Feb 26, 2015
@DanNixon
Copy link
Member Author

Jenkins, retest this please.

@DanNixon
Copy link
Member Author

Jenkins, retest this please.

1 similar comment
@DanNixon
Copy link
Member Author

Jenkins, retest this please.

@quantumsteve quantumsteve self-assigned this Feb 26, 2015
@quantumsteve
Copy link
Contributor

  1. Would you please add unit tests for the special case when one or more of the values is Inf or NaN?

  2. I think this should replace the current behavior of virtual bool operator==(const Axis &) const because we should never use operator== to compare floating point values. Can we create an optional argument for the tolerance?

  3. Consider replacing your for loop with std::equal and a binary predicate.

  4. The system test is still failing on os x because m_values.size() is not equal.
    screen shot 2015-02-26 at 6 08 25 pm

@DanNixon
Copy link
Member Author

  1. Done.
  2. operator== can only take a single parameter as the other reference, I agree that it should probably use a tolerance through (1e-15?).
  3. Done
  4. This ticket was just to fix the issue with CheckWorkspacesMatch, I'm still looking at what's wrong with the OSX.

@quantumsteve
Copy link
Contributor

There is an error on Windows.

  1. Would you replace your global variable and function with a functor?
  2. Agreed, that shouldn't stop it from being merged into master.

result = axis_name + " values mismatch";
return false;
}
} else if (!ax1->isSpectra() && !ax1->operator==(*ax2)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are better off using the overloaded operator== instead of this first if statement. RefAxis and NumericAxis both return true for isNumeric(), but have different implementations of operator==.

The ISISIndirectAnalysis system test passes on os x 10.9 if we remove the first if.

@DanNixon
Copy link
Member Author

Not checking with the tolerance provided would pretty much defeat the point of this ticket, I cant see why removing the first if would make any difference as it would be doing the same comparison as it always has.

@quantumsteve
Copy link
Contributor

retest this please

@quantumsteve
Copy link
Contributor

Yes, using the provided tolerance would be better.

Running ISISIndirectAnalysisTest on master, CheckWorkspacesMatch is false because of the equality comparison between NumericAxis. In this branch, it fails because of the equality comparison between RefAxis.

@quantumsteve
Copy link
Contributor

The win7 build has the following error. I'm going to try retesting.

18:14:29 ISISLiveEventDataListener-[Error] Caught a runtime exception.
18:14:29 ISISLiveEventDataListener-[Error] Exception message: Operation of receiving Events header timed out.

@quantumsteve
Copy link
Contributor

retest this please

@abuts
Copy link
Member

abuts commented Feb 28, 2015

Jenkins, Retest this please

@DanNixon
Copy link
Member Author

DanNixon commented Mar 2, 2015

Jenkins, retest this please.

@quantumsteve
Copy link
Contributor

retest this please

@@ -65,6 +65,8 @@ class MANTID_API_DLL NumericAxis : public Axis {
virtual void setValue(const std::size_t &index, const double &value);
size_t indexOfValue(const double value) const;
virtual bool operator==(const Axis &) const;
virtual bool equalWithinTolerance(const Axis &axis2,
const double tolerance = 0.0) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we settle on a single default tolerance or remove the default value? 1e-15 is being used for operator==.

@quantumsteve
Copy link
Contributor

retest this please

@quantumsteve
Copy link
Contributor

I tested this last week and found it fixed the issues comparing those two workspaces listed above. The new changes made today look good and it's passing all tests on jenkins. Let's :shipit:

quantumsteve added a commit that referenced this pull request Mar 2, 2015
…_use_tolerance_on_numericaxis

CheckWorkspacesMatch should use tolerance property on NumericAxis comparison
@quantumsteve quantumsteve merged commit 128ea4a into master Mar 2, 2015
@quantumsteve quantumsteve deleted the 11179_checkworkspacesmatch_use_tolerance_on_numericaxis branch March 2, 2015 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues and pull requests related to components in the Framework High Priority An issue or pull request that if not addressed is severe enough to postponse a release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants