Skip to content

Commit

Permalink
Merge branch 'vara-dev' into f-SynthCompileTimeCS
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Abelt committed Sep 22, 2023
2 parents 243a3d4 + b344eb4 commit dfb6bac
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
# modules that require this module before setting the type checking flag.
import scipy.stats # isort:skip

# Matplotlib >=3.8 has a type-checking-flag-guarded import of a symbol that does
# not exist in the shipped version.
import matplotlib.pyplot # isort:skip

# The autodocs typehints plugin does not resolve circular imports caused by type
# annotations, so we have to manually break the circles.
import rich.console # isort:skip
Expand Down
1 change: 1 addition & 0 deletions docs/source/vara-ts-api/tools/vara-cs-gui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The gui is started by::

The gui provides 3 Strategies to generate case studies:
- Manual revision selection: Select revision from the revision history of a project. Multiple revisions can be selected by holding `ctrl` and ranges by holding `shift`. Revisions which are blocked because of bugs in the compilation of the project are marked blue.

.. figure:: vara-cs-gui-manual.png

- Random Sampling: Sample a number of revisions using a random a Normal or HalfNormal Distribution.
Expand Down
13 changes: 12 additions & 1 deletion tests/utils/test_git_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
from pathlib import Path

from benchbuild.utils.revision_ranges import RevisionRange
from benchbuild.utils.revision_ranges import RevisionRange, SingleRevision

from varats.project.project_util import (
get_local_project_git,
Expand Down Expand Up @@ -568,6 +568,17 @@ def test_specification_validity_range_multiple_binaries(self) -> None:
self.assertIn("SingleLocalMultipleRegions", self.rv_map)
self.assertIn("SingleLocalSimple", self.rv_map)

def test_specification_single_revision(self) -> None:
"""Check if we can add binaries that are only valid with a single
revision."""
self.rv_map.specify_binary(
"build/bin/SingleLocalMultipleRegions",
BinaryType.EXECUTABLE,
only_valid_in=SingleRevision("162db88346")
)

self.assertIn("SingleLocalMultipleRegions", self.rv_map)

def test_specification_binaries_with_special_name(self) -> None:
"""Check if we can add binaries that have a special name."""
self.rv_map.specify_binary(
Expand Down
10 changes: 5 additions & 5 deletions varats-core/varats/utils/git_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,9 @@ def specify_binary(
override_entry_point = kwargs.get("override_entry_point", None)
if override_entry_point:
override_entry_point = Path(override_entry_point)
validity_range = kwargs.get("only_valid_in", None)
validity_range: AbstractRevisionRange = kwargs.get(
"only_valid_in", None
)
valid_exit_codes = kwargs.get("valid_exit_codes", None)

wrapped_binary = ProjectBinaryWrapper(
Expand All @@ -1072,6 +1074,7 @@ def specify_binary(
)

if validity_range:
validity_range.init_cache(self.__repo_location)
self.__revision_specific_mappings[validity_range].append(
wrapped_binary
)
Expand All @@ -1087,10 +1090,7 @@ def __getitem__(self,

for validity_range, wrapped_binaries \
in self.__revision_specific_mappings.items():
if revision in get_all_revisions_between(
validity_range.id_start, validity_range.id_end, ShortCommitHash,
self.__repo_location
):
if revision in map(ShortCommitHash, validity_range):
revision_specific_binaries.extend(wrapped_binaries)

revision_specific_binaries.extend(self.__always_valid_mappings)
Expand Down
12 changes: 7 additions & 5 deletions varats/varats/data/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def gini_coefficient(distribution: pd.Series) -> float:
Calculates the Gini coefficient of the data.
For more information see online
`gini coefficient <https://en.wikipedia.org/wiki/Gini_coefficient>`_.
`Gini coefficient <https://en.wikipedia.org/wiki/Gini_coefficient>`_.
Args:
distribution: sorted series to calculate the Gini coefficient for
Expand Down Expand Up @@ -141,10 +141,12 @@ class ConfusionMatrix(tp.Generic[T]):
"""
Helper class to automatically calculate classification results.
| Predicted Positive (PP) | Predicted Negative (PN)
--------------------|---------------------------|--------------------------
Actual Positive (P) | True Positive (TP) | False Negative (FN)
Actual Negative (N) | False Positive (FP) | True Negative (TN)
+---------------------+-------------------------+-------------------------+
| | Predicted Positive (PP) | Predicted Negative (PN) |
+---------------------+-------------------------+-------------------------+
| Actual Positive (P) | True Positive (TP) | False Negative (FN) |
| Actual Negative (N) | False Positive (FP) | True Negative (TN) |
+---------------------+-------------------------+-------------------------+
Reference: https://en.wikipedia.org/wiki/Precision_and_recall
"""
Expand Down

0 comments on commit dfb6bac

Please sign in to comment.