@datagrok/compute 0.2.8 → 0.5.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/.eslintrc.json +6 -1
- package/icons/Blob.svg +3 -0
- package/icons/Bool.svg +3 -0
- package/icons/Column-list.svg +3 -0
- package/icons/Column.svg +3 -0
- package/icons/Dataframe.svg +3 -0
- package/icons/Datetime.svg +3 -0
- package/icons/Double.svg +5 -0
- package/icons/File.svg +3 -0
- package/icons/Graphics.svg +3 -0
- package/icons/Int.svg +3 -0
- package/icons/String.svg +3 -0
- package/package.json +7 -3
- package/scripts/pMax.js +34 -6
- package/scripts/vMaxJS.js +78 -52
- package/src/export-funccall.ts +76 -13
- package/src/function-editor/function-editor.ts +536 -0
- package/src/outliers-selection/outliers-selection-viewer.ts +262 -0
- package/src/{outliers-selection.ts → outliers-selection/outliers-selection.ts} +9 -3
- package/src/package.ts +80 -1
- package/webpack.config.js +5 -1
package/.eslintrc.json
CHANGED
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
{ "ignoreStrings": true }
|
|
22
22
|
],
|
|
23
23
|
"require-jsdoc": "off",
|
|
24
|
-
"spaced-comment": "off"
|
|
24
|
+
"spaced-comment": "off",
|
|
25
|
+
"valid-jsdoc": [
|
|
26
|
+
"error",
|
|
27
|
+
{ "requireParamType": false,
|
|
28
|
+
"requireReturnType": false }
|
|
29
|
+
]
|
|
25
30
|
},
|
|
26
31
|
"parser": "@typescript-eslint/parser",
|
|
27
32
|
"plugins": [
|
package/icons/Blob.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="11" height="18" viewBox="0 0 11 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.7376 6.14966C10.9125 5.54739 11 4.82903 11 3.99456C11 2.73197 10.785 1.75238 10.355 1.05578C9.92507 0.351927 9.27282 0 8.3983 0C7.77885 0 7.27964 0.159637 6.90068 0.478911C6.52173 0.79093 6.24479 1.24444 6.06989 1.83946C5.90227 2.43447 5.81847 3.15283 5.81847 3.99456C5.81847 5.24989 6.02616 6.23311 6.44156 6.94422C6.86425 7.64807 7.51649 8 8.3983 8C9.02504 8 9.52789 7.84036 9.90685 7.52109C10.2858 7.20182 10.5627 6.74467 10.7376 6.14966ZM7.14118 6.38912C6.90068 5.85941 6.78044 5.06122 6.78044 3.99456C6.78044 2.93515 6.90068 2.14059 7.14118 1.61088C7.38896 1.08118 7.808 0.816326 8.3983 0.816326C8.98131 0.816326 9.39671 1.08118 9.64449 1.61088C9.89956 2.14059 10.0271 2.93515 10.0271 3.99456C10.0271 5.06848 9.89956 5.8703 9.64449 6.4C9.39671 6.92245 8.98131 7.18367 8.3983 7.18367C7.808 7.18367 7.38896 6.91882 7.14118 6.38912ZM1.96767 7.89116H2.90778V0.119728H2.10978L0 1.75238L0.50285 2.39456L1.33364 1.71973C1.4794 1.59637 1.59964 1.49478 1.69438 1.41497C1.78912 1.33515 1.89479 1.23719 2.0114 1.12109C1.99682 1.32426 1.98589 1.52018 1.9786 1.70884C1.97132 1.89751 1.96767 2.14785 1.96767 2.45986V7.89116ZM5.12373 16.1497C5.30591 15.5474 5.397 14.829 5.397 13.9946C5.397 12.732 5.17307 11.7524 4.72522 11.0558C4.27737 10.3519 3.598 10 2.68711 10C2.0419 10 1.52194 10.1596 1.12722 10.4789C0.732504 10.7909 0.444057 11.2444 0.26188 11.8395C0.0872931 12.4345 0 13.1528 0 13.9946C0 15.2499 0.216336 16.2331 0.649007 16.9442C1.08927 17.6481 1.76864 18 2.68711 18C3.33992 18 3.86368 17.8404 4.25839 17.5211C4.65311 17.2018 4.94156 16.7447 5.12373 16.1497ZM1.37772 16.3891C1.12722 15.8594 1.00197 15.0612 1.00197 13.9946C1.00197 12.9351 1.12722 12.1406 1.37772 11.6109C1.6358 11.0812 2.07227 10.8163 2.68711 10.8163C3.29437 10.8163 3.72704 11.0812 3.98513 11.6109C4.2508 12.1406 4.38364 12.9351 4.38364 13.9946C4.38364 15.0685 4.2508 15.8703 3.98513 16.4C3.72704 16.9224 3.29437 17.1837 2.68711 17.1837C2.07227 17.1837 1.6358 16.9188 1.37772 16.3891ZM9.0208 17.8912H10V10.1197H9.16882L6.9713 11.7524L7.49506 12.3946L8.3604 11.7197C8.51222 11.5964 8.63747 11.4948 8.73615 11.415C8.83483 11.3351 8.94489 11.2372 9.06634 11.1211C9.05116 11.3243 9.03977 11.5202 9.03218 11.7088C9.02459 11.8975 9.0208 12.1478 9.0208 12.4599V17.8912Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/icons/Bool.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.4688 0.4375C10.8073 0.4375 11.0951 0.55599 11.332 0.792969C11.569 1.02995 11.6875 1.31771 11.6875 1.65625V10.5938C11.6875 10.9323 11.569 11.2201 11.332 11.457C11.0951 11.694 10.8073 11.8125 10.4688 11.8125H1.53125C1.19271 11.8125 0.904948 11.694 0.667969 11.457C0.43099 11.2201 0.3125 10.9323 0.3125 10.5938V1.65625C0.3125 1.31771 0.43099 1.02995 0.667969 0.792969C0.904948 0.55599 1.19271 0.4375 1.53125 0.4375H10.4688ZM10.4688 1.25H1.53125C1.41276 1.25 1.3112 1.29232 1.22656 1.37695C1.15885 1.44466 1.125 1.53776 1.125 1.65625V10.5938C1.125 10.7122 1.15885 10.8138 1.22656 10.8984C1.3112 10.9661 1.41276 11 1.53125 11H10.4688C10.5872 11 10.6803 10.9661 10.748 10.8984C10.8327 10.8138 10.875 10.7122 10.875 10.5938V1.65625C10.875 1.53776 10.8327 1.44466 10.748 1.37695C10.6803 1.29232 10.5872 1.25 10.4688 1.25ZM9.60547 3.73828C9.74089 3.89062 9.74089 4.03451 9.60547 4.16992L5.00977 8.71484C4.87435 8.86719 4.73047 8.86719 4.57812 8.71484L2.39453 6.53125C2.25911 6.37891 2.25911 6.23503 2.39453 6.09961L2.62305 5.87109C2.75846 5.73568 2.90234 5.73568 3.05469 5.87109L4.80664 7.64844L8.94531 3.53516C9.09766 3.38281 9.24154 3.38281 9.37695 3.53516L9.60547 3.73828Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.855469 0.372079C0.61849 0.620132 0.5 0.92134 0.5 1.2757V10.6308C0.5 10.9852 0.61849 11.2864 0.855469 11.5345C1.09245 11.7825 1.38021 11.9065 1.71875 11.9065H2.5V12.7237C2.5 13.0781 2.61849 13.3793 2.85547 13.6273C3.09245 13.8754 3.38021 13.9994 3.71875 13.9994H14.2812C14.6198 13.9994 14.9076 13.8754 15.1445 13.6273C15.3815 13.3793 15.5 13.0781 15.5 12.7237V3.36855C15.5 3.01419 15.3815 2.71298 15.1445 2.46493C14.9076 2.21688 14.6198 2.09285 14.2812 2.09285H13.5V1.2757C13.5 0.92134 13.3815 0.620132 13.1445 0.372079C12.9076 0.124026 12.6198 0 12.2812 0H1.71875C1.38021 0 1.09245 0.124026 0.855469 0.372079ZM13.5 2.97807V10.6308C13.5 10.9852 13.3815 11.2864 13.1445 11.5345C12.9076 11.7825 12.6198 11.9065 12.2812 11.9065H3.3125V12.7237C3.3125 12.8477 3.34635 12.954 3.41406 13.0426C3.4987 13.1135 3.71875 13.1489 3.71875 13.1489H14.2812C14.3766 13.1577 14.4928 13.1135 14.5605 13.0426C14.6452 12.954 14.6875 12.8477 14.6875 12.7237V2.97807H13.5ZM12.5605 0.983353C12.6452 1.05423 12.6875 1.15167 12.6875 1.2757V3.69422H5.375H1.3125V1.2757C1.3125 1.15167 1.34635 1.05423 1.41406 0.983353C1.4987 0.894763 1.60026 0.850467 1.71875 0.850467H5.375H12.2812C12.3997 0.850467 12.4928 0.894763 12.5605 0.983353ZM12.6875 4.54468V7.36186H5.375H1.3125V4.54468H5.375H12.6875ZM1.41406 10.9498C1.34635 10.8612 1.3125 10.7549 1.3125 10.6308V8.21233H5.375H12.6875V10.6308C12.6875 10.7549 12.6452 10.8612 12.5605 10.9498C12.4928 11.0206 12.3997 11.0561 12.2812 11.0561H5.375H1.71875C1.60026 11.0561 1.4987 11.0206 1.41406 10.9498Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/icons/Column.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M0.5 1.65625C0.5 1.31771 0.61849 1.02995 0.855469 0.792969C1.09245 0.55599 1.38021 0.4375 1.71875 0.4375H12.2812C12.6198 0.4375 12.9076 0.55599 13.1445 0.792969C13.3815 1.02995 13.5 1.31771 13.5 1.65625V10.5938C13.5 10.9323 13.3815 11.2201 13.1445 11.457C12.9076 11.694 12.6198 11.8125 12.2812 11.8125H1.71875C1.38021 11.8125 1.09245 11.694 0.855469 11.457C0.61849 11.2201 0.5 10.9323 0.5 10.5938V1.65625ZM12.6875 1.65625C12.6875 1.53776 12.6452 1.44466 12.5605 1.37695C12.4928 1.29232 12.3997 1.25 12.2812 1.25H5.375V3.9668H12.6875V1.65625ZM12.6875 7.4707V4.7793H5.375V7.4707H12.6875ZM1.3125 4.7793V7.4707H5.375V4.7793H1.3125ZM5.375 1.25H1.71875C1.60026 1.25 1.4987 1.29232 1.41406 1.37695C1.34635 1.44466 1.3125 1.53776 1.3125 1.65625V3.9668H5.375V1.25ZM1.3125 10.5938C1.3125 10.7122 1.34635 10.8138 1.41406 10.8984C1.4987 10.9661 1.60026 11 1.71875 11H5.375V8.2832H1.3125V10.5938ZM5.375 11H12.2812C12.3997 11 12.4928 10.9661 12.5605 10.8984C12.6452 10.8138 12.6875 10.7122 12.6875 10.5938V8.2832H5.375V11Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.42773 1.91992C8.47982 1.59831 7.33724 1.4375 6 1.4375C4.66276 1.4375 3.51172 1.59831 2.54688 1.91992C1.59896 2.24154 1.125 2.6224 1.125 3.0625V3.875C1.125 4.3151 1.59896 4.69596 2.54688 5.01758C3.51172 5.33919 4.66276 5.5 6 5.5C7.33724 5.5 8.47982 5.33919 9.42773 5.01758C10.3926 4.69596 10.875 4.3151 10.875 3.875V3.0625C10.875 2.6224 10.3926 2.24154 9.42773 1.91992ZM10.875 5.24609C9.85938 5.95703 8.23438 6.3125 6 6.3125C3.76562 6.3125 2.14062 5.95703 1.125 5.24609V6.3125C1.125 6.7526 1.59896 7.13346 2.54688 7.45508C3.51172 7.77669 4.66276 7.9375 6 7.9375C7.33724 7.9375 8.47982 7.77669 9.42773 7.45508C10.3926 7.13346 10.875 6.7526 10.875 6.3125V5.24609ZM10.875 7.68359C9.85938 8.39453 8.23438 8.75 6 8.75C3.76562 8.75 2.14062 8.39453 1.125 7.68359V8.75C1.125 9.1901 1.59896 9.57096 2.54688 9.89258C3.51172 10.2142 4.66276 10.375 6 10.375C7.33724 10.375 8.47982 10.2142 9.42773 9.89258C10.3926 9.57096 10.875 9.1901 10.875 8.75V7.68359ZM10.875 10.1211C9.85938 10.832 8.23438 11.1875 6 11.1875C3.76562 11.1875 2.14062 10.832 1.125 10.1211V11.1875C1.125 11.6276 1.59896 12.0085 2.54688 12.3301C3.51172 12.6517 4.66276 12.8125 6 12.8125C7.33724 12.8125 8.47982 12.6517 9.42773 12.3301C10.3926 12.0085 10.875 11.6276 10.875 11.1875V10.1211ZM6 0.625C6.55859 0.625 7.13411 0.667318 7.72656 0.751953C8.33594 0.819661 8.94531 0.938151 9.55469 1.10742C10.181 1.27669 10.6888 1.5306 11.0781 1.86914C11.4844 2.20768 11.6875 2.60547 11.6875 3.0625V11.1875C11.6875 11.6445 11.4844 12.0423 11.0781 12.3809C10.6888 12.7194 10.181 12.9733 9.55469 13.1426C8.94531 13.3118 8.3444 13.4303 7.75195 13.498C7.15951 13.5827 6.57552 13.625 6 13.625C5.44141 13.625 4.85742 13.5827 4.24805 13.498C3.6556 13.4303 3.04622 13.3118 2.41992 13.1426C1.81055 12.9733 1.30273 12.7194 0.896484 12.3809C0.507161 12.0423 0.3125 11.6445 0.3125 11.1875V3.0625C0.3125 2.60547 0.507161 2.20768 0.896484 1.86914C1.30273 1.5306 1.81055 1.27669 2.41992 1.10742C3.04622 0.938151 3.6556 0.819661 4.24805 0.751953C4.84049 0.667318 5.42448 0.625 6 0.625Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.4688 2.25C10.8073 2.25 11.0951 2.36849 11.332 2.60547C11.569 2.84245 11.6875 3.13021 11.6875 3.46875V12.4062C11.6875 12.7448 11.569 13.0326 11.332 13.2695C11.0951 13.5065 10.8073 13.625 10.4688 13.625H1.53125C1.19271 13.625 0.904948 13.5065 0.667969 13.2695C0.43099 13.0326 0.3125 12.7448 0.3125 12.4062V3.46875C0.3125 3.13021 0.43099 2.84245 0.667969 2.60547C0.904948 2.36849 1.19271 2.25 1.53125 2.25H2.75V0.929688C2.75 0.726562 2.85156 0.625 3.05469 0.625H3.25781C3.46094 0.625 3.5625 0.726562 3.5625 0.929688V2.25H8.4375V0.929688C8.4375 0.726562 8.53906 0.625 8.74219 0.625H8.94531C9.14844 0.625 9.25 0.726562 9.25 0.929688V2.25H10.4688ZM1.53125 3.0625C1.41276 3.0625 1.3112 3.10482 1.22656 3.18945C1.15885 3.25716 1.125 3.35026 1.125 3.46875V4.6875H10.875V3.46875C10.875 3.35026 10.8327 3.25716 10.748 3.18945C10.6803 3.10482 10.5872 3.0625 10.4688 3.0625H1.53125ZM10.4688 12.8125C10.5872 12.8125 10.6803 12.7702 10.748 12.6855C10.8327 12.6178 10.875 12.5247 10.875 12.4062V5.5H1.125V12.4062C1.125 12.5247 1.15885 12.6178 1.22656 12.6855C1.3112 12.7702 1.41276 12.8125 1.53125 12.8125H10.4688Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/icons/Double.svg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="18" height="10" viewBox="0 0 18 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3.46484 0.310547L1.10352 1.83398V2.84961L3.00781 1.65625V8.68945H0.976562V9.57812H6.13086V8.68945H4.07422V0.310547H3.46484Z" fill="#9497A0"/>
|
|
3
|
+
<path d="M9.99023 9.57812V8.23242H8.64453V9.57812H9.99023Z" fill="#9497A0"/>
|
|
4
|
+
<path d="M15.9316 5.82031C17.0234 4.62695 17.4805 3.71289 17.4805 2.64648C17.4805 1.14844 16.4141 0.208984 14.7129 0.208984C13.5957 0.208984 12.377 0.666016 11.666 1.35156L12.0723 2.18945C12.9355 1.47852 13.7988 1.12305 14.6875 1.12305C15.7793 1.12305 16.3887 1.68164 16.3887 2.69727C16.3887 3.48438 16.0078 4.2207 15.1445 5.18555L11.8945 8.76562V9.57812H17.8613V8.68945H13.291L15.9316 5.82031Z" fill="#9497A0"/>
|
|
5
|
+
</svg>
|
package/icons/File.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="10" height="14" viewBox="0 0 10 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.51953 3.11328C9.75651 3.35026 9.875 3.63802 9.875 3.97656V12.4062C9.875 12.7448 9.75651 13.0326 9.51953 13.2695C9.28255 13.5065 8.99479 13.625 8.65625 13.625H1.34375C1.00521 13.625 0.717448 13.5065 0.480469 13.2695C0.24349 13.0326 0.125 12.7448 0.125 12.4062V1.84375C0.125 1.50521 0.24349 1.21745 0.480469 0.980469C0.717448 0.74349 1.00521 0.625 1.34375 0.625H6.52344C6.86198 0.625 7.14974 0.74349 7.38672 0.980469L9.51953 3.11328ZM8.93555 3.69727L6.80273 1.56445C6.75195 1.51367 6.69271 1.47135 6.625 1.4375V3.875H9.0625C9.02865 3.80729 8.98633 3.74805 8.93555 3.69727ZM8.65625 12.8125C8.77474 12.8125 8.86784 12.7702 8.93555 12.6855C9.02018 12.6178 9.0625 12.5247 9.0625 12.4062V4.6875H6.42188C6.2526 4.6875 6.10872 4.62826 5.99023 4.50977C5.87174 4.39128 5.8125 4.2474 5.8125 4.07812V1.4375H1.34375C1.22526 1.4375 1.1237 1.47982 1.03906 1.56445C0.971354 1.63216 0.9375 1.72526 0.9375 1.84375V12.4062C0.9375 12.5247 0.971354 12.6178 1.03906 12.6855C1.1237 12.7702 1.22526 12.8125 1.34375 12.8125H8.65625Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.2656 7.5625C11.1302 7.5625 11.0625 7.49479 11.0625 7.35938V1.26562C11.0625 1.13021 11.1302 1.0625 11.2656 1.0625H11.6719C11.8073 1.0625 11.875 1.13021 11.875 1.26562V7.35938C11.875 7.49479 11.8073 7.5625 11.6719 7.5625H11.2656ZM8.82812 7.5625C8.69271 7.5625 8.625 7.49479 8.625 7.35938V3.70312C8.625 3.56771 8.69271 3.5 8.82812 3.5H9.23438C9.36979 3.5 9.4375 3.56771 9.4375 3.70312V7.35938C9.4375 7.49479 9.36979 7.5625 9.23438 7.5625H8.82812ZM3.95312 7.5625C3.81771 7.5625 3.75 7.49479 3.75 7.35938V5.32812C3.75 5.19271 3.81771 5.125 3.95312 5.125H4.35938C4.49479 5.125 4.5625 5.19271 4.5625 5.32812V7.35938C4.5625 7.49479 4.49479 7.5625 4.35938 7.5625H3.95312ZM6.39062 7.5625C6.25521 7.5625 6.1875 7.49479 6.1875 7.35938V2.07812C6.1875 1.94271 6.25521 1.875 6.39062 1.875H6.79688C6.93229 1.875 7 1.94271 7 2.07812V7.35938C7 7.49479 6.93229 7.5625 6.79688 7.5625H6.39062ZM13.2969 9.1875C13.4323 9.1875 13.5 9.25521 13.5 9.39062V9.79688C13.5 9.93229 13.4323 10 13.2969 10H0.90625C0.78776 10 0.686198 9.96615 0.601562 9.89844C0.533854 9.8138 0.5 9.71224 0.5 9.59375V0.453125C0.5 0.317708 0.567708 0.25 0.703125 0.25H1.10938C1.24479 0.25 1.3125 0.317708 1.3125 0.453125V9.1875H13.2969Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/icons/Int.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.6621 4.24609C11.6452 4.41536 11.5521 4.5 11.3828 4.5H8.76758L8.18359 7.75H10.6719C10.7734 7.75 10.8496 7.79232 10.9004 7.87695C10.9681 7.94466 10.9935 8.02083 10.9766 8.10547L10.9512 8.30859C10.9173 8.47786 10.8158 8.5625 10.6465 8.5625H8.03125L7.49805 11.5586C7.46419 11.7279 7.36263 11.8125 7.19336 11.8125H6.99023C6.88867 11.8125 6.80404 11.7702 6.73633 11.6855C6.68555 11.6178 6.66862 11.5417 6.68555 11.457L7.21875 8.5625H3.96875L3.43555 11.5586C3.40169 11.7279 3.30013 11.8125 3.13086 11.8125H2.92773C2.82617 11.8125 2.74154 11.7702 2.67383 11.6855C2.62305 11.6178 2.60612 11.5417 2.62305 11.457L3.15625 8.5625H0.642578C0.541016 8.5625 0.45638 8.52865 0.388672 8.46094C0.337891 8.3763 0.320964 8.29167 0.337891 8.20703L0.388672 8.00391C0.405599 7.83464 0.498698 7.75 0.667969 7.75H3.2832L3.86719 4.5H1.37891C1.27734 4.5 1.19271 4.46615 1.125 4.39844C1.07422 4.3138 1.05729 4.22917 1.07422 4.14453L1.09961 3.94141C1.13346 3.77214 1.23503 3.6875 1.4043 3.6875H4.01953L4.55273 0.691406C4.58659 0.522135 4.68815 0.4375 4.85742 0.4375H5.06055C5.16211 0.4375 5.23828 0.479818 5.28906 0.564453C5.35677 0.632161 5.38216 0.708333 5.36523 0.792969L4.83203 3.6875H8.08203L8.61523 0.691406C8.64909 0.522135 8.75065 0.4375 8.91992 0.4375H9.12305C9.22461 0.4375 9.30078 0.479818 9.35156 0.564453C9.41927 0.632161 9.44466 0.708333 9.42773 0.792969L8.89453 3.6875H11.4082C11.5098 3.6875 11.5859 3.72982 11.6367 3.81445C11.7044 3.88216 11.7298 3.95833 11.7129 4.04297L11.6621 4.24609ZM7.3457 7.75L7.92969 4.5H4.70508L4.12109 7.75H7.3457Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/icons/String.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="18" height="10" viewBox="0 0 18 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M16.9473 2.6875C17.0827 2.6875 17.1504 2.75521 17.1504 2.89062V9.79688C17.1504 9.93229 17.0827 10 16.9473 10H16.541C16.4056 10 16.3379 9.93229 16.3379 9.79688V8.88281C15.6777 9.6276 14.8652 10 13.9004 10C13.0033 10 12.2331 9.68685 11.5898 9.06055C10.9635 8.41732 10.6504 7.64714 10.6504 6.75V5.9375C10.6504 5.04036 10.9635 4.27865 11.5898 3.65234C12.2331 3.00911 13.0033 2.6875 13.9004 2.6875C14.8652 2.6875 15.6777 3.0599 16.3379 3.80469V2.89062C16.3379 2.75521 16.4056 2.6875 16.541 2.6875H16.9473ZM16.3379 6.75V5.9375C16.3379 5.26042 16.1009 4.6849 15.627 4.21094C15.153 3.73698 14.5775 3.5 13.9004 3.5C13.2233 3.5 12.6478 3.73698 12.1738 4.21094C11.6999 4.6849 11.4629 5.26042 11.4629 5.9375V6.75C11.4629 7.42708 11.6999 8.0026 12.1738 8.47656C12.6478 8.95052 13.2233 9.1875 13.9004 9.1875C14.5775 9.1875 15.153 8.95052 15.627 8.47656C16.1009 8.0026 16.3379 7.42708 16.3379 6.75ZM6.00391 0.503906L9.8125 9.7207C9.82943 9.73763 9.83789 9.76302 9.83789 9.79688C9.83789 9.93229 9.77018 10 9.63477 10H9.20312C9.10156 10 9.03385 9.95768 9 9.87305L7.70508 6.75H3.0332L1.73828 9.87305C1.70443 9.95768 1.63672 10 1.53516 10H1.10352C0.968099 10 0.900391 9.93229 0.900391 9.79688C0.900391 9.76302 0.908854 9.73763 0.925781 9.7207L4.73438 0.503906C4.81901 0.334635 4.94596 0.25 5.11523 0.25H5.62305C5.79232 0.25 5.91927 0.334635 6.00391 0.503906ZM3.36328 5.9375H7.375L5.36914 1.11328L3.36328 5.9375Z" fill="#9497A0"/>
|
|
3
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/compute",
|
|
3
3
|
"friendlyName": "Compute",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.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
10
|
"dayjs": "latest",
|
|
10
11
|
"exceljs": "^4.3.0",
|
|
11
12
|
"file-saver": "^2.0.5",
|
|
@@ -14,12 +15,15 @@
|
|
|
14
15
|
"wu": "latest"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@types/
|
|
18
|
+
"@types/codemirror": "^5.60.5",
|
|
18
19
|
"@types/file-saver": "^2.0.3",
|
|
20
|
+
"@types/wu": "latest",
|
|
19
21
|
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
|
20
22
|
"@typescript-eslint/parser": "^5.1.0",
|
|
23
|
+
"css-loader": "^6.5.1",
|
|
21
24
|
"eslint": "^8.0.1",
|
|
22
25
|
"eslint-config-google": "^0.14.0",
|
|
26
|
+
"style-loader": "^3.3.1",
|
|
23
27
|
"webpack": "latest",
|
|
24
28
|
"webpack-cli": "latest"
|
|
25
29
|
},
|
package/scripts/pMax.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
//name:
|
|
1
|
+
//name: Pmax
|
|
2
2
|
//description: pMax Filtration Model
|
|
3
3
|
//language: javascript
|
|
4
|
-
//tags: model
|
|
4
|
+
//tags: model, filtration
|
|
5
5
|
//input: dataframe inputTable [Should contain columns Time (min), Vol (mL), P1 (psi), P2 (psi)]
|
|
6
|
-
//input: dataframe
|
|
6
|
+
//input: dataframe inputParametersForReporting
|
|
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,12 +12,11 @@
|
|
|
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
|
-
//input: int orderOfPolynomialRegression = 3 {caption: Order Of Polynomial Regression} [Order Of Polynomial Regression]
|
|
16
15
|
//meta.showInputs: true
|
|
17
|
-
//output: dataframe Filter1 {viewer: Scatter Plot(x: "TP 1 (L/m2)", y: "Res. 1 (psi/LMH)",
|
|
16
|
+
//output: dataframe Filter1 {viewer: Scatter Plot(x: "TP 1 (L/m2)", y: "Res. 1 (psi/LMH)", showDataframeFormulaLines: "true"); category: OUTPUT}
|
|
18
17
|
//output: dataframe t1 {category: OUTPUT}
|
|
19
18
|
//output: dataframe Guessed1 {category: OUTPUT}
|
|
20
|
-
//output: dataframe Filter2 {viewer: Scatter Plot(x: "TP 2 (L/m2)", y: "Res. 2 (psi/LMH)",
|
|
19
|
+
//output: dataframe Filter2 {viewer: Scatter Plot(x: "TP 2 (L/m2)", y: "Res. 2 (psi/LMH)", showDataframeFormulaLines: "true"); category: OUTPUT}
|
|
21
20
|
//output: dataframe t2 {category: OUTPUT}
|
|
22
21
|
//output: dataframe Guessed2 {category: OUTPUT}
|
|
23
22
|
|
|
@@ -74,6 +73,18 @@ function predictPolynomialRegression(coefficients, x) {
|
|
|
74
73
|
return result;
|
|
75
74
|
}
|
|
76
75
|
|
|
76
|
+
function equasionString(xColName, yColName, coefficients) {
|
|
77
|
+
let s = '';
|
|
78
|
+
for (let [index, coefficient] of coefficients.slice(1).reverse().entries()) {
|
|
79
|
+
s += String(coefficient);
|
|
80
|
+
for (let i = 0; i < coefficients.length - index - 1; i++)
|
|
81
|
+
s += " * ${" + String(xColName) + "}";
|
|
82
|
+
s += " + ";
|
|
83
|
+
}
|
|
84
|
+
return "${" + yColName + "} = " + s + String(coefficients[0]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const orderOfPolynomialRegression = 3;
|
|
77
88
|
const lengthOfSecondTable = 2985;
|
|
78
89
|
const colNames1 = {
|
|
79
90
|
'time': 'Time (min)',
|
|
@@ -109,7 +120,24 @@ Filter1 = DG.DataFrame.fromColumns([df1.col(colNames1['tp1']), df1.col(colNames1
|
|
|
109
120
|
Filter2 = DG.DataFrame.fromColumns([df1.col(colNames1['tp2']), df1.col(colNames1['res2'])]);
|
|
110
121
|
const coefficients1 = polynomialRegressionCoefficients(df1.col(colNames1['tp1']), df1.col(colNames1['res1']), orderOfPolynomialRegression);
|
|
111
122
|
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
|
+
|
|
126
|
+
Filter1.meta.addFormulaLine({
|
|
127
|
+
title: 'Parabola',
|
|
128
|
+
equation: equasionString(colNames1['tp1'], colNames1['res1'], coefficients1),
|
|
129
|
+
zindex: -30,
|
|
130
|
+
color: '#ff0000',
|
|
131
|
+
width: 2
|
|
132
|
+
});
|
|
112
133
|
|
|
134
|
+
Filter2.meta.addFormulaLine({
|
|
135
|
+
title: 'Parabola',
|
|
136
|
+
equation: equasionString(colNames1['tp2'], colNames1['res2'], coefficients2),
|
|
137
|
+
zindex: -30,
|
|
138
|
+
color: '#ff0000',
|
|
139
|
+
width: 2
|
|
140
|
+
});
|
|
113
141
|
|
|
114
142
|
const df2 = DG.DataFrame.create(lengthOfSecondTable);
|
|
115
143
|
df2.columns.addNewFloat(colNames2['area']).init((i) => (i > 0) ? batchVolume / i : 0);
|
package/scripts/vMaxJS.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
//name: Vmax
|
|
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
|
-
//tags: model
|
|
5
|
-
//input: dataframe inputTable {
|
|
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()}
|
|
6
7
|
//input: double testArea = 3.5 {caption: Test Filter Area; units: cm²} [Test Filter area]
|
|
7
8
|
//input: double vbatch = 25 {caption: Desired Volume of Batch; units: L} [Desired Volume of Batch]
|
|
8
9
|
//input: double tbatch = 0.5 {caption: Desired process time; units: hr} [Desired process time]
|
|
9
10
|
//input: double sf = 1.5 {caption: Safety Factor} [Safety Factor]
|
|
10
|
-
//input: int orderOfPolynomialRegression = 2 {caption: Order Of Polynomial Regression} [Order Of Polynomial Regression]
|
|
11
|
-
//meta.showInputs: true
|
|
12
11
|
//help-url: https://github.com/datagrok-ai/public/blob/master/packages/Compute/src/help.md
|
|
13
|
-
//output: dataframe regressionTable {viewer: Scatter Plot(
|
|
14
|
-
//output: dataframe absoluteFluxDecay {viewer: Scatter Plot(
|
|
15
|
-
//output: dataframe normalizedFluxDecay {viewer: Scatter Plot(
|
|
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}
|
|
16
15
|
//output: dataframe experimentalResults {category: OUTPUT}
|
|
17
16
|
//output: dataframe experimentalResultsSummary {category: OUTPUT}
|
|
18
17
|
//output: dataframe recommendations {category: OUTPUT}
|
|
@@ -22,42 +21,49 @@
|
|
|
22
21
|
|
|
23
22
|
volume = vbatch;
|
|
24
23
|
function gaussianElimination(input, orderOfPolynomialRegression) {
|
|
25
|
-
const n = input.length - 1
|
|
24
|
+
const n = input.length - 1; const coefficients = [orderOfPolynomialRegression];
|
|
26
25
|
for (let i = 0; i < n; i++) {
|
|
27
26
|
let maxrow = i;
|
|
28
|
-
for (let j = i + 1; j < n; j++)
|
|
29
|
-
if (Math.abs(input[i][j]) > Math.abs(input[i][maxrow]))
|
|
27
|
+
for (let j = i + 1; j < n; j++) {
|
|
28
|
+
if (Math.abs(input[i][j]) > Math.abs(input[i][maxrow])) {
|
|
30
29
|
maxrow = j;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
31
32
|
for (let k = i; k < n + 1; k++) {
|
|
32
33
|
const tmp = input[k][i];
|
|
33
34
|
input[k][i] = input[k][maxrow];
|
|
34
35
|
input[k][maxrow] = tmp;
|
|
35
36
|
}
|
|
36
|
-
for (let j = i + 1; j < n; j++)
|
|
37
|
-
for (let k = n; k >= i; k--)
|
|
37
|
+
for (let j = i + 1; j < n; j++) {
|
|
38
|
+
for (let k = n; k >= i; k--) {
|
|
38
39
|
input[k][j] -= (input[k][i] * input[i][j]) / input[i][i];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
for (let j = n - 1; j >= 0; j--) {
|
|
41
44
|
let total = 0;
|
|
42
|
-
for (let k = j + 1; k < n; k++)
|
|
45
|
+
for (let k = j + 1; k < n; k++) {
|
|
43
46
|
total += input[k][j] * coefficients[k];
|
|
47
|
+
}
|
|
44
48
|
coefficients[j] = (input[n][j] - total) / input[j][j];
|
|
45
49
|
}
|
|
46
50
|
return coefficients;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
function polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegression) {
|
|
50
|
-
const lhs = []
|
|
51
|
-
let a = 0
|
|
54
|
+
const lhs = []; const rhs = []; const len = xCol.length; const k = orderOfPolynomialRegression + 1;
|
|
55
|
+
let a = 0; let b = 0;
|
|
52
56
|
for (let i = 0; i < k; i++) {
|
|
53
|
-
for (let l = 0; l < len; l++)
|
|
57
|
+
for (let l = 0; l < len; l++) {
|
|
54
58
|
a += (xCol.get(l) ** i) * yCol.get(l);
|
|
59
|
+
}
|
|
55
60
|
lhs.push(a);
|
|
56
61
|
a = 0;
|
|
57
62
|
const c = [];
|
|
58
63
|
for (let j = 0; j < k; j++) {
|
|
59
|
-
for (let l = 0; l < len; l++)
|
|
64
|
+
for (let l = 0; l < len; l++) {
|
|
60
65
|
b += xCol.get(l) ** (i + j);
|
|
66
|
+
}
|
|
61
67
|
c.push(b);
|
|
62
68
|
b = 0;
|
|
63
69
|
}
|
|
@@ -67,42 +73,43 @@ function polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegressio
|
|
|
67
73
|
return gaussianElimination(rhs, k);
|
|
68
74
|
}
|
|
69
75
|
|
|
76
|
+
const orderOfPolynomialRegression = 2;
|
|
70
77
|
const area = 0.00035;
|
|
71
|
-
const isOutlierCol = inputTable.col(
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
const isOutlierCol = inputTable.col('isOutlier');
|
|
79
|
+
const timeMin = [];
|
|
80
|
+
const vol = [];
|
|
74
81
|
for (let i = 0; i < isOutlierCol.length; i++) {
|
|
75
82
|
if (isOutlierCol.get(i) == false) {
|
|
76
|
-
timeMin.push(inputTable.col(
|
|
77
|
-
vol.push(inputTable.col(
|
|
83
|
+
timeMin.push(inputTable.col('time (min)').get(i));
|
|
84
|
+
vol.push(inputTable.col('filtrate volume (mL)').get(i));
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
dfWithoutOutliers = DG.DataFrame.fromColumns([
|
|
81
|
-
DG.Column.fromList('double',
|
|
82
|
-
DG.Column.fromList('double',
|
|
88
|
+
DG.Column.fromList('double', 'time (min)', timeMin),
|
|
89
|
+
DG.Column.fromList('double', 'filtrate volume (mL)', vol),
|
|
83
90
|
]);
|
|
84
|
-
const timeInMinutes = dfWithoutOutliers.col(
|
|
85
|
-
const volumeInMilliliters = dfWithoutOutliers.col(
|
|
91
|
+
const timeInMinutes = dfWithoutOutliers.col('time (min)');
|
|
92
|
+
const volumeInMilliliters = dfWithoutOutliers.col('filtrate volume (mL)');
|
|
86
93
|
dfWithoutOutliers.columns.addNewFloat('time (hr)').init((i) => timeInMinutes.get(i) / 60);
|
|
87
|
-
const timeInHours = dfWithoutOutliers.col(
|
|
94
|
+
const timeInHours = dfWithoutOutliers.col('time (hr)');
|
|
88
95
|
|
|
89
96
|
dfWithoutOutliers.columns.addNewFloat('V (L/m2)').init((i) => 10 * volumeInMilliliters.get(i) / testArea);
|
|
90
97
|
const newVolume = dfWithoutOutliers.col('V (L/m2)');
|
|
91
98
|
|
|
92
|
-
dfWithoutOutliers.columns.addNewFloat(
|
|
99
|
+
dfWithoutOutliers.columns.addNewFloat('t/V (hr/(L/m2))').init((i) => 100 * timeInHours.get(i) / newVolume.get(i));
|
|
93
100
|
|
|
94
|
-
dfWithoutOutliers.columns.addNewFloat(
|
|
95
|
-
dfWithoutOutliers.columns.addNewFloat(
|
|
101
|
+
dfWithoutOutliers.columns.addNewFloat('Time (s)').init((i) => 60 * timeInMinutes.get(i));
|
|
102
|
+
dfWithoutOutliers.columns.addNewFloat('V (L)').init((i) => volumeInMilliliters.get(i) / 1000);
|
|
96
103
|
const volumeInLiters = dfWithoutOutliers.col('V (L)');
|
|
97
104
|
const timeInSeconds = dfWithoutOutliers.col('Time (s)');
|
|
98
105
|
dfWithoutOutliers.columns.addNewFloat('V/A (L/m2)').init((i) => volumeInLiters.get(i) / area);
|
|
99
106
|
const va = dfWithoutOutliers.col('V/A (L/m2)');
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
const ca = [];
|
|
108
|
+
const cb = [];
|
|
102
109
|
for (let i = 1; i < va.length - 3; i++) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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));
|
|
112
|
+
const coefficients = polynomialRegressionCoefficients(xCol, yCol, orderOfPolynomialRegression);
|
|
106
113
|
ca.push(coefficients[orderOfPolynomialRegression]);
|
|
107
114
|
cb.push(coefficients[orderOfPolynomialRegression - 1]);
|
|
108
115
|
}
|
|
@@ -122,9 +129,10 @@ const trialThroughput = va.max;
|
|
|
122
129
|
const flux = 9372.11;
|
|
123
130
|
const ff0 = flux / j.get(1);
|
|
124
131
|
experimentalResults = DG.DataFrame.fromColumns([
|
|
125
|
-
DG.Column.fromList('string', '
|
|
126
|
-
DG.Column.fromList('double', '
|
|
127
|
-
DG.Column.fromList('
|
|
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]),
|
|
128
136
|
]);
|
|
129
137
|
const meanFlux = j.stats.avg;
|
|
130
138
|
const vmax = 0.28;//Math.round(1 / coefficients[1]);
|
|
@@ -132,34 +140,52 @@ const instantaneousFlux = j.get(j.length - 1);
|
|
|
132
140
|
const initialFlux = j.get(1);
|
|
133
141
|
const fluxDecay = (1 - instantaneousFlux / initialFlux) * 100;
|
|
134
142
|
experimentalResultsSummary = DG.DataFrame.fromColumns([
|
|
135
|
-
DG.Column.fromList('string', '
|
|
136
|
-
DG.Column.fromList('
|
|
137
|
-
DG.Column.fromList('
|
|
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]),
|
|
138
151
|
]);
|
|
139
152
|
const q0 = Math.round(1 / coefficients[0]);
|
|
140
153
|
const amin = (vbatch / vmax) + (vbatch / tbatch / q0);
|
|
141
154
|
const installedArea = sf * amin;
|
|
142
155
|
const processLoading = volumeInLiters.get(volumeInLiters.length - 1) / installedArea;
|
|
143
156
|
recommendations = DG.DataFrame.fromColumns([
|
|
144
|
-
DG.Column.fromList('
|
|
145
|
-
DG.Column.fromList('double', '
|
|
146
|
-
DG.Column.fromList('
|
|
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)]),
|
|
147
165
|
]);
|
|
148
166
|
|
|
149
167
|
const v90 = vmax * 0.68;
|
|
150
168
|
const initialFlowArea = coefficients[0];
|
|
151
169
|
trialData = DG.DataFrame.fromColumns([
|
|
152
|
-
DG.Column.fromList('
|
|
153
|
-
DG.Column.fromList('double', '
|
|
154
|
-
DG.Column.fromList('
|
|
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]),
|
|
155
174
|
]);
|
|
156
175
|
|
|
157
176
|
filter = DG.DataFrame.fromColumns([
|
|
158
|
-
DG.Column.fromList('string', '
|
|
159
|
-
DG.Column.fromList('string', '
|
|
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)]),
|
|
160
183
|
]);
|
|
161
184
|
|
|
162
185
|
sampleCharacteristics = DG.DataFrame.fromColumns([
|
|
163
|
-
DG.Column.fromList('string', '
|
|
164
|
-
DG.Column.fromList('string', '
|
|
165
|
-
])
|
|
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
|
+
]);
|
package/src/export-funccall.ts
CHANGED
|
@@ -46,21 +46,85 @@ export async function exportFuncCall(call: DG.FuncCall) {
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// UWAGA: very fragile solution
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
const funcView = document.getElementsByClassName('grok-view grok-view-func ui-box')[0];
|
|
50
|
+
const resultView = funcView.getElementsByClassName('d4-tab-host ui-box')[0];
|
|
51
|
+
if (resultView) {
|
|
52
|
+
const tabs = resultView.getElementsByClassName('d4-tab-header-stripe')[0].children;
|
|
53
|
+
const selectedByUser = resultView.getElementsByClassName('d4-tab-header selected')[0];
|
|
54
|
+
for (let i=0; i< tabs.length; i++) {
|
|
55
|
+
(tabs[i] as HTMLElement).click();
|
|
56
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
57
|
+
|
|
58
|
+
const titleDivs = document.getElementsByClassName('grok-func-results-header');
|
|
59
|
+
if (!titleDivs.length) continue;
|
|
60
|
+
|
|
61
|
+
for (let i = 0; i < titleDivs.length; i++) {
|
|
62
|
+
const titleDiv = titleDivs[i];
|
|
63
|
+
|
|
64
|
+
const title = titleDiv.firstChild?.textContent;
|
|
65
|
+
if (title === null || title === undefined) continue;
|
|
66
|
+
|
|
67
|
+
let imageId;
|
|
68
|
+
let width = 0;
|
|
69
|
+
let height = 0;
|
|
70
|
+
|
|
71
|
+
const imageDiv = titleDiv.parentElement?.getElementsByClassName('grok-scripting-image-container')[0];
|
|
72
|
+
if (imageDiv) {
|
|
73
|
+
const regex = /background-image: url\(.*\)/;
|
|
74
|
+
const urlAttr = imageDiv.outerHTML.match(regex)?.[0];
|
|
75
|
+
if (!urlAttr) continue;
|
|
76
|
+
const url = urlAttr.substring(23, urlAttr?.length - 2);
|
|
77
|
+
const pic = (await (await fetch(url)).arrayBuffer());
|
|
78
|
+
imageId = exportWorkbook.addImage({
|
|
79
|
+
buffer: pic,
|
|
80
|
+
extension: 'png',
|
|
81
|
+
});
|
|
82
|
+
width = imageDiv.clientWidth;
|
|
83
|
+
height = imageDiv.clientHeight;
|
|
84
|
+
} else {
|
|
85
|
+
const plot = titleDiv.nextSibling;
|
|
86
|
+
// if plot does not exist or it is only grid, skip it
|
|
87
|
+
if (!plot || (plot.firstChild?.firstChild?.firstChild as HTMLElement).getAttribute('name') === 'viewer-Grid') continue;
|
|
88
|
+
|
|
89
|
+
if (plot) {
|
|
90
|
+
const canvas = await DG.HtmlUtils.renderToCanvas(plot as HTMLElement);
|
|
91
|
+
const dataUrl = canvas.toDataURL('image/png');
|
|
92
|
+
|
|
93
|
+
imageId = exportWorkbook.addImage({
|
|
94
|
+
base64: dataUrl,
|
|
95
|
+
extension: 'png',
|
|
96
|
+
});
|
|
97
|
+
width = canvas.width;
|
|
98
|
+
height = canvas.height;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
55
101
|
|
|
56
|
-
|
|
57
|
-
if (!titleDivs.length) continue;
|
|
102
|
+
if (imageId === null || imageId === undefined) continue;
|
|
58
103
|
|
|
59
|
-
|
|
104
|
+
const worksheet = exportWorkbook.getWorksheet(`Output - ${title}`);
|
|
105
|
+
if (worksheet) {
|
|
106
|
+
const columnForImage = ((call.outputs[title] as DG.DataFrame).columns as DG.ColumnList).length + 1;
|
|
107
|
+
worksheet.addImage(imageId, {
|
|
108
|
+
tl: {col: columnForImage, row: 0},
|
|
109
|
+
ext: {width, height},
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
const newWorksheet = exportWorkbook.addWorksheet(`Output - Plot - ${title}`);
|
|
113
|
+
newWorksheet.addImage(imageId, {
|
|
114
|
+
tl: {col: 0, row: 0},
|
|
115
|
+
ext: {width, height},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
(selectedByUser as HTMLElement).click();
|
|
121
|
+
} else {
|
|
122
|
+
const resultView = document.getElementsByClassName('ui-panel grok-func-results')[0];
|
|
123
|
+
const titleDivs = resultView.getElementsByClassName('grok-func-results-header');
|
|
124
|
+
for (let i=0; i< titleDivs.length; i++) {
|
|
60
125
|
const titleDiv = titleDivs[i];
|
|
61
|
-
|
|
62
126
|
const title = titleDiv.firstChild?.textContent;
|
|
63
|
-
if (
|
|
127
|
+
if (title === null || title === undefined) continue;
|
|
64
128
|
|
|
65
129
|
let imageId;
|
|
66
130
|
let width = 0;
|
|
@@ -82,7 +146,7 @@ export async function exportFuncCall(call: DG.FuncCall) {
|
|
|
82
146
|
} else {
|
|
83
147
|
const plot = titleDiv.nextSibling;
|
|
84
148
|
// if plot does not exist or it is only grid, skip it
|
|
85
|
-
if (!plot || (plot.firstChild as HTMLElement).getAttribute('name') === 'viewer-Grid') continue;
|
|
149
|
+
if (!plot || (plot.firstChild?.firstChild?.firstChild as HTMLElement).getAttribute('name') === 'viewer-Grid') continue;
|
|
86
150
|
|
|
87
151
|
if (plot) {
|
|
88
152
|
const canvas = await DG.HtmlUtils.renderToCanvas(plot as HTMLElement);
|
|
@@ -115,7 +179,6 @@ export async function exportFuncCall(call: DG.FuncCall) {
|
|
|
115
179
|
}
|
|
116
180
|
}
|
|
117
181
|
}
|
|
118
|
-
(selectedByUser as HTMLElement).click();
|
|
119
182
|
|
|
120
183
|
const outputScalarsSheet = exportWorkbook.addWorksheet('Output scalars');
|
|
121
184
|
scalarOutputs.forEach((scalarOutput) => {
|