scilens 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. scilens/LICENSE +37 -0
  2. scilens/__init__.py +1 -0
  3. scilens/app.py +9 -0
  4. scilens/cli/__init__.py +0 -0
  5. scilens/cli/cglb.py +10 -0
  6. scilens/cli/config.py +15 -0
  7. scilens/cli/info.py +12 -0
  8. scilens/cli/main.py +74 -0
  9. scilens/components/analyse_folder.py +4 -0
  10. scilens/components/compare_2_files.py +22 -0
  11. scilens/components/compare_errors.py +22 -0
  12. scilens/components/compare_floats.py +39 -0
  13. scilens/components/compare_folders.py +39 -0
  14. scilens/components/executor.py +58 -0
  15. scilens/components/file_reader.py +29 -0
  16. scilens/config/__init__.py +0 -0
  17. scilens/config/cli_run_options.py +8 -0
  18. scilens/config/env_var.py +3 -0
  19. scilens/config/load.py +40 -0
  20. scilens/config/models/__init__.py +12 -0
  21. scilens/config/models/app.py +9 -0
  22. scilens/config/models/compare.py +5 -0
  23. scilens/config/models/compare_float_thresholds.py +4 -0
  24. scilens/config/models/execute.py +4 -0
  25. scilens/config/models/execute_and_compare.py +4 -0
  26. scilens/config/models/file_reader.py +3 -0
  27. scilens/config/models/reader_format_csv.py +18 -0
  28. scilens/config/models/reader_format_txt.py +5 -0
  29. scilens/config/models/readers.py +4 -0
  30. scilens/config/models/report.py +6 -0
  31. scilens/config/models/report_html.py +6 -0
  32. scilens/config/models/report_output.py +4 -0
  33. scilens/helpers/assets.py +27 -0
  34. scilens/helpers/search_and_index.py +26 -0
  35. scilens/helpers/templates/index.html +20 -0
  36. scilens/helpers/templates/style.css +124 -0
  37. scilens/processors/__init__.py +3 -0
  38. scilens/processors/analyse.py +14 -0
  39. scilens/processors/compare.py +7 -0
  40. scilens/processors/execute_and_compare.py +17 -0
  41. scilens/processors/models/__init__.py +0 -0
  42. scilens/processors/models/results.py +2 -0
  43. scilens/processors/processor_interface.py +9 -0
  44. scilens/readers/__init__.py +0 -0
  45. scilens/readers/exceptions.py +1 -0
  46. scilens/readers/reader_com_txt_lines.py +2 -0
  47. scilens/readers/reader_csv.py +73 -0
  48. scilens/readers/reader_interface.py +15 -0
  49. scilens/readers/reader_manager.py +30 -0
  50. scilens/readers/reader_txt.py +82 -0
  51. scilens/readers/transform.py +8 -0
  52. scilens/report/__init__.py +0 -0
  53. scilens/report/assets/logo.svg +9 -0
  54. scilens/report/assets/logo_cglb.svg +1 -0
  55. scilens/report/assets.py +11 -0
  56. scilens/report/html_report.py +26 -0
  57. scilens/report/report.py +30 -0
  58. scilens/report/template.py +8 -0
  59. scilens/report/templates/body_01_title.html +61 -0
  60. scilens/report/templates/body_99_footer.html +11 -0
  61. scilens/report/templates/compare_11_summary.html +75 -0
  62. scilens/report/templates/compare_12_sections.html +150 -0
  63. scilens/report/templates/compare_13_section_numbers copy.html +48 -0
  64. scilens/report/templates/compare_13_section_numbers.html +91 -0
  65. scilens/report/templates/index.html +92 -0
  66. scilens/report/templates/js_chartlibs_echarts.js +34 -0
  67. scilens/report/templates/js_chartlibs_plotly.js +55 -0
  68. scilens/report/templates/js_com_dom.js +21 -0
  69. scilens/report/templates/js_com_page.js +199 -0
  70. scilens/report/templates/js_com_palette.js +7 -0
  71. scilens/report/templates/js_curvemgr.js +319 -0
  72. scilens/report/templates/style.css +144 -0
  73. scilens/report/templates/utils_compare_report_anim.js +73 -0
  74. scilens/report/templates/utils_compare_report_framesseries.js +143 -0
  75. scilens/report/vendors/tailwindcss_3_4_15.js +83 -0
  76. scilens/report/vendors/tailwindcss_min_4.0.0-beta.4.js +26 -0
  77. scilens/run/__init__.py +0 -0
  78. scilens/run/models/task_results.py +5 -0
  79. scilens/run/models/task_runtime.py +2 -0
  80. scilens/run/run_task.py +41 -0
  81. scilens/run/standalone_task_runner.py +9 -0
  82. scilens/run/task_context.py +12 -0
  83. scilens/run/tasks_collector.py +52 -0
  84. scilens/utils/dict.py +6 -0
  85. scilens/utils/file.py +43 -0
  86. scilens/utils/php.py +15 -0
  87. scilens/utils/system.py +2 -0
  88. scilens/utils/template.py +5 -0
  89. scilens/utils/time_tracker.py +6 -0
  90. scilens/utils/vectors.py +4 -0
  91. scilens/utils/web.py +20 -0
  92. scilens-0.1.0.dist-info/METADATA +44 -0
  93. scilens-0.1.0.dist-info/RECORD +95 -0
  94. scilens-0.1.0.dist-info/WHEEL +4 -0
  95. scilens-0.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,73 @@
