예제 #1
0
파일: case.py 프로젝트: ntouran/armi
    def compare(
        self,
        that,
        exclusion: Optional[Sequence[str]] = None,
        weights=None,
        tolerance=0.01,
        timestepMatchup=None,
        output="",
    ) -> int:
        """
        Compare the output databases from two run cases. Return number of differences.

        This is useful both for in-use testing and engineering analysis.
        """
        runLog.info("Comparing the following databases:\n"
                    "REF: {}\n"
                    "SRC: {}".format(self.dbName, that.dbName))
        diffResults = compareDatabases(self.dbName,
                                       that.dbName,
                                       tolerance=tolerance,
                                       exclusions=exclusion)

        code = 1 if diffResults is None else diffResults.nDiffs()

        sameOrDifferent = ("different" if diffResults is None
                           or diffResults.nDiffs() > 0 else "the same")
        runLog.important("Cases are {}.".format(sameOrDifferent))

        return code
예제 #2
0
    def invoke(self):
        from armi.bookkeeping.db import compareDatabases

        diffs = compareDatabases(
            self.args.refDB,
            self.args.cmpDB,
            tolerance=self.args.tolerance,
            exclusions=self.args.exclude,
        )
        return diffs.nDiffs()