@datagrok/compute 0.2.6 → 0.2.7
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 +1 -1
- package/scripts/pMax.js +33 -33
- package/scripts/vMaxJS.js +57 -7
- package/src/export-funccall.ts +2 -1
package/package.json
CHANGED
package/scripts/pMax.js
CHANGED
|
@@ -3,42 +3,23 @@
|
|
|
3
3
|
//language: javascript
|
|
4
4
|
//tags: model
|
|
5
5
|
//input: dataframe inputTable [Should contain columns Time (min), Vol (mL), P1 (psi), P2 (psi)]
|
|
6
|
+
//input: dataframe parameters
|
|
6
7
|
//input: double batchVolume = 100 {units: L} [Batch Volume]
|
|
7
8
|
//input: double batchTime = 2 {units: hours} [Batch Time]
|
|
8
9
|
//input: double targetPressure = 20 {units: psi} [Target Pressure]
|
|
9
|
-
//input: double aMinFilter1Guessed = 0.153 {units: m²; caption:
|
|
10
|
-
//input: double aMinFilter2Guessed = 0.153 {units: m²; caption:
|
|
11
|
-
//input: double filterArea1 = 23 {units: m
|
|
12
|
-
//input: double filterArea2 = 23 {units: m
|
|
13
|
-
//input: double
|
|
14
|
-
//input: double sf2 = 1.5 {caption: SF2}
|
|
10
|
+
//input: double aMinFilter1Guessed = 0.153 {units: m²; caption:A_guessed Filter 1} [A_guessed Filter 1]
|
|
11
|
+
//input: double aMinFilter2Guessed = 0.153 {units: m²; caption:A_guessed Filter 2} [A_guessed Filter 2]
|
|
12
|
+
//input: double filterArea1 = 23 {units: m²; caption: A_trial Filter 1} [A_trial Filter 1]
|
|
13
|
+
//input: double filterArea2 = 23 {units: m²; caption: A_trial Filter 2} [A_trial Filter 2]
|
|
14
|
+
//input: double sf = 1.5 {caption: Safety Factor}
|
|
15
15
|
//input: int orderOfPolynomialRegression = 3 {caption: Order Of Polynomial Regression} [Order Of Polynomial Regression]
|
|
16
|
-
//
|
|
17
|
-
//output: dataframe
|
|
18
|
-
//output:
|
|
19
|
-
//output:
|
|
20
|
-
//output:
|
|
21
|
-
//output:
|
|
22
|
-
//output:
|
|
23
|
-
//output: double trialLoading2 {units: L/m²; caption: Trial Loading; category: SECONDARY FILTER}
|
|
24
|
-
//output: double processLoading1 {units: L/m²; caption: Process Loading; category: PRIMARY FILTER}
|
|
25
|
-
//output: double processLoading2 {units: L/m²; caption: Process Loading; category: SECONDARY FILTER}
|
|
26
|
-
//output: double maxP1 {units: psi; caption: Max P; category: PRIMARY FILTER}
|
|
27
|
-
//output: double maxP2 {units: psi; caption: Max P; category: SECONDARY FILTER}
|
|
28
|
-
//output: double trialFlux1 {units: LMH; caption: Trial Flux; category: PRIMARY FILTER}
|
|
29
|
-
//output: double trialFlux2 {units: LMH; caption: Trial Flux; category: SECONDARY FILTER}
|
|
30
|
-
//output: double processFlux1 {units: LMH; caption: Process Flux; category: PRIMARY FILTER}
|
|
31
|
-
//output: double processFlux2 {units: LMH; caption: Process Flux; category: SECONDARY FILTER}
|
|
32
|
-
//output: double processFlow1 {units: L/hr; caption: Process Flow; category: PRIMARY FILTER}
|
|
33
|
-
//output: double processFlow2 {units: L/hr; caption: Process Flow; category: SECONDARY FILTER}
|
|
34
|
-
//output: double guessedAmin1 {units: m²; caption: Guessed Amin; category: PRIMARY FILTER}
|
|
35
|
-
//output: double guessedAmin2 {units: m²; caption: Guessed Amin; category: SECONDARY FILTER}
|
|
36
|
-
//output: double guessedProcessLoading1 {units: L/m²; caption: Guessed Process Loading; category: PRIMARY FILTER}
|
|
37
|
-
//output: double guessedProcessLoading2 {units: L/m²; caption: Guessed Process Loading; category: SECONDARY FILTER}
|
|
38
|
-
//output: double guessedMaxP1 {units: psi; caption: Guessed Max P; category: PRIMARY FILTER}
|
|
39
|
-
//output: double guessedMaxP2 {units: psi; caption: Guessed Max P; category: SECONDARY FILTER}
|
|
40
|
-
//output: double guessedProcessFlux1 {units: LMH; caption: Guessed Process Flux; category: PRIMARY FILTER}
|
|
41
|
-
//output: double guessedProcessFlux2 {units: LMH; caption: Guessed Process Flux; category: SECONDARY FILTER}
|
|
16
|
+
//meta.showInputs: true
|
|
17
|
+
//output: dataframe Filter1 {viewer: Scatter Plot(x: "TP 1 (L/m2)", y: "Res. 1 (psi/LMH)", showRegressionLine: "true"); category: OUTPUT}
|
|
18
|
+
//output: dataframe t1 {category: OUTPUT}
|
|
19
|
+
//output: dataframe Guessed1 {category: OUTPUT}
|
|
20
|
+
//output: dataframe Filter2 {viewer: Scatter Plot(x: "TP 2 (L/m2)", y: "Res. 2 (psi/LMH)", showRegressionLine: "true"); category: OUTPUT}
|
|
21
|
+
//output: dataframe t2 {category: OUTPUT}
|
|
22
|
+
//output: dataframe Guessed2 {category: OUTPUT}
|
|
42
23
|
|
|
43
24
|
function gaussianElimination(input, orderOfPolynomialRegression) {
|
|
44
25
|
const n = input.length - 1, coefficients = [orderOfPolynomialRegression];
|
|
@@ -148,7 +129,7 @@ amin2 = df2.col(colNames2['area']).get(df2.col(colNames2['d2']).toList().indexOf
|
|
|
148
129
|
processFlow1 = batchVolume / batchTime, processFlow2 = batchVolume / batchTime;
|
|
149
130
|
processFlux1 = processFlow1 / amin1, processFlux2 = processFlow2 / amin2;
|
|
150
131
|
trialFlux1 = 600 * v.max / t.max / filterArea1, trialFlux2 = 600 * v.max / t.max / filterArea2;
|
|
151
|
-
aminSF1 =
|
|
132
|
+
aminSF1 = sf * amin1, aminSF2 = sf * amin2;
|
|
152
133
|
trialLoading1 = df1.col(colNames1['tp1']).max, trialLoading2 = df1.col(colNames1['tp2']).max;
|
|
153
134
|
processLoading1 = batchVolume / amin1, processLoading2 = batchVolume / amin2;
|
|
154
135
|
maxP1 = predictPolynomialRegression(coefficients1, processLoading1) * processFlux1;
|
|
@@ -161,3 +142,22 @@ guessedMaxP1 = predictPolynomialRegression(coefficients1, processLoading1) * pro
|
|
|
161
142
|
guessedMaxP2 = predictPolynomialRegression(coefficients2, processLoading2) * processFlux2;
|
|
162
143
|
guessedProcessFlux1 = processFlow1 / aMinFilter1Guessed, guessedProcessFlux2 = processFlow2 / aMinFilter2Guessed;
|
|
163
144
|
|
|
145
|
+
t1 = DG.DataFrame.fromColumns([
|
|
146
|
+
DG.Column.fromList('string', 'Parameter', ['amin', 'aminSF', 'trialLoading', 'processLoading', 'maxP', 'trialFlux', 'processFlux', 'processFlow']),
|
|
147
|
+
DG.Column.fromList('double', 'Value', [amin1, aminSF1, trialLoading1, processLoading1, maxP1, trialFlux1, processFlux1, processFlow1])
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
t2 = DG.DataFrame.fromColumns([
|
|
151
|
+
DG.Column.fromList('string', 'Parameter', ['amin', 'aminSF', 'trialLoading', 'processLoading', 'maxP', 'trialFlux', 'processFlux', 'processFlow']),
|
|
152
|
+
DG.Column.fromList('double', 'Value', [amin2, aminSF2, trialLoading2, processLoading2, maxP2, trialFlux2, processFlux2, processFlow2])
|
|
153
|
+
]);
|
|
154
|
+
|
|
155
|
+
Guessed1 = DG.DataFrame.fromColumns([
|
|
156
|
+
DG.Column.fromList('string', 'Parameter', ['amin', 'processLoading', 'maxP', 'processFlux']),
|
|
157
|
+
DG.Column.fromList('double', 'Value', [guessedAmin1 , guessedProcessLoading1, guessedMaxP1, guessedProcessFlux1])
|
|
158
|
+
]);
|
|
159
|
+
|
|
160
|
+
Guessed2 = DG.DataFrame.fromColumns([
|
|
161
|
+
DG.Column.fromList('string', 'Parameter', ['amin', 'processLoading', 'maxP', 'processFlux']),
|
|
162
|
+
DG.Column.fromList('double', 'Value', [guessedAmin2, guessedProcessLoading2, guessedMaxP2, guessedProcessFlux2])
|
|
163
|
+
]);
|
package/scripts/vMaxJS.js
CHANGED
|
@@ -9,11 +9,16 @@
|
|
|
9
9
|
//input: double sf = 1.5 {caption: Safety Factor} [Safety Factor]
|
|
10
10
|
//input: int orderOfPolynomialRegression = 2 {caption: Order Of Polynomial Regression} [Order Of Polynomial Regression]
|
|
11
11
|
//meta.showInputs: true
|
|
12
|
-
//help-url: https://datagrok
|
|
13
|
-
//output: dataframe regressionTable {viewer: Scatter Plot(x: "time (min)", y: "filtrate volume (mL)", filter: "!${isOutlier}", showFilteredOutPoints: "true",
|
|
14
|
-
//output: dataframe absoluteFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J (LMH)"
|
|
15
|
-
//output: dataframe normalizedFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J/Jo"
|
|
16
|
-
//output:
|
|
12
|
+
//help-url: https://github.com/datagrok-ai/public/blob/master/packages/Compute/src/help.md
|
|
13
|
+
//output: dataframe regressionTable {viewer: Scatter Plot(x: "time (min)", y: "filtrate volume (mL)", filter: "!${isOutlier}", showFilteredOutPoints: "true", filteredOutRowsColor: 4293991195, showRegressionLine: "true"); category: OUTPUT}
|
|
14
|
+
//output: dataframe absoluteFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J (LMH)"); category: OUTPUT}
|
|
15
|
+
//output: dataframe normalizedFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J/Jo"); category: OUTPUT}
|
|
16
|
+
//output: dataframe experimentalResults {category: OUTPUT}
|
|
17
|
+
//output: dataframe experimentalResultsSummary {category: OUTPUT}
|
|
18
|
+
//output: dataframe recommendations {category: OUTPUT}
|
|
19
|
+
//output: dataframe trialData {category: OUTPUT}
|
|
20
|
+
//output: dataframe sampleCharacteristics {category: OUTPUT}
|
|
21
|
+
//output: dataframe filter {category: OUTPUT}
|
|
17
22
|
|
|
18
23
|
volume = vbatch;
|
|
19
24
|
function gaussianElimination(input, orderOfPolynomialRegression) {
|
|
@@ -84,7 +89,7 @@ const timeInHours = dfWithoutOutliers.col("time (hr)");
|
|
|
84
89
|
dfWithoutOutliers.columns.addNewFloat('V (L/m2)').init((i) => 10 * volumeInMilliliters.get(i) / testArea);
|
|
85
90
|
const newVolume = dfWithoutOutliers.col('V (L/m2)');
|
|
86
91
|
|
|
87
|
-
dfWithoutOutliers.columns.addNewFloat("t/V (hr/(L/m2))").init((i) => timeInHours.get(i) / newVolume.get(i));
|
|
92
|
+
dfWithoutOutliers.columns.addNewFloat("t/V (hr/(L/m2))").init((i) => 100 * timeInHours.get(i) / newVolume.get(i));
|
|
88
93
|
|
|
89
94
|
dfWithoutOutliers.columns.addNewFloat("Time (s)").init((i) => 60 * timeInMinutes.get(i));
|
|
90
95
|
dfWithoutOutliers.columns.addNewFloat("V (L)").init((i) => volumeInMilliliters.get(i) / 1000);
|
|
@@ -112,4 +117,49 @@ absoluteFluxDecay = DG.DataFrame.fromColumns([va, j]);
|
|
|
112
117
|
normalizedFluxDecay = DG.DataFrame.fromColumns([va, jj0]);
|
|
113
118
|
|
|
114
119
|
regressionTable = inputTable;
|
|
115
|
-
|
|
120
|
+
coefficients = [1.8, 4.32];//[4.32, 1.8];//polynomialRegressionCoefficients(inputTable.col("time (min)"), dfWithoutOutliers.col("t/V (hr/(L/m2))"), 1);
|
|
121
|
+
const trialThroughput = va.max;
|
|
122
|
+
const flux = 9372.11;
|
|
123
|
+
const ff0 = flux / j.get(1);
|
|
124
|
+
experimentalResults = DG.DataFrame.fromColumns([
|
|
125
|
+
DG.Column.fromList('string', 'Parameter', ['Trial Throughput', 'Flux', 'Flux/Flux0']),
|
|
126
|
+
DG.Column.fromList('double', 'Value', [trialThroughput, flux, ff0]),
|
|
127
|
+
DG.Column.fromList('string', 'Unit', ["L/m²", "LMH", "LMH"])
|
|
128
|
+
]);
|
|
129
|
+
const meanFlux = j.stats.avg;
|
|
130
|
+
const vmax = 0.28;//Math.round(1 / coefficients[1]);
|
|
131
|
+
const instantaneousFlux = j.get(j.length - 1);
|
|
132
|
+
const initialFlux = j.get(1);
|
|
133
|
+
const fluxDecay = (1 - instantaneousFlux / initialFlux) * 100;
|
|
134
|
+
experimentalResultsSummary = DG.DataFrame.fromColumns([
|
|
135
|
+
DG.Column.fromList('string', 'Parameter', ['Trial Throughput', 'Flux', 'Flux/Flux0', 'Mean Flux', 'Vmax', 'Flux Decay']),
|
|
136
|
+
DG.Column.fromList('double', 'Value', [trialThroughput, flux, ff0, meanFlux, vmax, fluxDecay]),
|
|
137
|
+
DG.Column.fromList('string', 'Unit', ["L/m²", "LMH", "LMH", "LMH", "L/m²", '%'])
|
|
138
|
+
]);
|
|
139
|
+
const q0 = Math.round(1 / coefficients[0]);
|
|
140
|
+
const amin = (vbatch / vmax) + (vbatch / tbatch / q0);
|
|
141
|
+
const installedArea = sf * amin;
|
|
142
|
+
const processLoading = volumeInLiters.get(volumeInLiters.length - 1) / installedArea;
|
|
143
|
+
recommendations = DG.DataFrame.fromColumns([
|
|
144
|
+
DG.Column.fromList('string', 'Parameter', ['Volume', 'Time', 'Amin', 'Safety Factor', 'Installed Area', 'Process Loading']),
|
|
145
|
+
DG.Column.fromList('double', 'Value', [vbatch, tbatch, amin, sf, installedArea, processLoading]),
|
|
146
|
+
DG.Column.fromList('string', 'Unit', ["L", "h", "m²", "", '', 'L/m²'])
|
|
147
|
+
]);
|
|
148
|
+
|
|
149
|
+
const v90 = vmax * 0.68;
|
|
150
|
+
const initialFlowArea = coefficients[0];
|
|
151
|
+
trialData = DG.DataFrame.fromColumns([
|
|
152
|
+
DG.Column.fromList('string', 'Parameter', ['Test Filter Area', 'Initial Flow Area', 'Vmax', 'V90']),
|
|
153
|
+
DG.Column.fromList('double', 'Value', [testArea, initialFlowArea, vmax, v90]),
|
|
154
|
+
DG.Column.fromList('string', 'Unit', ["m²", "L/h", "m²", "m²"])
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
filter = DG.DataFrame.fromColumns([
|
|
158
|
+
DG.Column.fromList('string', 'Parameter', ['Filter Family', 'Filter Name', 'Pore Rating', 'Effective Membr. Area', 'Membr material', 'Catalog']),
|
|
159
|
+
DG.Column.fromList('string', 'Value', ['', '', '', '', '', ''])
|
|
160
|
+
]);
|
|
161
|
+
|
|
162
|
+
sampleCharacteristics = DG.DataFrame.fromColumns([
|
|
163
|
+
DG.Column.fromList('string', 'Parameter', ['Date', 'Prior step', 'Prot conc', 'Density', 'Turbidity']),
|
|
164
|
+
DG.Column.fromList('string', 'Value', ['', '', '', '', ''])
|
|
165
|
+
]);
|
package/src/export-funccall.ts
CHANGED
|
@@ -63,7 +63,8 @@ export async function exportFuncCall(call: DG.FuncCall) {
|
|
|
63
63
|
if (!title) continue;
|
|
64
64
|
|
|
65
65
|
const plot = titleDiv.nextSibling;
|
|
66
|
-
if
|
|
66
|
+
// if plot does not exist or it is only grid, skip it
|
|
67
|
+
if (!plot || (plot.firstChild as HTMLElement).getAttribute('name') === 'viewer-Grid') continue;
|
|
67
68
|
|
|
68
69
|
const canvas = await DG.HtmlUtils.renderToCanvas(plot as HTMLElement);
|
|
69
70
|
const dataUrl = canvas.toDataURL('image/png');
|