1
+ const Anim = function (elt, options, options_2) {
2
+ const that = this;
3
+ // options
4
+ this.images = options.images;
5
+ this.len = this.images.length;
6
+ this.prefix = options.prefix || "";
7
+ this.suffix = options.suffix || "";
8
+ //
9
+ const width = options.width || 250;
10
+ console.log(options)
11
+ console.log(width)
12
+ const height = 250;
13
+ // index
14
+ this.index = 1
15
+ // elements
16
+ const img_size = `width:${width}px;`
17
+ // console.log(img_size)
18
+ if (options_2) {
19
+ dom.tree(
20
+ null,
21
+ {out:"root", tag:"div", style:`width:${width*3}px;`, children: [
22
+ {tag:"div", style:"display:table;width:100%;", children: [
23
+ {tag:"div", style:"display:table-cell;width:33.33%;", html:"Test"},
24
+ {tag:"div", style:"display:table-cell;width:33.33%;", html:"Reference"},
25
+ {tag:"div", style:"display:table-cell;width:33.33%;", html:"Test vs Reference"},
26
+ ]},
27
+ {tag:"div", style:"display:table;", children: [
28
+ {tag:"div", style:"display:table-cell;width:33.33%;", children: [
29
+ {out:"img", tag:"img", style:img_size},
30
+ ]},
31
+ {tag:"div", style:"display:table-cell;width:33.33%;", children: [
32
+ {out:"img_2", tag:"img", style:img_size},
33
+ ]},
34
+ {tag:"div", style:"display:table-cell;width:33.33%;", children: [
35
+ {out:"img_o_1", tag:"img", style:"position:absolute;opacity:0.5;"+img_size},
36
+ {out:"img_o_2", tag:"img", style:"position:absolute;opacity:0.5;"+img_size},
37
+ ]},
38
+ ]},
39
+ {out:"sli", tag:"input", style:"width: 100%;", attrs: {"type":"range","value":this.index,"min":this.index,"max":this.len}},
40
+ {out:"lab", tag:"div", style:"text-align: center;"},
41
+ ]},
42
+ this
43
+ )
44
+ } else {
45
+ dom.tree(
46
+ null,
47
+ {out:"root", tag:"div", style:img_size, children: [
48
+ {out:"img", tag:"img", style:img_size},
49
+ {out:"sli", tag:"input", style:"width: 100%;", attrs: {"type":"range","value":this.index,"min":this.index,"max":this.len}},
50
+ {out:"lab", tag:"div", style:"text-align: center;"},
51
+ ]},
52
+ this
53
+ )
54
+ }
55
+ this.sli.addEventListener('input', function(){that.update();}, true);
56
+ this.update();
57
+ elt.appendChild(this.root);
58
+ };
59
+ Anim.prototype = {
60
+ update: function () {
61
+ const index = this.sli.value;
62
+ this.lab.innerHTML = String(index) + "/" + this.len;
63
+ // 1
64
+ const attrs = ["img", "img_2", "img_o_1", "img_o_2"];
65
+ for (const i in attrs) {
66
+ const e = this[attrs[i]]
67
+ if (e) { e.src = this.prefix + this.images[index-1] + this.suffix; }
68
+ }
69
+ },
70
+ };
71
+ Anim.create = function(parent, options, options_2) {
72
+ new Anim(parent, options, options_2)
73
+ }
@@ -0,0 +1,143 @@
1
+ const Framesseries = function (elt, data, data_ref) {
2
+ const that = this;
3
+ // data
4
+ this.data = data
5
+ this.data_ref = data_ref
6
+ // frames
7
+ const nb = data.variables.length;
8
+ this.size = 3000/nb;
9
+ this.frame_len = data.frames_variable.data.length;
10
+ this.frame_min = data.frames_variable.data[0];
11
+ this.frame_max = data.frames_variable.data[this.frame_len-1];
12
+ //
13
+ // const vars_templ = data.variables.map((x,i) => { return {out:"variable_"+i, tag:"div", style:"width: 600px; height: 400px;"} ; } );
14
+
15
+ const vars_templ = data.variables.map((x,i) => { return {out:"variable_"+i, tag:"div", style:"width:"+this.size+"px;height:"+this.size+"px;"} ; } );
16
+ //
17
+ // frames_steps_variable
18
+ this.steps = null;
19
+ let dom_steps = null;
20
+ if (data.frames_steps_variable) {
21
+ // steps
22
+ const steps = []
23
+ data.frames_steps_variable.data.forEach((e,i) => {
24
+ console.log(e)
25
+ steps.push({
26
+ start: e,
27
+ color: palette.get(i),
28
+ })
29
+ });
30
+ this.steps = steps;
31
+ // dom
32
+ const divs = []
33
+ steps.forEach((s,i) => {
34
+ if (s.start >= this.frame_max) return;
35
+ const start = (s.start < this.frame_min) ? this.frame_min : s.start;
36
+ let stop = (i+1 < steps.length) ? steps[i+1].start : this.frame_max;
37
+ if (stop < this.frame_min) return;
38
+ if (stop > this.frame_max) stop = this.frame_max;
39
+
40
+ const m = ( ! divs.length && start > this.frame_min) ? "margin-left:"+(100*(start-this.frame_min)/(this.frame_max-this.frame_min))+"%;" : "";
41
+ divs.push({tag:"div", style:"display: inline-block;"+m+"width: "+(100*(stop-start)/(this.frame_max-this.frame_min))+"%; height: 15px; background-color: "+s.color+";"});
42
+ });
43
+
44
+ dom_steps = {tag:"div", style:"", children: [
45
+ // {tag:"div", style:"", html: "ttiti"},
46
+ {out:"step_label", tag:"div", style:"text-align: center;"},
47
+ {tag:"div", style:"height:15px;background-color:#eee;", children: divs},
48
+ ]}
49
+ }
50
+ //
51
+ dom.tree(
52
+ null,
53
+ {out:"root", tag:"div", children: [
54
+ {tag:"div", style:"", children: [
55
+ {out:"plus", tag:"button", html: '+ Increase' },
56
+ {out:"minus", tag:"button", html: '- Decrease' },
57
+ ]},
58
+ dom_steps,
59
+ {out:"sli", tag:"input", style:"width: 100%;", attrs: {"type":"range","value":1,"min":1,"max":this.frame_len}},
60
+ {out:"lab", tag:"div", style:"text-align: center;"},
61
+ {tag:"div", style:"display: flex; flex-wrap: wrap;", children: vars_templ},
62
+ ]},
63
+ this
64
+ );
65
+ this.sli.addEventListener('input', function(){that.update();}, true);
66
+ this.plus.addEventListener('click', function(){that.resize(1);}, true);
67
+ this.minus.addEventListener('click', function(){that.resize(-1);}, true);
68
+
69
+ elt.appendChild(this.root);
70
+
71
+ // create curves
72
+ data.variables.forEach((variable,i) => {
73
+ // check names ??
74
+ // variable.name == data_ref.variables[i].name
75
+ chartlibs.plotly.add_ys(
76
+ that["variable_"+i],
77
+ { title: variable.name, xaxis: "Indexes" , yaxis: "Values " + variable.unit },
78
+ variable.data[0].map((x,i) => parseInt(i)+1 ),
79
+ [
80
+ { name: "Test" , data: variable.data[0] },
81
+ { name: "Reference" , data: data_ref.variables[i].data[0] },
82
+ ]
83
+ )
84
+ });
85
+ this.update();
86
+ };
87
+ Framesseries.prototype = {
88
+ resize: function (direction) {
89
+ const that = this;
90
+ // myDiv.style.height
91
+ this.size = this.size + (direction * this.size * 0.1);
92
+ var update = {
93
+ width: this.size,
94
+ height: this.size,
95
+ };
96
+ this.data.variables.forEach((variable,i) => {
97
+ that["variable_"+i].style.width = that.size + "px";
98
+ that["variable_"+i].style.height = that.size + "px";
99
+ Plotly.relayout(that["variable_"+i], update);
100
+ });
101
+
102
+ },
103
+ update: function () {
104
+ const labels = []
105
+ const that = this;
106
+ // frames
107
+ const index = this.sli.value;
108
+ const frame_val = this.data.frames_variable.data[index-1];
109
+ const label = this.data.frames_variable.name + (this.data.frames_variable.unit ? " (" + this.data.frames_variable.unit + ")" : "");
110
+ labels.push({label: label, val: frame_val, max: this.frame_max})
111
+ labels.push({label: "Frame", val: index, max: this.frame_len})
112
+ // curves
113
+ this.data.variables.forEach((variable,i) => {
114
+ chartlibs.plotly.upd_y_all(
115
+ that["variable_"+i],
116
+ [variable.data[index-1], that.data_ref.variables[i].data[index-1]],
117
+ )
118
+ });
119
+ // steps
120
+ if (this.steps) {
121
+ const steps = this.steps
122
+ let step = 0
123
+ let color = ""
124
+ let val2 = null
125
+ for (let i=0; i<steps.length; i++) {
126
+ if (frame_val >= steps[i].start) {
127
+ step = i+1
128
+ color = steps[i].color
129
+ val2 = steps[i].start
130
+ }
131
+ }
132
+ labels.push({label: "Step", val: step, max: steps.length, color: color, val2: val2})
133
+ }
134
+ // labels
135
+ console.log(labels)
136
+ this.lab.innerHTML = labels.map(x => '<span style="padding:3px 5px;background-color:'+x.color+';"><b> ' + x.label + "</b> " + x.val + "/" + x.max + ( x.val2 ? " (" + x.val2 + ")" : "") +"</span>").join(" - ");
137
+
138
+
139
+ },
140
+ };
141
+ Framesseries.create = function(parent, options, options_2) {
142
+ new Framesseries(parent, options, options_2)
143
+ }