diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-04-29 09:54:55 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-04-29 09:54:55 +0200 |
commit | 4b79b253d268652a1ae7239b564aaff9c2871589 (patch) | |
tree | 9436545560fe8dccbb515b406204468e2d28e6ac | |
parent | 4f43ceed98bc8f929facfd6c17f394de8ca1a588 (diff) |
Use relative module paths. PYTHONPATH=lib bin/... is no longer needed
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rwxr-xr-x | bin/analyze-archive.py | 12 | ||||
-rwxr-xr-x | bin/analyze-timing.py | 12 | ||||
-rwxr-xr-x | bin/cal-hist | 4 | ||||
-rwxr-xr-x | bin/eval-accounting-overhead.py | 2 | ||||
-rwxr-xr-x | bin/eval-online-model-accuracy.py | 6 | ||||
-rwxr-xr-x | bin/eval-outlier-removal.py | 3 | ||||
-rwxr-xr-x | bin/eval-rel-energy.py | 2 | ||||
-rwxr-xr-x | bin/generate-dfa-benchmark.py | 12 | ||||
-rwxr-xr-x | bin/generate-dummy-class.py | 6 | ||||
-rwxr-xr-x | bin/gptest.py | 2 | ||||
-rwxr-xr-x | bin/gradient | 4 | ||||
-rwxr-xr-x | bin/mim-vs-keysight.py | 4 | ||||
-rwxr-xr-x | bin/mimosa-etv | 4 | ||||
-rwxr-xr-x | bin/mimplot | 4 | ||||
-rwxr-xr-x | bin/test_corrcoef.py | 6 | ||||
-rwxr-xr-x | bin/workload.py | 6 | ||||
-rwxr-xr-x | lib/automata.py | 4 | ||||
-rw-r--r-- | lib/codegen.py | 4 | ||||
-rw-r--r-- | lib/data_parameters.py | 4 | ||||
-rw-r--r-- | lib/dfatool.py | 10 | ||||
-rw-r--r-- | lib/functions.py | 2 | ||||
-rw-r--r-- | lib/harness.py | 4 | ||||
-rw-r--r-- | lib/lex.py | 2 | ||||
-rw-r--r-- | lib/parameters.py | 5 | ||||
-rw-r--r-- | test/__init__.py | 0 | ||||
l--------- | test/dfatool | 1 | ||||
-rwxr-xr-x | test/test_codegen.py | 4 | ||||
-rwxr-xr-x | test/test_pta.py | 2 | ||||
-rwxr-xr-x | test/test_ptamodel.py | 2 | ||||
-rwxr-xr-x | test/test_timingharness.py | 4 |
31 files changed, 70 insertions, 69 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fcbbe3..f397fcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ run_tests: - wget -qO test-data/20190815_103347_nRF24_no-rx.json https://lib.finalrewind.org/energy-models/20190815_103347_nRF24_no-rx.json - wget -qO test-data/20190815_111745_nRF24_no-rx.json https://lib.finalrewind.org/energy-models/20190815_111745_nRF24_no-rx.json - wget -qO test-data/20190815_122531_nRF24_no-rx.json https://lib.finalrewind.org/energy-models/20190815_122531_nRF24_no-rx.json - - PYTHONPATH=lib pytest-3 --cov=lib + - pytest-3 --cov=lib - python3-coverage html artifacts: paths: diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index a70b23b..770e5d5 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -79,14 +79,14 @@ Options: import getopt import json -import plotter import re import sys -from dfatool import PTAModel, RawData, pta_trace_to_aggregate -from dfatool import gplearn_to_function -from dfatool import CrossValidator -from utils import filter_aggregate_by_param -from automata import PTA +from dfatool import plotter +from dfatool.dfatool import PTAModel, RawData, pta_trace_to_aggregate +from dfatool.dfatool import gplearn_to_function +from dfatool.dfatool import CrossValidator +from dfatool.utils import filter_aggregate_by_param +from dfatool.automata import PTA opts = {} diff --git a/bin/analyze-timing.py b/bin/analyze-timing.py index 9a3aa41..6a458d9 100755 --- a/bin/analyze-timing.py +++ b/bin/analyze-timing.py @@ -75,14 +75,14 @@ Options: import getopt import json -import plotter import re import sys -from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate -from dfatool import gplearn_to_function -from dfatool import CrossValidator -from utils import filter_aggregate_by_param -from parameters import prune_dependent_parameters +from dfatool import plotter +from dfatool.dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate +from dfatool.dfatool import gplearn_to_function +from dfatool.dfatool import CrossValidator +from dfatool.utils import filter_aggregate_by_param +from dfatool.parameters import prune_dependent_parameters opts = {} diff --git a/bin/cal-hist b/bin/cal-hist index f615c57..ba2ff47 100755 --- a/bin/cal-hist +++ b/bin/cal-hist @@ -7,8 +7,8 @@ import struct import sys import tarfile import matplotlib.pyplot as plt -from dfatool import MIMOSA -from utils import running_mean +from dfatool.dfatool import MIMOSA +from dfatool.utils import running_mean voltage = float(sys.argv[1]) shunt = float(sys.argv[2]) diff --git a/bin/eval-accounting-overhead.py b/bin/eval-accounting-overhead.py index 9f1e98c..d4b1d2c 100755 --- a/bin/eval-accounting-overhead.py +++ b/bin/eval-accounting-overhead.py @@ -13,7 +13,7 @@ providing overhead per transition and getEnergy overhead """ -from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate +from dfatool.dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate import json import sys diff --git a/bin/eval-online-model-accuracy.py b/bin/eval-online-model-accuracy.py index b4c137e..21e7a1e 100755 --- a/bin/eval-online-model-accuracy.py +++ b/bin/eval-online-model-accuracy.py @@ -26,9 +26,9 @@ import re import sys import itertools import yaml -from automata import PTA -from codegen import get_simulated_accountingmethod -from dfatool import regression_measures +from dfatool.automata import PTA +from dfatool.codegen import get_simulated_accountingmethod +from dfatool.dfatool import regression_measures import numpy as np opt = dict() diff --git a/bin/eval-outlier-removal.py b/bin/eval-outlier-removal.py index 2bf8072..3a4aa28 100755 --- a/bin/eval-outlier-removal.py +++ b/bin/eval-outlier-removal.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 import getopt -import plotter import re import sys -from dfatool import PTAModel, RawData, soft_cast_int, pta_trace_to_aggregate +from dfatool.dfatool import PTAModel, RawData, pta_trace_to_aggregate opts = {} diff --git a/bin/eval-rel-energy.py b/bin/eval-rel-energy.py index 4803c51..6ae35e0 100755 --- a/bin/eval-rel-energy.py +++ b/bin/eval-rel-energy.py @@ -3,7 +3,7 @@ import getopt import re import sys -from dfatool import PTAModel, RawData, pta_trace_to_aggregate +from dfatool.dfatool import PTAModel, RawData, pta_trace_to_aggregate opts = {} diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py index 1fa1a54..e2de955 100755 --- a/bin/generate-dfa-benchmark.py +++ b/bin/generate-dfa-benchmark.py @@ -61,17 +61,17 @@ import getopt import json import os import re -import runner import sys import tarfile import time import io import yaml -from aspectc import Repo -from automata import PTA -from codegen import get_accountingmethod, MultipassDriver -from harness import OnboardTimerHarness, TransitionHarness -from utils import flatten +from dfatool import runner +from dfatool.aspectc import Repo +from dfatool.automata import PTA +from dfatool.codegen import get_accountingmethod, MultipassDriver +from dfatool.harness import OnboardTimerHarness, TransitionHarness +from dfatool.utils import flatten opt = dict() diff --git a/bin/generate-dummy-class.py b/bin/generate-dummy-class.py index 2200486..15cc147 100755 --- a/bin/generate-dummy-class.py +++ b/bin/generate-dummy-class.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 -from aspectc import Repo -from codegen import MultipassDriver -from automata import PTA +from dfatool.aspectc import Repo +from dfatool.codegen import MultipassDriver +from dfatool.automata import PTA import yaml with open('/home/derf/var/projects/multipass/model/driver/nrf24l01.dfa', 'r') as f: diff --git a/bin/gptest.py b/bin/gptest.py index dd29a2a..869328e 100755 --- a/bin/gptest.py +++ b/bin/gptest.py @@ -2,7 +2,7 @@ import sys import numpy as np -from dfatool import PTAModel, RawData, regression_measures, pta_trace_to_aggregate +from dfatool.dfatool import PTAModel, RawData, regression_measures, pta_trace_to_aggregate from gplearn.genetic import SymbolicRegressor from multiprocessing import Pool diff --git a/bin/gradient b/bin/gradient index eb79b25..8280794 100755 --- a/bin/gradient +++ b/bin/gradient @@ -7,8 +7,8 @@ import struct import sys import tarfile import matplotlib.pyplot as plt -from dfatool import MIMOSA -from utils import running_mean +from dfatool.dfatool import MIMOSA +from dfatool.utils import running_mean voltage = float(sys.argv[1]) shunt = float(sys.argv[2]) diff --git a/bin/mim-vs-keysight.py b/bin/mim-vs-keysight.py index df37d8b..d1ff4e6 100755 --- a/bin/mim-vs-keysight.py +++ b/bin/mim-vs-keysight.py @@ -3,8 +3,8 @@ import numpy as np import sys import matplotlib.pyplot as plt -from dfatool import MIMOSA, KeysightCSV -from utils import running_mean +from dfatool.dfatool import MIMOSA, KeysightCSV +from dfatool.utils import running_mean voltage = float(sys.argv[1]) shunt = float(sys.argv[2]) diff --git a/bin/mimosa-etv b/bin/mimosa-etv index 417f1cf..e23b46c 100755 --- a/bin/mimosa-etv +++ b/bin/mimosa-etv @@ -8,8 +8,8 @@ import numpy as np import os import re import sys -from dfatool import aggregate_measures, MIMOSA -from utils import running_mean +from dfatool.dfatool import aggregate_measures, MIMOSA +from dfatool.utils import running_mean opt = dict() diff --git a/bin/mimplot b/bin/mimplot index cd71a4f..2a888ee 100755 --- a/bin/mimplot +++ b/bin/mimplot @@ -9,8 +9,8 @@ import struct import sys import tarfile import matplotlib.pyplot as plt -from dfatool import MIMOSA -from utils import running_mean +from dfatool.dfatool import MIMOSA +from dfatool.utils import running_mean opt = dict() diff --git a/bin/test_corrcoef.py b/bin/test_corrcoef.py index 593eb51..835e086 100755 --- a/bin/test_corrcoef.py +++ b/bin/test_corrcoef.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 import getopt -import plotter import re import sys -from dfatool import PTAModel, RawData, pta_trace_to_aggregate -from dfatool import soft_cast_int, is_numeric, gplearn_to_function +from dfatool import plotter +from dfatool.dfatool import PTAModel, RawData, pta_trace_to_aggregate +from dfatool.dfatool import gplearn_to_function opts = {} diff --git a/bin/workload.py b/bin/workload.py index c78e9a8..6199394 100755 --- a/bin/workload.py +++ b/bin/workload.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -from automata import PTA import sys -from utils import human_readable -from lex import TimedSequence, TimedWord, Workload +from dfatool.automata import PTA +from dfatool.utils import human_readable +from dfatool.lex import TimedSequence, TimedWord, Workload args = sys.argv[1:] diff --git a/lib/automata.py b/lib/automata.py index 2f893e6..8a43e8f 100755 --- a/lib/automata.py +++ b/lib/automata.py @@ -1,7 +1,7 @@ """Classes and helper functions for PTA and other automata.""" -from functions import AnalyticFunction, NormalizationFunction -from utils import is_numeric +from .functions import AnalyticFunction, NormalizationFunction +from .utils import is_numeric import itertools import numpy as np import json diff --git a/lib/codegen.py b/lib/codegen.py index 6e94bee..e0bf45f 100644 --- a/lib/codegen.py +++ b/lib/codegen.py @@ -1,7 +1,7 @@ """Code generators for multipass dummy drivers for online model evaluation.""" -from automata import PTA, Transition -from modular_arithmetic import simulate_int_type +from .automata import PTA, Transition +from .modular_arithmetic import simulate_int_type header_template = """ #ifndef DFATOOL_{name}_H diff --git a/lib/data_parameters.py b/lib/data_parameters.py index 7cb875d..3b7a148 100644 --- a/lib/data_parameters.py +++ b/lib/data_parameters.py @@ -5,8 +5,8 @@ Parameters include the amount of keys, length of strings (both keys and values), length of lists, ane more. """ -from protocol_benchmarks import codegen_for_lib -import cycles_to_energy, size_to_radio_energy, utils +from .protocol_benchmarks import codegen_for_lib +from . import cycles_to_energy, size_to_radio_energy, utils import numpy as np import ubjson diff --git a/lib/dfatool.py b/lib/dfatool.py index b206250..b41d399 100644 --- a/lib/dfatool.py +++ b/lib/dfatool.py @@ -12,11 +12,11 @@ import struct import tarfile import hashlib from multiprocessing import Pool -from functions import analytic -from functions import AnalyticFunction -from parameters import ParamStats -from utils import vprint, is_numeric, soft_cast_int, param_slice_eq, remove_index_from_tuple -from utils import by_name_to_by_param, match_parameter_values, running_mean +from .functions import analytic +from .functions import AnalyticFunction +from .parameters import ParamStats +from .utils import vprint, is_numeric, soft_cast_int, param_slice_eq, remove_index_from_tuple +from .utils import by_name_to_by_param, match_parameter_values, running_mean try: from pubcode import Code128 diff --git a/lib/functions.py b/lib/functions.py index 87fb2f0..2451ef6 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -8,7 +8,7 @@ from itertools import chain, combinations import numpy as np import re from scipy import optimize -from utils import is_numeric, vprint +from .utils import is_numeric, vprint arg_support_enabled = True diff --git a/lib/harness.py b/lib/harness.py index 59b5fa0..54518e3 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -3,9 +3,9 @@ Harnesses for various types of benchmark logs. tbd """ -import subprocess import re -from pubcode import Code128 +from .pubcode import Code128 + class TransitionHarness: """ @@ -1,4 +1,4 @@ -from sly import Lexer, Parser +from .sly import Lexer, Parser class TimedWordLexer(Lexer): diff --git a/lib/parameters.py b/lib/parameters.py index 00ae4aa..41e312a 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -3,8 +3,9 @@ import numpy as np from collections import OrderedDict from copy import deepcopy from multiprocessing import Pool -from utils import remove_index_from_tuple, is_numeric, is_power_of_two -from utils import filter_aggregate_by_param, by_name_to_by_param +from .utils import remove_index_from_tuple, is_numeric +from .utils import filter_aggregate_by_param, by_name_to_by_param + def distinct_param_values(by_name, state_or_tran): """ diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/__init__.py diff --git a/test/dfatool b/test/dfatool new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/test/dfatool @@ -0,0 +1 @@ +../lib
\ No newline at end of file diff --git a/test/test_codegen.py b/test/test_codegen.py index fb0d387..981117b 100755 --- a/test/test_codegen.py +++ b/test/test_codegen.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -from automata import PTA -from codegen import get_simulated_accountingmethod +from dfatool.automata import PTA +from dfatool.codegen import get_simulated_accountingmethod import unittest example_json_1 = { diff --git a/test/test_pta.py b/test/test_pta.py index cf8bce4..9f0778d 100755 --- a/test/test_pta.py +++ b/test/test_pta.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from automata import PTA +from dfatool.automata import PTA import unittest import yaml diff --git a/test/test_ptamodel.py b/test/test_ptamodel.py index 6bd2f6a..7d501e6 100755 --- a/test/test_ptamodel.py +++ b/test/test_ptamodel.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from dfatool import PTAModel, RawData, pta_trace_to_aggregate +from dfatool.dfatool import PTAModel, RawData, pta_trace_to_aggregate import os import unittest import pytest diff --git a/test/test_timingharness.py b/test/test_timingharness.py index 8d5ec20..c8a422c 100755 --- a/test/test_timingharness.py +++ b/test/test_timingharness.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -from dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate -from parameters import prune_dependent_parameters +from dfatool.dfatool import AnalyticModel, TimingData, pta_trace_to_aggregate +from dfatool.parameters import prune_dependent_parameters import unittest |