@explorable-viz/fluid 0.11.1 → 0.11.3

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 (75) hide show
  1. package/.spago/aff/v7.1.0/.editorconfig +13 -0
  2. package/.spago/aff/v7.1.0/.eslintrc.json +28 -0
  3. package/.spago/aff/v7.1.0/.gitignore +14 -0
  4. package/.spago/aff/v7.1.0/.tidyrc.json +10 -0
  5. package/.spago/argonaut-codecs/v9.1.0/.editorconfig +13 -0
  6. package/.spago/argonaut-codecs/v9.1.0/.gitignore +9 -0
  7. package/.spago/argonaut-codecs/v9.1.0/.tidyrc.json +10 -0
  8. package/.spago/arrays/v7.2.1/.eslintrc.json +26 -0
  9. package/.spago/arrays/v7.2.1/.gitignore +9 -0
  10. package/.spago/console/v6.1.0/.eslintrc.json +30 -0
  11. package/.spago/console/v6.1.0/.gitignore +9 -0
  12. package/.spago/debug/v6.0.2/.eslintrc.json +36 -0
  13. package/.spago/debug/v6.0.2/.gitignore +8 -0
  14. package/.spago/enums/v6.0.1/.gitignore +7 -0
  15. package/.spago/foreign-object/v4.1.0/.eslintrc.json +26 -0
  16. package/.spago/foreign-object/v4.1.0/.gitignore +8 -0
  17. package/.spago/free/v7.1.0/.gitignore +8 -0
  18. package/.spago/graphs/v8.1.0/.gitignore +7 -0
  19. package/.spago/js-uri/v3.1.0/.eslintrc.json +30 -0
  20. package/.spago/js-uri/v3.1.0/.gitignore +14 -0
  21. package/.spago/js-uri/v3.1.0/.tidyrc.json +10 -0
  22. package/.spago/node-buffer/v9.0.0/.eslintrc.json +26 -0
  23. package/.spago/node-buffer/v9.0.0/.gitignore +8 -0
  24. package/.spago/node-process/v11.2.0/.eslintrc.json +29 -0
  25. package/.spago/node-process/v11.2.0/.gitignore +8 -0
  26. package/.spago/node-streams/v9.0.0/.eslintrc.json +29 -0
  27. package/.spago/node-streams/v9.0.0/.gitignore +8 -0
  28. package/.spago/optparse/v6.0.0/.gitignore +8 -0
  29. package/.spago/optparse/v6.0.0/.npmrc +1 -0
  30. package/.spago/ordered-collections/v3.1.1/.gitignore +8 -0
  31. package/.spago/parallel/v7.0.0/.gitignore +7 -0
  32. package/.spago/parsing/v10.3.1/.editorconfig +13 -0
  33. package/.spago/parsing/v10.3.1/.gitignore +12 -0
  34. package/.spago/parsing/v10.3.1/.tidyoperators +231 -0
  35. package/.spago/parsing/v10.3.1/.tidyrc.json +10 -0
  36. package/.spago/prelude/v6.0.1/.eslintrc.json +26 -0
  37. package/.spago/prelude/v6.0.1/.gitignore +8 -0
  38. package/.spago/st/v6.2.0/.eslintrc.json +26 -0
  39. package/.spago/st/v6.2.0/.gitignore +8 -0
  40. package/.spago/strings/v6.0.1/.eslintrc.json +26 -0
  41. package/.spago/strings/v6.0.1/.gitignore +8 -0
  42. package/.spago/tailrec/v6.1.0/.gitignore +7 -0
  43. package/.spago/web-html/v4.1.0/.eslintrc.json +29 -0
  44. package/.spago/web-html/v4.1.0/.gitignore +8 -0
  45. package/.spago/web-xhr/v5.0.1/.eslintrc.json +29 -0
  46. package/.spago/web-xhr/v5.0.1/.gitignore +8 -0
  47. package/dist/fluid/fluid/lib/graphics.fld +130 -102
  48. package/dist/fluid/fluid/lib/matrix.fld +1 -1
  49. package/dist/fluid/fluid/lib/prelude.fld +50 -12
  50. package/dist/fluid/fluid/lib/stats.fld +6 -6
  51. package/dist/fluid/shared/fluid.mjs +21454 -26011
  52. package/dist/fluid/shared/load-figure.js +30116 -29574
  53. package/dist/fluid/shared/webtest-lib.js +3385 -3389
  54. package/package.json +1 -1
  55. package/website/article/.DS_Store +0 -0
  56. package/website/article/convolution/index.html +1 -1
  57. package/website/article/css/styles.css +4 -0
  58. package/website/article/css/view-styles.css +9 -2
  59. package/website/article/dataset/.DS_Store +0 -0
  60. package/website/article/energy-scatter/index.html +1 -1
  61. package/website/article/fluid/1805.02474v1-10.fld +21 -21
  62. package/website/article/fluid/bar-chart-line-chart.fld +7 -5
  63. package/website/article/fluid/convolution.fld +1 -1
  64. package/website/article/fluid/moving-average.fld +4 -4
  65. package/website/article/fluid/non-renewables.fld +7 -5
  66. package/website/article/index.html +19 -7
  67. package/website/article/methane/index.html +1 -1
  68. package/website/article/moving-average/index.html +1 -1
  69. package/website/article/non-renewables/index.html +1 -1
  70. package/website/article/renewables-linked/index.html +1 -1
  71. package/website/article/scigen-1805.02474v1-10/index.html +1 -1
  72. package/website/article/test.mjs +5 -5
  73. package/dist/fluid/fluid/lib/pi.fld +0 -1
  74. package/website/article/dataset/annual-temp-anomaly.json +0 -413
  75. package/website/article/dataset/ccra3-risks.json +0 -2015
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorable-viz/fluid",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "A functional programming language which integrates a bidirectional dynamic analysis, connecting outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.",
5
5
  "main": "index.js",
