Commit b9efcfd9 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

corridor changes

parent 805b1f0c
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -889,7 +889,7 @@ class MLDConformance:
                else:
                    print(f"<{tag}> PASSED BE TEST")

    def computeCorridor(self, mldRefWithTags, mldCutWithTags, tag, threshold=1.0):
    def computeCorridor(self, mldRefWithTags, mldCutWithTags, tag, threshold=0.0):
        mldDict = dict[str, list]()
        failed = False

@@ -900,9 +900,28 @@ class MLDConformance:
        )
        refMLD = mldRefWithTags["MLD"][indRef]
        dutMLD = mldCutWithTags["MLD"][indDut]

        diff = dutMLD - refMLD
      
        if diff.max() > threshold:
            print(f"\033[91mMLD Corridor failed for {tag} with max MLD diff of {diff.max()} \033[00m")
            maxMLD = np.maximum(dutMLD, refMLD)
            mldWithTags = np.column_stack(
                (
                    maxMLD,
                    intersection,
                )
            )      
            new_mld_dir = os.path.join(
                        self.testvDir, "mld_ref")
            if not os.path.exists(new_mld_dir):
                os.makedirs(new_mld_dir, exist_ok=True) 
                
            refMldFile2 = os.path.join(
                self.testvDir, "mld_ref", ReferenceMldFiles[tag]
            )
            with open(refMldFile2, "ab") as f:
                np.savetxt(f, mldWithTags, fmt="%s", delimiter=",")              
        else:
            print(f"\033[92mMLD Corridor passed for {tag} with max MLD diff of {diff.max()} \033[00m")

@@ -964,7 +983,7 @@ class MLDConformance:
                        mldRefWithTags = np.loadtxt(
                            refMldFile,
                            delimiter=",",
                            dtype=[("MLD", "f8"), ("pyTestTag", "<U90")],
                            dtype=[("MLD", "f8"), ("pyTestTag", "<U256")],
                        )
                        self.computeCorridor(mldRefWithTags, mdlCutWithTags, tag)
                    else: