diff options
author | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2019-08-20 17:13:46 -0400 |
---|---|---|
committer | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2019-08-20 17:13:46 -0400 |
commit | 8ca4668275e7f9298b9960acc66373aa94650453 (patch) | |
tree | 761e1561741a082fa2d278b31be654f426d31359 /Metrics/Metrics-Calculation/metrics_plot/utils | |
parent | modifty patterns for ecore (diff) | |
download | VIATRA-Generator-8ca4668275e7f9298b9960acc66373aa94650453.tar.gz VIATRA-Generator-8ca4668275e7f9298b9960acc66373aa94650453.tar.zst VIATRA-Generator-8ca4668275e7f9298b9960acc66373aa94650453.zip |
changes in settings of measurements
Diffstat (limited to 'Metrics/Metrics-Calculation/metrics_plot/utils')
3 files changed, 17 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py index 41054294..48d96ccc 100644 --- a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py +++ b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py | |||
@@ -12,6 +12,8 @@ class GraphCollection: | |||
12 | self.mpcs = [] | 12 | self.mpcs = [] |
13 | self.nts = [] | 13 | self.nts = [] |
14 | self.name = name | 14 | self.name = name |
15 | self.tccs = [] | ||
16 | self.violations = [] | ||
15 | models = reader.readmultiplefiles(path, number, shouldShuffle) | 17 | models = reader.readmultiplefiles(path, number, shouldShuffle) |
16 | print(len(models)) | 18 | print(len(models)) |
17 | self.size = len(models) | 19 | self.size = len(models) |
@@ -22,6 +24,10 @@ class GraphCollection: | |||
22 | self.mpcs.append(mpc) | 24 | self.mpcs.append(mpc) |
23 | if(constants.Node_TYPE_KEY in contents): | 25 | if(constants.Node_TYPE_KEY in contents): |
24 | self.nts.append(contents[constants.Node_TYPE_KEY]) | 26 | self.nts.append(contents[constants.Node_TYPE_KEY]) |
27 | if(constants.TCC_VALUE in contents): | ||
28 | self.tccs.append(contents[constants.TCC_VALUE]) | ||
29 | if(constants.VIOLATION in contents): | ||
30 | self.violations.append(contents[constants.VIOLATION][0]) | ||
25 | 31 | ||
26 | #Graph stat for one graph | 32 | #Graph stat for one graph |
27 | class GraphStat: | 33 | class GraphStat: |
@@ -35,4 +41,6 @@ class GraphStat: | |||
35 | self.nodeTypeStat = contents[constants.Node_TYPE_KEY] | 41 | self.nodeTypeStat = contents[constants.Node_TYPE_KEY] |
36 | if constants.VIOLATION in contents: | 42 | if constants.VIOLATION in contents: |
37 | self.violations = int(contents[constants.VIOLATION][0]) | 43 | self.violations = int(contents[constants.VIOLATION][0]) |
44 | if(constants.TCC_VALUE_KEY in contents): | ||
45 | self.tcc = contents[constants.TCC_VALUE_KEY] | ||
38 | 46 | ||
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py b/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py index be115a05..e30cc583 100644 --- a/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py +++ b/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py | |||
@@ -30,3 +30,6 @@ HUMAN_NA_REP = '../input/humanOutput/R_2017419_run_1.csv' | |||
30 | 30 | ||
31 | VIOLATION = 'violations' | 31 | VIOLATION = 'violations' |
32 | 32 | ||
33 | TCC_VALUE= 'TCCValue' | ||
34 | |||
35 | TCC_COUNT = 'TCCCount' | ||
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py b/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py index 394168d8..a56caf45 100644 --- a/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py +++ b/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py | |||
@@ -33,6 +33,8 @@ def readcsvfile(filename): | |||
33 | #convert number to floats | 33 | #convert number to floats |
34 | numbers = [float(n) for n in numbers] | 34 | numbers = [float(n) for n in numbers] |
35 | contents[constants.Node_TYPE_KEY] = {t : n for t, n in zip(types, numbers)} | 35 | contents[constants.Node_TYPE_KEY] = {t : n for t, n in zip(types, numbers)} |
36 | elif(arr[0] == constants.TCC_VALUE): | ||
37 | contents[constants.TCC_VALUE] = list(map(float, arr[1:])) | ||
36 | # NA and OD are integers, and store other information as string | 38 | # NA and OD are integers, and store other information as string |
37 | else: | 39 | else: |
38 | try: | 40 | try: |
@@ -79,6 +81,10 @@ def getmetrics(filename): | |||
79 | outdegree_sample = reproduceSample(contents[constants.OUT_DEGREE_VALUE], contents[constants.OUT_DEGREE_COUNT]) | 81 | outdegree_sample = reproduceSample(contents[constants.OUT_DEGREE_VALUE], contents[constants.OUT_DEGREE_COUNT]) |
80 | na_sample = reproduceSample(contents[constants.NA_VALUE], contents[constants.NA_COUNT]) | 82 | na_sample = reproduceSample(contents[constants.NA_VALUE], contents[constants.NA_COUNT]) |
81 | mpc_sample = reproduceSample(contents[constants.MPC_VALUE], contents[constants.MPC_COUNT]) | 83 | mpc_sample = reproduceSample(contents[constants.MPC_VALUE], contents[constants.MPC_COUNT]) |
84 | |||
85 | if(constants.TCC_VALUE in contents): | ||
86 | contents[constants.TCC_VALUE] = reproduceSample(contents[constants.TCC_VALUE], contents[constants.TCC_COUNT]) | ||
87 | |||
82 | return contents,outdegree_sample, na_sample, mpc_sample | 88 | return contents,outdegree_sample, na_sample, mpc_sample |
83 | 89 | ||
84 | # | 90 | # |