6
6
  "repository": {
Binary file
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  loadCode("../fluid/convolution.fld")()
94
- loadFigure(jsonSpec)("../fluid/convolution.fld")()
94
+ loadFigure(jsonSpec)("fig")("../fluid/convolution.fld")()
95
95
  </script>
96
96
  </body>
97
97
  </html>
@@ -279,6 +279,10 @@ nav ul li.active-page a {
279
279
  display: none;
280
280
  }
281
281
 
282
+ .data-pane {
283
+ padding-right: 0.25em;
284
+ }
285
+
282
286
  .data-pane * {
283
287
  font-size: 10pt;
284
288
  }
@@ -13,6 +13,10 @@
13
13
  font-size: 9pt;
14
14
  }
15
15
 
16
+ .table-caption {
17
+ border-bottom: 0.5px solid lightgray;
18
+ }
19
+
16
20
  .table-view th {
17
21
  font-size: 11px;
18
22
  text-align: left;
@@ -32,7 +36,6 @@ table {
32
36
  }
33
37
 
34
38
  thead {
35
- border-top: 0.5px solid lightgray;
36
39
  }
37
40
 
38
41
  .table-cell {
@@ -57,7 +60,6 @@ td.table-cell {
57
60
 
58
61
  .table-cell.selected-primary-transient {
59
62
  color: blue;
60
- font-weight: 600;
61
63
  }
62
64
 
63
65
  .table-cell.selected-secondary-transient {
@@ -72,6 +74,11 @@ td.table-cell {
72
74
  visibility: collapse;
73
75
  }
74
76
 
77
+ /* To hide a column, add 'hidden' to every cell in the column. visibility: collapse doesn't work here. */
78
+ .table-cell.hidden {
79
+ display: none;
80
+ }
81
+
75
82
  /* hack to match Safari-only */
76
83
  @supports (hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none) {
77
84
  .table-row.hidden {
@@ -41,7 +41,7 @@
41
41
  "linking": true
42
42
  }
43
43
 
44
- loadFigure(spec)("../fluid/energyscatter.fld")()
44
+ loadFigure(spec)("fig")("../fluid/energyscatter.fld")()
45
45
  </script>
46
46
  </body>
47
47
  </html>
@@ -12,35 +12,35 @@ def model_3_stacked_CNN: model("3 stacked CNN", tableData)
12
12
  def mostEfficient:
13
13
  findWithKey_("time_s", minimum(map(lambda y: y.time_s, tableData)), tableData)
14
14
 
15
- """As shown in Table 3, BiLSTM gives significantly
16
- ${trendWord(model_BiLSTM.acc, model_LSTM.acc, betterWorse)}
15
+ f"""As shown in Table 3, BiLSTM gives significantly
16
+ {trendWord(model_BiLSTM.acc, model_LSTM.acc, betterWorse)}
17
17
  accuracies compared to uni-directional LSTM2, with the training time per epoch
18
- ${trendWord(model_BiLSTM.time_s, model_LSTM.time_s, growShrink)} from
19
- ${model_LSTM.time_s} seconds to ${model_BiLSTM.time_s} seconds.
20
- Stacking 2 layers of BiLSTM gives ${trendWord(model_2_stacked_BiLSTM.acc, model_BiLSTM.acc, improvements)}
21
- to development results, with a ${trendWord(model_2_stacked_BiLSTM.time_s, model_BiLSTM.time_s, smallerHigher)}
22
- time of ${model_2_stacked_BiLSTM.time_s} seconds. 3 layers of stacked BiLSTM
23
- ${trendWord(model_3_stacked_BiLSTM.acc, model_BiLSTM.acc, improve)} the results.
24
- In contrast, S-LSTM gives a development result of ${model_S_LSTM.acc}%, which is significantly
25
- ${trendWord(model_S_LSTM.acc, model_2_stacked_BiLSTM.acc, betterWorse)}
18
+ {trendWord(model_BiLSTM.time_s, model_LSTM.time_s, growShrink)} from
19
+ {model_LSTM.time_s} seconds to {model_BiLSTM.time_s} seconds.
20
+ Stacking 2 layers of BiLSTM gives {trendWord(model_2_stacked_BiLSTM.acc, model_BiLSTM.acc, improvements)}
21
+ to development results, with a {trendWord(model_2_stacked_BiLSTM.time_s, model_BiLSTM.time_s, smallerHigher)}
22
+ time of {model_2_stacked_BiLSTM.time_s} seconds. 3 layers of stacked BiLSTM
23
+ {trendWord(model_3_stacked_BiLSTM.acc, model_BiLSTM.acc, improve)} the results.
24
+ In contrast, S-LSTM gives a development result of {model_S_LSTM.acc}%, which is significantly
25
+ {trendWord(model_S_LSTM.acc, model_2_stacked_BiLSTM.acc, betterWorse)}
26
26
  compared to 2-layer stacked BiLSTM, with a
27
- ${trendWord(model_S_LSTM.param, model_2_stacked_BiLSTM.param, smallerHigher)}
27
+ {trendWord(model_S_LSTM.param, model_2_stacked_BiLSTM.param, smallerHigher)}
28
28
  number of model parameters and a
29
- ${trendWord(model_S_LSTM.time_s, model_2_stacked_BiLSTM.time_s, shorterLonger)}
30
- time of ${model_S_LSTM.time_s} seconds. We additionally make comparisons with
29
+ {trendWord(model_S_LSTM.time_s, model_2_stacked_BiLSTM.time_s, shorterLonger)}
30
+ time of {model_S_LSTM.time_s} seconds. We additionally make comparisons with
31
31
  stacked CNNs and hierarchical attention (Vaswani et al., 2017), shown in Table 3 (the CNN and Transformer rows),
32
- ${mostEfficient.model} is the
33
- ${rankLabel("most efficient", findIndex("model", "CNN", insertionSort(lambda a, b: a.time_s < b.time_s, tableData)))}
32
+ {mostEfficient.model} is the
33
+ {rankLabel("most efficient", findIndex("model", "CNN", insertionSort(lambda a, b: a.time_s < b.time_s, tableData)))}
34
34
  among all models compared, with the
35
- ${rankLabel("smallest", findIndex("model", "CNN", insertionSort(lambda a, b: a.param < b.param, tableData)))}
35
+ {rankLabel("smallest", findIndex("model", "CNN", insertionSort(lambda a, b: a.param < b.param, tableData)))}
36
36
  model size. On the other hand, a 3-layer stacked CNN gives an accuracy of
37
- ${numToStr(model_3_stacked_CNN.acc)}%, which is also the
38
- ${rankLabel("lowest", findIndex("model", "CNN", insertionSort(lambda a, b: a.time_s < b.time_s, tableData)))}
37
+ {numToStr(model_3_stacked_CNN.acc)}%, which is also the
38
+ {rankLabel("lowest", findIndex("model", "CNN", insertionSort(lambda a, b: a.time_s < b.time_s, tableData)))}
39
39
  compared with BiLSTM, hierarchical attention and S-LSTM. The
40
- ${rankLabel("best", findIndex("model", "S-LSTM+Attention", insertionSort(lambda a, b: b.acc < a.acc, tableData)))}
40
+ {rankLabel("best", findIndex("model", "S-LSTM+Attention", insertionSort(lambda a, b: b.acc < a.acc, tableData)))}
41
41
  performance of hierarchical attention is obtained by S-LSTM+Attention in terms of both accuracy and efficiency.
42
- S-LSTM gives significantly ${trendWord(model_S_LSTM.acc, model_CNN.acc, betterWorse)}
42
+ S-LSTM gives significantly {trendWord(model_S_LSTM.acc, model_CNN.acc, betterWorse)}
43
43
  accuracies compared with both CNN and hierarchical attention. Table 3 additionally shows the results of
44
44
  BiLSTM and S-LSTM when external attention is used Attention leads to improved accuracies for both BiLSTM and
45
45
  S-LSTM in classification, with S-LSTM still
46
- ${trendWord(model_S_LSTM.acc, model_BiLSTM.acc, underOverPerforming)} BiLSTM significantly."""
46
+ {trendWord(model_S_LSTM.acc, model_BiLSTM.acc, underOverPerforming)} BiLSTM significantly."""
@@ -15,13 +15,15 @@ def series(energyType, country):
15
15
  if row.year == year if row.energyType == energyType if row.country == country
16
16
  ]
17
17
 
18
- MultiView({
19
- barChart: BarChart({
18
+ MultiView([
19
+ BarChart({
20
20
  caption: "Total renewables output by country",
21
21
  size: { width: 275, height: 185 },
22
- stackedBars: countryData
22
+ tickLabels: { x: Default, y: Default },
23
+ stackedBars: countryData,
24
+ legend: True
23
25
  }),
24
- lineChart: LineChart({
26
+ LineChart({
25
27
  tickLabels: { x: Default, y: Default },
26
28
  size: { width: 330, height: 285 },
27
29
  caption: "Renewables output of USA relative to China",
@@ -34,4 +36,4 @@ MultiView({
34
36
  for (usa, china) in [(series(energyType, "USA"), series(energyType, "China"))]
35
37
  ]
36
38
  })
37
- })
39
+ ])
@@ -19,7 +19,7 @@ def convolve(image, kernel):
19
19
  def area: i * j
20
20
 
21
21
  def interMatrix(m_, n_):
22
- # @doc("""average these values to compute element""")
22
+ # @doc(f"""average these values to compute element""")
23
23
  [| kernel!(i_, j_) *
24
24
  lookup(m_ + i_ - 1 - half_i, n_ + j_ - 1 - half_j, image)
25
25
  for (i_, j_) in (i, j) |]
@@ -4,11 +4,11 @@ def nthPad(n, xs):
4
4
  nth(min(max(n, 0), length(xs) - 1), xs)
5
5
  def movingAvg(ys, window):
6
6
  [sum([nthPad(n, ys) for n in [i - window .. i + window]]) / (1 + 2 * window) for i in [0 .. length(ys) - 1]]
7
- def movingAvg'(rs, window):
8
- zipWith((lambda x, y: { x: x, y: y }), map((lambda r: r.x), rs), movingAvg(map((lambda r: r.y), rs), window));
7
+ def movingAvg_(rs, window):
8
+ zipWith(lambda x, y: { x: x, y: y }, map(lambda r: r.x, rs), movingAvg(map(lambda r: r.y, rs), window))
9
9
 
10
10
  def points:
11
- [{ x: r.year, y: r.emissions } for r in methane if r.type == "Agriculture"];
11
+ [{ x: r.year, y: r.emissions } for r in methane if r.type == "Agriculture"]
12
12
 
13
13
  LineChart({
14
14
  tickLabels: { x: Rotated, y: Default },
@@ -17,7 +17,7 @@ LineChart({
17
17
  plots: [
18
18
  LinePlot({
19
19
  name: "Moving average",
20
- points: movingAvg'(points, 1)
20
+ points: movingAvg_(points, 1)
21
21
  }),
22
22
  LinePlot({ name: "Original curve", points: points })
23
23
  ]
@@ -14,13 +14,15 @@ def stack(year):
14
14
  def yearData(year):
15
15
  [row for row in nonRenewables if row.year == year if row.country |elem| countries]
16
16
 
17
- MultiView({
18
- barChart: BarChart({
17
+ MultiView([
18
+ BarChart({
19
19
  caption: "Non-renewables output",
20
20
  size: { width: 275, height: 185 },
21
- stackedBars: [{ x: numToStr(year), segments: stack(year) } for year in [2014 .. 2018]]
21
+ tickLabels: { x: Default, y: Default },
22
+ stackedBars: [{ x: numToStr(year), segments: stack(year) } for year in [2014 .. 2018]],
23
+ legend: True
22
24
  }),
23
- scatterPlot: ScatterPlot({
25
+ ScatterPlot({
24
26
  caption: "",
25
27
  points: [{
26
28
  x: sum([row.nuclearOut for row in yearData(year)]),
@@ -28,4 +30,4 @@ MultiView({
28
30
  } for year in [2014 .. 2018]],
29
31
  labels: { x: "Nuclear capacity", y: "Nuclear output" }
30
32
  })
31
- })
33
+ ])
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
- <title>Fluid Demo Articles</title>
7
+ <title>Fluid Demos</title>
8
8
  <link href="css/styles.css" rel="stylesheet" type="text/css">
9
9
  <script src="https://kit.fontawesome.com/20cf8b42c0.js" crossorigin="anonymous"></script>
10
10
  </head>
@@ -15,13 +15,25 @@
15
15
  <div></div>
16
16
  <div class="flex-left-align">
17
17
  <div></div>
18
- <h2>Fluid Demo Articles</h2>
18
+ <h2>Fluid: Transparent Research Outputs</h2>
19
19
 
20
- <a href="non-renewables">Non-renewable energy stacked bar chart/scatter plot</a><br>
21
- <a href="renewables-linked">Non-renewable energy bar chart/line chart</a><br>
22
- <a href="moving-average">Moving average</a><br>
23
- <a href="convolution">Matrix convolution</a><br>
24
- <a href="scigen-1805.02474v1-10">SciGen 1805.02474v1-10 benchmark</a><br>
20
+ <a href="renewables-linked">Transparent visualisations</a><br>
21
+ <ul>
22
+ <li>Linking visualisations to data</li>
23
+ <li>Transparent brushing-and-linking</li>
24
+ </ul>
25
+ <br>
26
+ <a href="convolution">Infrastructure for explorable explanations</a><br>
27
+ <ul>
28
+ <li>Visualising intermediate values</li>
29
+ <li>Literate execution</li>
30
+ </ul>
31
+ <br>
32
+ <a href="scigen-1805.02474v1-10">Transparent text</a><br>
33
+ <ul>
34
+ <li>Linking natural language to data</li>
35
+ <li>AI-assisted authoring tool</li>
36
+ </ul>
25
37
  </div>
26
38
  </div>
27
39
  </body>
@@ -40,7 +40,7 @@
40
40
  "linking": true
41
41
  }
42
42
 
43
- loadFigure(spec)("../fluid/methane.fld")()
43
+ loadFigure(spec)("fig")("../fluid/methane.fld")()
44
44
  </script>
45
45
  </body>
46
46
  </html>
@@ -58,7 +58,7 @@
58
58
  "linking": false
59
59
  }
60
60
 
61
- loadFigure(jsonSpec)("../fluid/moving-average.fld")()
61
+ loadFigure(jsonSpec)("fig")("../fluid/moving-average.fld")()
62
62
  </script>
63
63
  </body>
64
64
  </html>
@@ -46,7 +46,7 @@
46
46
  "query": false,
47
47
  "linking": true
48
48
  }
49
- loadFigure(jsonSpec)("../fluid/non-renewables.fld")()
49
+ loadFigure(jsonSpec)("fig")("../fluid/non-renewables.fld")()
50
50
  </script>
51
51
  </body>
52
52
  </html>
@@ -40,7 +40,7 @@
40
40
  "query": false,
41
41
  "linking": true
42
42
  }
43
- loadFigure(jsonSpec)("../fluid/bar-chart-line-chart.fld")()
43
+ loadFigure(jsonSpec)("fig")("../fluid/bar-chart-line-chart.fld")()
44
44
  </script>
45
45
  </body>
46
46
  </html>
@@ -48,7 +48,7 @@
48
48
  "linking": true
49
49
  }
50
50
 
51
- loadFigure(jsonSpec)("../fluid/1805.02474v1-10.fld")()
51
+ loadFigure(jsonSpec)("fig")("../fluid/1805.02474v1-10.fld")()
52
52
  </script>
53
53
  </body>
54
54
  </html>
@@ -1,14 +1,14 @@
1
- import { click, clickToggle, runTests, testURL, waitFor } from "./shared/webtest-lib.js"
1
+ import { runTests, testURL, waitFor } from "./shared/webtest-lib.js"
2
2
 
3
3
  export const main = async () => {
4
4
  await runTests(testURL("convolution")([ page => waitFor("svg#fig-output")(page) ]))()
5
5
  const point = "div#fig .scatterplot-point"
6
- await runTests(testURL("methane")([ page => waitFor("#fig > svg:nth-of-type(1)")(page) ]))()
6
+ await runTests(testURL("methane")([ page => waitFor("#fig svg:nth-of-type(1)")(page) ]))()
7
7
  await runTests(testURL("moving-average")([ page => waitFor("svg")(page) ]))()
8
8
  await runTests(testURL("non-renewables")([
9
- page => waitFor("#fig-output > svg:nth-child(1)")(page),
10
- page => waitFor("#fig-output > svg:nth-child(2)")(page),
9
+ page => waitFor("#fig-output > svg:nth-of-type(1)")(page),
10
+ page => waitFor("#fig-output > svg:nth-of-type(2)")(page),
11
11
  ]))()
12
- await runTests(testURL("renewables-linked")([page => waitFor("#fig-output > svg:nth-child(1)")(page)]))()
12
+ await runTests(testURL("renewables-linked")([page => waitFor("#fig-output > svg:nth-of-type(1)")(page)]))()
13
13
  await runTests(testURL("scigen-1805.02474v1-10")([ page => waitFor("div#fig-output")(page) ]))()
14
14
  }
@@ -1 +0,0 @@
1
- def pi: 3