@datagrok/compute 0.5.1 → 0.6.1

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.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "0.5.1",
4
+ "version": "0.6.1",
5
5
  "description": "",
6
6
  "dependencies": {
7
7
  "cash-dom": "latest",
8
8
  "codemirror": "^5.64.0",
9
- "datagrok-api": ">=0.98.0",
9
+ "datagrok-api": ">=0.99.0",
10
10
  "dayjs": "latest",
11
11
  "exceljs": "^4.3.0",
12
12
  "file-saver": "^2.0.5",
package/scripts/pMax.js CHANGED
@@ -2,8 +2,8 @@
2
2
  //description: pMax Filtration Model
3
3
  //language: javascript
4
4
  //tags: model, filtration
5
- //input: dataframe inputTable [Should contain columns Time (min), Vol (mL), P1 (psi), P2 (psi)]
6
- //input: dataframe inputParametersForReporting
5
+ //input: dataframe inputTable {caption: Input Table; viewer: Grid()} [Should contain columns Time (min), Vol (mL), P1 (psi), P2 (psi)]
6
+ //input: dataframe reportingParameters {caption: Reporting Parameters; viewer: Grid()}
7
7
  //input: double batchVolume = 100 {units: L} [Batch Volume]
8
8
  //input: double batchTime = 2 {units: hours} [Batch Time]
9
9
  //input: double targetPressure = 20 {units: psi} [Target Pressure]
@@ -12,13 +12,12 @@
12
12
  //input: double filterArea1 = 23 {units: m²; caption: A_trial Filter 1} [A_trial Filter 1]
13
13
  //input: double filterArea2 = 23 {units: m²; caption: A_trial Filter 2} [A_trial Filter 2]
14
14
  //input: double sf = 1.5 {caption: Safety Factor}
15
- //meta.showInputs: true
16
- //output: dataframe Filter1 {viewer: Scatter Plot(x: "TP 1 (L/m2)", y: "Res. 1 (psi/LMH)", showDataframeFormulaLines: "true"); category: OUTPUT}
17
- //output: dataframe t1 {category: OUTPUT}
18
- //output: dataframe Guessed1 {category: OUTPUT}
19
- //output: dataframe Filter2 {viewer: Scatter Plot(x: "TP 2 (L/m2)", y: "Res. 2 (psi/LMH)", showDataframeFormulaLines: "true"); category: OUTPUT}
20
- //output: dataframe t2 {category: OUTPUT}
21
- //output: dataframe Guessed2 {category: OUTPUT}
15
+ //output: dataframe Filter1 {caption: Primary Filter; viewer: Scatter Plot(showDataframeFormulaLines: "true"); category: OUTPUT}
16
+ //output: dataframe t1 {caption: Primary Filter Results; category: OUTPUT}
17
+ //output: dataframe Guessed1 {caption: Guessed Primary Filter; category: OUTPUT}
18
+ //output: dataframe Filter2 {caption: Secondary Filter; viewer: Scatter Plot(showDataframeFormulaLines: "true"); category: OUTPUT}
19
+ //output: dataframe t2 {caption: Secondary Filter Results; category: OUTPUT}
20
+ //output: dataframe Guessed2 {caption: Guessed Secondary Filter; category: OUTPUT}
22
21
 
23
22
  function gaussianElimination(input, orderOfPolynomialRegression) {
24
23
  const n = input.length - 1, coefficients = [orderOfPolynomialRegression];
@@ -67,13 +66,13 @@ function polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegressio
67
66
  }
68
67
 
69
68
  function predictPolynomialRegression(coefficients, x) {
70
- let result = coefficients[0];
69
+ let y = coefficients[0];
71
70
  for (let i = coefficients.length - 1; i > 0; i--)
72
- result += coefficients[i] * Math.pow(x, i);
73
- return result;
71
+ y += coefficients[i] * Math.pow(x, i);
72
+ return y;
74
73
  }
75
74
 
76
- function equasionString(xColName, yColName, coefficients) {
75
+ function equationString(xColName, yColName, coefficients) {
77
76
  let s = '';
78
77
  for (let [index, coefficient] of coefficients.slice(1).reverse().entries()) {
79
78
  s += String(coefficient);
@@ -120,23 +119,21 @@ Filter1 = DG.DataFrame.fromColumns([df1.col(colNames1['tp1']), df1.col(colNames1
120
119
  Filter2 = DG.DataFrame.fromColumns([df1.col(colNames1['tp2']), df1.col(colNames1['res2'])]);
121
120
  const coefficients1 = polynomialRegressionCoefficients(df1.col(colNames1['tp1']), df1.col(colNames1['res1']), orderOfPolynomialRegression);
122
121
  const coefficients2 = polynomialRegressionCoefficients(df1.col(colNames1['tp2']), df1.col(colNames1['res2']), orderOfPolynomialRegression);
123
- // alert(equasionString(colNames1['tp1'], colNames1['res1'], coefficients1))
124
- // alert(equasionString(colNames1['tp2'], colNames1['res2'], coefficients2))
125
122
 
126
123
  Filter1.meta.addFormulaLine({
127
- title: 'Parabola',
128
- equation: equasionString(colNames1['tp1'], colNames1['res1'], coefficients1),
124
+ title: 'Third-order polynomial regression',
125
+ equation: equationString(colNames1['tp1'], colNames1['res1'], coefficients1),
129
126
  zindex: -30,
130
127
  color: '#ff0000',
131
- width: 2
128
+ width: 3
132
129
  });
133
130
 
134
131
  Filter2.meta.addFormulaLine({
135
- title: 'Parabola',
136
- equation: equasionString(colNames1['tp2'], colNames1['res2'], coefficients2),
132
+ title: 'Third-order polynomial regression',
133
+ equation: equationString(colNames1['tp2'], colNames1['res2'], coefficients2),
137
134
  zindex: -30,
138
135
  color: '#ff0000',
139
- width: 2
136
+ width: 3
140
137
  });
141
138
 
142
139
  const df2 = DG.DataFrame.create(lengthOfSecondTable);
@@ -171,21 +168,37 @@ guessedMaxP2 = predictPolynomialRegression(coefficients2, processLoading2) * pro
171
168
  guessedProcessFlux1 = processFlow1 / aMinFilter1Guessed, guessedProcessFlux2 = processFlow2 / aMinFilter2Guessed;
172
169
 
173
170
  t1 = DG.DataFrame.fromColumns([
174
- DG.Column.fromList('string', 'Parameter', ['amin', 'aminSF', 'trialLoading', 'processLoading', 'maxP', 'trialFlux', 'processFlux', 'processFlow']),
175
- DG.Column.fromList('double', 'Value', [amin1, aminSF1, trialLoading1, processLoading1, maxP1, trialFlux1, processFlux1, processFlow1])
171
+ DG.Column.fromFloat32Array('Amin (m²)', [amin1]),
172
+ DG.Column.fromFloat32Array('Amin w SF (m²)', [aminSF1]),
173
+ DG.Column.fromFloat32Array('Trial Loading (L/m²)', [trialLoading1]),
174
+ DG.Column.fromFloat32Array('Process Loading (L/m²)', [processLoading1]),
175
+ DG.Column.fromFloat32Array('Max P (psi)', [maxP1]),
176
+ DG.Column.fromFloat32Array('Trial Flux (LMH)', [trialFlux1]),
177
+ DG.Column.fromFloat32Array('Process Flux (LMH)', [processFlux1]),
178
+ DG.Column.fromFloat32Array('Process Flow (L/hr)', [processFlow1])
176
179
  ]);
177
180
 
178
181
  t2 = DG.DataFrame.fromColumns([
179
- DG.Column.fromList('string', 'Parameter', ['amin', 'aminSF', 'trialLoading', 'processLoading', 'maxP', 'trialFlux', 'processFlux', 'processFlow']),
180
- DG.Column.fromList('double', 'Value', [amin2, aminSF2, trialLoading2, processLoading2, maxP2, trialFlux2, processFlux2, processFlow2])
182
+ DG.Column.fromFloat32Array('Amin (m²)', [amin2]),
183
+ DG.Column.fromFloat32Array('Amin w SF (m²)', [aminSF2]),
184
+ DG.Column.fromFloat32Array('Trial Loading (L/m²)', [trialLoading2]),
185
+ DG.Column.fromFloat32Array('Process Loading (L/m²)', [processLoading2]),
186
+ DG.Column.fromFloat32Array('Max P (psi)', [maxP2]),
187
+ DG.Column.fromFloat32Array('Trial Flux (LMH)', [trialFlux2]),
188
+ DG.Column.fromFloat32Array('Process Flux (LMH)', [processFlux2]),
189
+ DG.Column.fromFloat32Array('Process Flow (L/hr)', [processFlow2])
181
190
  ]);
182
191
 
183
192
  Guessed1 = DG.DataFrame.fromColumns([
184
- DG.Column.fromList('string', 'Parameter', ['amin', 'processLoading', 'maxP', 'processFlux']),
185
- DG.Column.fromList('double', 'Value', [guessedAmin1 , guessedProcessLoading1, guessedMaxP1, guessedProcessFlux1])
193
+ DG.Column.fromFloat32Array('Amin (m²)', [guessedAmin1]),
194
+ DG.Column.fromFloat32Array('Process Loading (L/m²)', [guessedProcessLoading1]),
195
+ DG.Column.fromFloat32Array('Max P (psi)', [guessedMaxP1]),
196
+ DG.Column.fromFloat32Array('Process Flux (LMH)', [guessedProcessFlux1]),
186
197
  ]);
187
198
 
188
199
  Guessed2 = DG.DataFrame.fromColumns([
189
- DG.Column.fromList('string', 'Parameter', ['amin', 'processLoading', 'maxP', 'processFlux']),
190
- DG.Column.fromList('double', 'Value', [guessedAmin2, guessedProcessLoading2, guessedMaxP2, guessedProcessFlux2])
200
+ DG.Column.fromFloat32Array('Amin (m²)', [guessedAmin2]),
201
+ DG.Column.fromFloat32Array('Process Loading (L/m²)', [guessedProcessLoading2]),
202
+ DG.Column.fromFloat32Array('Max P (psi)', [guessedMaxP2]),
203
+ DG.Column.fromFloat32Array('Process Flux (LMH)', [guessedProcessFlux2]),
191
204
  ]);
package/scripts/vMaxJS.js CHANGED
@@ -2,68 +2,58 @@
2
2
  //description: Predict the minimum filter size required for the separation of effluent from bioreactors, given the constraints of batch size and total batch time based on a training dataset of time vs filtrate volume for a given filter type, filter area and pressure
3
3
  //language: javascript
4
4
  //tags: model, filtration
5
- //input: dataframe inputTable {viewer: OutliersSelectionViewer() | Scatter Plot(color: "isOutlier", lassoTool: "true", legendVisibility: "Never", filterByZoom: "false") | Grid()}
6
- //input: dataframe inputParametersForReporting {viewer: Grid()}
7
- //input: double testArea = 3.5 {caption: Test Filter Area; units: cm²} [Test Filter area]
8
- //input: double vbatch = 25 {caption: Desired Volume of Batch; units: L} [Desired Volume of Batch]
9
- //input: double tbatch = 0.5 {caption: Desired process time; units: hr} [Desired process time]
5
+ //input: dataframe inputTable {viewer: OutliersSelectionViewer() | Scatter Plot(filter: "!${isOutlier}", showFilteredOutPoints: "true", filteredOutRowsColor: 4293991195, showRegressionLine: "true") | Grid()}
6
+ //input: dataframe reportingParameters {viewer: Grid()}
7
+ //input: double testFilterArea = 3.5 {caption: Test Filter Area; units: cm²} [Test Filter Area]
8
+ //input: double desiredVolumeOfBatch = 25 {caption: Desired Batch Volume; units: L} [Desired Batch Volume]
9
+ //input: double desiredProcessTime = 0.5 {caption: Desired Process Time; units: hr} [Desired Process Time]
10
10
  //input: double sf = 1.5 {caption: Safety Factor} [Safety Factor]
11
11
  //help-url: https://github.com/datagrok-ai/public/blob/master/packages/Compute/src/help.md
12
- //output: dataframe regressionTable {viewer: Scatter Plot(filter: "!${isOutlier}", showFilteredOutPoints: "true", filteredOutRowsColor: 4293991195, showRegressionLine: "true"); category: OUTPUT}
13
- //output: dataframe absoluteFluxDecay {viewer: Scatter Plot(); category: OUTPUT}
14
- //output: dataframe normalizedFluxDecay {viewer: Scatter Plot(); category: OUTPUT}
15
- //output: dataframe experimentalResults {category: OUTPUT}
16
- //output: dataframe experimentalResultsSummary {category: OUTPUT}
17
- //output: dataframe recommendations {category: OUTPUT}
18
- //output: dataframe trialData {category: OUTPUT}
19
- //output: dataframe sampleCharacteristics {category: OUTPUT}
20
- //output: dataframe filter {category: OUTPUT}
12
+ //output: dataframe regressionTable {caption: Regression Table; viewer: Scatter Plot(filter: "!${isOutlier}", showFilteredOutPoints: "true", filteredOutRowsColor: 4293991195, showRegressionLine: "true"); category: OUTPUT}
13
+ //output: dataframe trialData {caption: Trial Data; category: OUTPUT}
14
+ //output: dataframe fluxDecayDf {caption: Flux Decay Experimental Results; viewer: Scatter Plot(filter: "!${isOutlier}", showFilteredOutPoints: "true", filteredOutRowsColor: 4293991195) | Grid(); category: OUTPUT}
15
+ //output: dataframe experimentalResultsSummary {caption: Experimental Results Summary; category: OUTPUT}
16
+ //output: dataframe recommendations {caption: Recommendations; category: OUTPUT}
17
+ //output: dataframe sampleCharacteristics {caption: Sample Characteristics; category: OUTPUT}
18
+ //output: dataframe filter {caption: Filter; category: OUTPUT}
21
19
 
22
- volume = vbatch;
23
20
  function gaussianElimination(input, orderOfPolynomialRegression) {
24
- const n = input.length - 1; const coefficients = [orderOfPolynomialRegression];
21
+ const n = input.length - 1, coefficients = [orderOfPolynomialRegression];
25
22
  for (let i = 0; i < n; i++) {
26
23
  let maxrow = i;
27
- for (let j = i + 1; j < n; j++) {
28
- if (Math.abs(input[i][j]) > Math.abs(input[i][maxrow])) {
24
+ for (let j = i + 1; j < n; j++)
25
+ if (Math.abs(input[i][j]) > Math.abs(input[i][maxrow]))
29
26
  maxrow = j;
30
- }
31
- }
32
27
  for (let k = i; k < n + 1; k++) {
33
28
  const tmp = input[k][i];
34
29
  input[k][i] = input[k][maxrow];
35
30
  input[k][maxrow] = tmp;
36
31
  }
37
- for (let j = i + 1; j < n; j++) {
38
- for (let k = n; k >= i; k--) {
32
+ for (let j = i + 1; j < n; j++)
33
+ for (let k = n; k >= i; k--)
39
34
  input[k][j] -= (input[k][i] * input[i][j]) / input[i][i];
40
- }
41
- }
42
35
  }
43
36
  for (let j = n - 1; j >= 0; j--) {
44
37
  let total = 0;
45
- for (let k = j + 1; k < n; k++) {
38
+ for (let k = j + 1; k < n; k++)
46
39
  total += input[k][j] * coefficients[k];
47
- }
48
40
  coefficients[j] = (input[n][j] - total) / input[j][j];
49
41
  }
50
42
  return coefficients;
51
43
  }
52
44
 
53
45
  function polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegression) {
54
- const lhs = []; const rhs = []; const len = xCol.length; const k = orderOfPolynomialRegression + 1;
55
- let a = 0; let b = 0;
46
+ const lhs = [], rhs = [], len = xCol.length, k = orderOfPolynomialRegression + 1;
47
+ let a = 0, b = 0;
56
48
  for (let i = 0; i < k; i++) {
57
- for (let l = 0; l < len; l++) {
49
+ for (let l = 0; l < len; l++)
58
50
  a += (xCol.get(l) ** i) * yCol.get(l);
59
- }
60
51
  lhs.push(a);
61
52
  a = 0;
62
53
  const c = [];
63
54
  for (let j = 0; j < k; j++) {
64
- for (let l = 0; l < len; l++) {
55
+ for (let l = 0; l < len; l++)
65
56
  b += xCol.get(l) ** (i + j);
66
- }
67
57
  c.push(b);
68
58
  b = 0;
69
59
  }
@@ -84,16 +74,17 @@ for (let i = 0; i < isOutlierCol.length; i++) {
84
74
  vol.push(inputTable.col('filtrate volume (mL)').get(i));
85
75
  }
86
76
  }
87
- dfWithoutOutliers = DG.DataFrame.fromColumns([
88
- DG.Column.fromList('double', 'time (min)', timeMin),
89
- DG.Column.fromList('double', 'filtrate volume (mL)', vol),
90
- ]);
77
+ dfWithoutOutliers = inputTable;
78
+ // DG.DataFrame.fromColumns([
79
+ // DG.Column.fromList('double', 'time (min)', timeMin),
80
+ // DG.Column.fromList('double', 'filtrate volume (mL)', vol),
81
+ // ]);
91
82
  const timeInMinutes = dfWithoutOutliers.col('time (min)');
92
83
  const volumeInMilliliters = dfWithoutOutliers.col('filtrate volume (mL)');
93
84
  dfWithoutOutliers.columns.addNewFloat('time (hr)').init((i) => timeInMinutes.get(i) / 60);
94
85
  const timeInHours = dfWithoutOutliers.col('time (hr)');
95
86
 
96
- dfWithoutOutliers.columns.addNewFloat('V (L/m2)').init((i) => 10 * volumeInMilliliters.get(i) / testArea);
87
+ dfWithoutOutliers.columns.addNewFloat('V (L/m2)').init((i) => 10 * volumeInMilliliters.get(i) / testFilterArea);
97
88
  const newVolume = dfWithoutOutliers.col('V (L/m2)');
98
89
 
99
90
  dfWithoutOutliers.columns.addNewFloat('t/V (hr/(L/m2))').init((i) => 100 * timeInHours.get(i) / newVolume.get(i));
@@ -104,88 +95,88 @@ const volumeInLiters = dfWithoutOutliers.col('V (L)');
104
95
  const timeInSeconds = dfWithoutOutliers.col('Time (s)');
105
96
  dfWithoutOutliers.columns.addNewFloat('V/A (L/m2)').init((i) => volumeInLiters.get(i) / area);
106
97
  const va = dfWithoutOutliers.col('V/A (L/m2)');
107
- const ca = [];
108
- const cb = [];
109
- for (let i = 1; i < va.length - 3; i++) {
110
- const xCol = DG.Column.fromList('double', 'name', timeInSeconds.toList().slice(i, i + 3));
111
- const yCol = DG.Column.fromList('double', 'name', va.toList().slice(i, i + 3));
98
+ // const va = inputTable.
99
+ const ca = [], cb = [];
100
+ const windowLength = 3;
101
+ for (let i = 0; i < va.length - windowLength; i++) {
102
+ const xCol = DG.Column.fromList('double', 'name', timeInSeconds.toList().slice(i, i + windowLength));
103
+ const yCol = DG.Column.fromList('double', 'name', va.toList().slice(i, i + windowLength));
112
104
  const coefficients = polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegression);
113
105
  ca.push(coefficients[orderOfPolynomialRegression]);
114
106
  cb.push(coefficients[orderOfPolynomialRegression - 1]);
115
107
  }
116
-
117
- dfWithoutOutliers.columns.addNewFloat('a2').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
118
- dfWithoutOutliers.columns.addNewFloat('a1').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
119
- dfWithoutOutliers.columns.addNewFloat('J (LMH)').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
120
- const j = dfWithoutOutliers.col('J (LMH)');
121
- dfWithoutOutliers.columns.addNewFloat('J/Jo').init((i) => (i > 0) ? j.get(i) / (3600 * area) : 0);
122
- const jj0 = dfWithoutOutliers.col('J/Jo');
123
- absoluteFluxDecay = DG.DataFrame.fromColumns([va, j]);
124
- normalizedFluxDecay = DG.DataFrame.fromColumns([va, jj0]);
108
+ let newDf = DG.DataFrame.create(dfWithoutOutliers.rowCount - windowLength);
109
+ newDf.columns.addNewFloat('a2').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
110
+ newDf.columns.addNewFloat('a1').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
111
+ newDf.columns.addNewFloat('J (LMH)').init((i) => (i > 0) ? 3600 * (2 * ca[i] * timeInSeconds.get(i) + cb[i]) : 0);
112
+ const j = newDf.col('J (LMH)');
113
+ newDf.columns.addNewFloat('J/Jo').init((i) => (i > 0) ? j.get(i) / (3600 * area) : 0);
114
+ const jj0 = newDf.col('J/Jo');
115
+ fluxDecayDf = DG.DataFrame.fromColumns([
116
+ DG.Column.fromStrings('Run', Array(jj0.length - 1).fill('1')),
117
+ DG.Column.fromFloat32Array(va.name, va.toList().slice(1, va.length - windowLength)),
118
+ DG.Column.fromFloat32Array(j.name, j.toList().slice(1, j.length)),
119
+ DG.Column.fromFloat32Array(jj0.name, jj0.toList().slice(1, jj0.length)),
120
+ DG.Column.fromList('bool', isOutlierCol.name, isOutlierCol.toList().slice(1, isOutlierCol.length - windowLength))
121
+ ]);
125
122
 
126
123
  regressionTable = inputTable;
127
124
  coefficients = [1.8, 4.32];//[4.32, 1.8];//polynomialRegressionCoefficients(inputTable.col("time (min)"), dfWithoutOutliers.col("t/V (hr/(L/m2))"), 1);
128
125
  const trialThroughput = va.max;
129
126
  const flux = 9372.11;
130
127
  const ff0 = flux / j.get(1);
131
- experimentalResults = DG.DataFrame.fromColumns([
132
- DG.Column.fromList('string', 'Run', ['1']),
133
- DG.Column.fromList('double', 'Trial Throughput (L/m²)', [trialThroughput]),
134
- DG.Column.fromList('double', 'Flux (LMH)', [flux]),
135
- DG.Column.fromList('double', 'Flux/Flux0 (LMH)', [ff0]),
136
- ]);
137
128
  const meanFlux = j.stats.avg;
138
129
  const vmax = 0.28;//Math.round(1 / coefficients[1]);
139
130
  const instantaneousFlux = j.get(j.length - 1);
140
131
  const initialFlux = j.get(1);
141
132
  const fluxDecay = (1 - instantaneousFlux / initialFlux) * 100;
133
+ const names = reportingParameters.col('Parameter').toList();
134
+ const values = reportingParameters.col('Value').toList();
142
135
  experimentalResultsSummary = DG.DataFrame.fromColumns([
143
- DG.Column.fromList('string', 'Run', ['1']),
144
- DG.Column.fromList('string', 'Filter', [inputParametersForReporting.get(0, 1)]),
145
- DG.Column.fromList('double', 'Trial Throughput (L/m²)', [trialThroughput]),
146
- DG.Column.fromList('double', 'Flux0 (LMH)', [j.get(1)]),
147
- // DG.Column.fromList('double', 'Flux/Flux0 (LMH)', [ff0]),
148
- DG.Column.fromList('double', 'Mean Flux (LMH)', [meanFlux]),
149
- DG.Column.fromList('double', 'Vmax (L/m²)', [vmax]),
150
- DG.Column.fromList('double', 'Flux Decay (%)', [fluxDecay]),
136
+ DG.Column.fromStrings('Run', ['1']),
137
+ DG.Column.fromStrings('Filter', [values[names.indexOf('Filter Name')]]),
138
+ DG.Column.fromFloat32Array('Trial Throughput (L/m²)', [trialThroughput]),
139
+ DG.Column.fromFloat32Array('Flux0 (LMH)', [j.get(1)]),
140
+ DG.Column.fromFloat32Array('Mean Flux (LMH)', [meanFlux]),
141
+ DG.Column.fromFloat32Array('Vmax (L/m²)', [vmax]),
142
+ DG.Column.fromFloat32Array('Flux Decay (%)', [fluxDecay]),
151
143
  ]);
152
144
  const q0 = Math.round(1 / coefficients[0]);
153
- const amin = (vbatch / vmax) + (vbatch / tbatch / q0);
145
+ const amin = (desiredVolumeOfBatch / vmax) + (desiredVolumeOfBatch / desiredProcessTime / q0);
154
146
  const installedArea = sf * amin;
155
147
  const processLoading = volumeInLiters.get(volumeInLiters.length - 1) / installedArea;
156
148
  recommendations = DG.DataFrame.fromColumns([
157
- DG.Column.fromList('double', 'Volume (L)', [vbatch]),
158
- DG.Column.fromList('double', 'Time (h)', [tbatch]),
159
- DG.Column.fromList('double', 'Amin (m²)', [amin]),
160
- DG.Column.fromList('double', 'Safety Factor', [sf]),
161
- DG.Column.fromList('double', 'Installed Area', [installedArea]),
162
- DG.Column.fromList('double', 'Process Loading (L/m²)', [processLoading]),
163
- DG.Column.fromList('string', 'Filter', [inputParametersForReporting.get(1, 0)]),
164
- DG.Column.fromList('string', 'Installed Device', [inputParametersForReporting.get(1, 10)]),
149
+ DG.Column.fromFloat32Array('Volume (L)', [desiredVolumeOfBatch]),
150
+ DG.Column.fromFloat32Array('Time (h)', [desiredProcessTime]),
151
+ DG.Column.fromFloat32Array('Amin (m²)', [amin]),
152
+ DG.Column.fromFloat32Array('Safety Factor', [sf]),
153
+ DG.Column.fromFloat32Array('Installed Area', [installedArea]),
154
+ DG.Column.fromFloat32Array('Process Loading (L/m²)', [processLoading]),
155
+ DG.Column.fromStrings('Filter', [values[names.indexOf('Filter Name')]]),
156
+ DG.Column.fromStrings('Installed Device', [values[names.indexOf('Installed Device')]]),
165
157
  ]);
166
158
 
167
159
  const v90 = vmax * 0.68;
168
- const initialFlowArea = coefficients[0];
160
+ const initialFlowRate = coefficients[0];
169
161
  trialData = DG.DataFrame.fromColumns([
170
- DG.Column.fromList('double', 'Test Filter Area (m²)', [testArea]),
171
- DG.Column.fromList('double', 'Initial Flow Area (L/h)', [initialFlowArea]),
172
- DG.Column.fromList('double', 'Vmax (m²)', [vmax]),
173
- DG.Column.fromList('double', 'V90 (m²)', [v90]),
162
+ DG.Column.fromFloat32Array('Test Filter Area (m²)', [testFilterArea]),
163
+ DG.Column.fromFloat32Array('Initial Flow Rate (L/h)', [initialFlowRate]),
164
+ DG.Column.fromFloat32Array('Vmax (m²)', [vmax]),
165
+ DG.Column.fromFloat32Array('V90 (m²)', [v90]),
174
166
  ]);
175
167
 
176
168
  filter = DG.DataFrame.fromColumns([
177
- DG.Column.fromList('string', 'Filter Family', [inputParametersForReporting.columns.names()[1]]),
178
- DG.Column.fromList('string', 'Filter Name', [inputParametersForReporting.get(1, 0)]),
179
- DG.Column.fromList('string', 'Pore Rating', [inputParametersForReporting.get(1, 1)]),
180
- DG.Column.fromList('string', 'Effective Membr. Area', [inputParametersForReporting.get(1, 2)]),
181
- DG.Column.fromList('string', 'Membr material', [inputParametersForReporting.get(1, 3)]),
182
- DG.Column.fromList('string', 'Catalog', [inputParametersForReporting.get(1, 4)]),
169
+ DG.Column.fromStrings('Filter Family', [values[names.indexOf('Filter Family')]]),
170
+ DG.Column.fromStrings('Filter Name', [values[names.indexOf('Filter Name')]]),
171
+ DG.Column.fromStrings('Pore Rating (μm)', [values[names.indexOf('Pore rating (μm)')]]),
172
+ DG.Column.fromStrings('Effective Membr. Area (cm^2)', [values[names.indexOf('Effective Membr. Area (cm^2)')]]),
173
+ DG.Column.fromStrings('Membr material', [values[names.indexOf('Membr material')]]),
174
+ DG.Column.fromStrings('Catalog Nr', [values[names.indexOf('Catalog Nr')]]),
183
175
  ]);
184
-
185
176
  sampleCharacteristics = DG.DataFrame.fromColumns([
186
- DG.Column.fromList('string', 'Date', [inputParametersForReporting.get(1, 5)]),
187
- DG.Column.fromList('string', 'Prior step', [inputParametersForReporting.get(1, 6)]),
188
- DG.Column.fromList('string', 'Prot conc', [inputParametersForReporting.get(1, 7)]),
189
- DG.Column.fromList('string', 'Density', [inputParametersForReporting.get(1, 8)]),
190
- DG.Column.fromList('string', 'Turbidity', [inputParametersForReporting.get(1, 9)]),
191
- ]);
177
+ DG.Column.fromStrings('Date', [values[names.indexOf('date ')]]),
178
+ DG.Column.fromStrings('Prior Step', [values[names.indexOf('Prior Step')]]),
179
+ DG.Column.fromStrings('Prot conc. (mg/mL)', [values[names.indexOf('Prot conc. (mg/mL)')]]),
180
+ DG.Column.fromStrings('Density (g/L)', [values[names.indexOf('Density (g/L)')]]),
181
+ DG.Column.fromStrings('Turbidity (NTU)', [values[names.indexOf('Turbidity (NTU)')]]),
182
+ ]);