@datagrok/compute 0.2.5 → 0.3.0

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/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>
@@ -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>
@@ -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>
@@ -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,10 +1,11 @@
1
1
  {
2
2
  "name": "@datagrok/compute",
3
3
  "friendlyName": "Compute",
4
- "version": "0.2.5",
4
+ "version": "0.3.0",
5
5
  "description": "",
6
6
  "dependencies": {
7
7
  "cash-dom": "latest",
8
+ "codemirror": "^5.64.0",
8
9
  "datagrok-api": ">=0.95.8",
9
10
  "dayjs": "latest",
10
11
  "exceljs": "^4.3.0",
@@ -14,8 +15,9 @@
14
15
  "wu": "latest"
15
16
  },
16
17
  "devDependencies": {
17
- "@types/wu": "latest",
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",
21
23
  "eslint": "^8.0.1",
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:Amin Filter 1 guessed} [Amin Filter 1 guessed]
10
- //input: double aMinFilter2Guessed = 0.153 {units: m²; caption:Amin Filter 2 guessed} [Amin Filter 2 guessed]
11
- //input: double filterArea1 = 23 {units: m²} [Filter Area 1]
12
- //input: double filterArea2 = 23 {units: m²} [Filter Area 2]
13
- //input: double sf1 = 1.5 {caption: SF1}
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
- //output: dataframe Filter1 {viewer: Scatter Plot(x: "TP 1 (L/m2)", y: "Res. 1 (psi/LMH)", showRegressionLine: "true"); category: PRIMARY FILTER}
17
- //output: dataframe Filter2 {viewer: Scatter Plot(x: "TP 2 (L/m2)", y: "Res. 2 (psi/LMH)", showRegressionLine: "true"); category: SECONDARY FILTER}
18
- //output: double amin1 {units: m²; caption: Amin; category: PRIMARY FILTER}
19
- //output: double amin2 {units: m²; caption: Amin; category: SECONDARY FILTER}
20
- //output: double aminSF1 {units: m²; caption: Amin SF; category: PRIMARY FILTER}
21
- //output: double aminSF2 {units: m²; caption: Amin SF; category: SECONDARY FILTER}
22
- //output: double trialLoading1 {units: L/m²; caption: Trial Loading; category: PRIMARY FILTER}
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 = sf1 * amin1, aminSF2 = sf2 * amin2;
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.ai/help/access/parameterized-queries
13
- //output: dataframe regressionTable {viewer: Scatter Plot(x: "time (min)", y: "filtrate volume (mL)", filter: "!${isOutlier}", showFilteredOutPoints: "true", color: "isOutlier", showRegressionLine: "true"); category: OUTPUT}
14
- //output: dataframe absoluteFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J (LMH)", showRegressionLine: "true"); category: OUTPUT}
15
- //output: dataframe normalizedFluxDecay {viewer: Scatter Plot(x: "V/A (L/m2)", y: "J/Jo", showRegressionLine: "true"); category: OUTPUT}
16
- //output: double volume {caption: Volume, L; category: 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
- // coefficients = polynomialRegressionCoefficients(inputTable.col("time (hr)"), dfWithoutOutliers.col("t/V (hr/(L/m2))"), 1);
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
+ ]);
@@ -62,28 +62,55 @@ export async function exportFuncCall(call: DG.FuncCall) {
62
62
  const title = titleDiv.firstChild?.textContent;
63
63
  if (!title) continue;
64
64
 
65
- const plot = titleDiv.nextSibling;
66
- if (!plot) continue;
67
-
68
- const canvas = await DG.HtmlUtils.renderToCanvas(plot as HTMLElement);
69
- const dataUrl = canvas.toDataURL('image/png');
70
- const testImageId = exportWorkbook.addImage({
71
- base64: dataUrl,
72
- extension: 'png',
73
- });
74
- const worksheet = exportWorkbook.getWorksheet(`Output - ${title}`);
65
+ let imageId;
66
+ let width = 0;
67
+ let height = 0;
68
+
69
+ const imageDiv = titleDiv.parentElement?.getElementsByClassName('grok-scripting-image-container')[0];
70
+ if (imageDiv) {
71
+ const regex = /background-image: url\(.*\)/;
72
+ const urlAttr = imageDiv.outerHTML.match(regex)?.[0];
73
+ if (!urlAttr) continue;
74
+ const url = urlAttr.substring(23, urlAttr?.length - 2);
75
+ const pic = (await (await fetch(url)).arrayBuffer());
76
+ imageId = exportWorkbook.addImage({
77
+ buffer: pic,
78
+ extension: 'png',
79
+ });
80
+ width = imageDiv.clientWidth;
81
+ height = imageDiv.clientHeight;
82
+ } else {
83
+ const plot = titleDiv.nextSibling;
84
+ // if plot does not exist or it is only grid, skip it
85
+ if (!plot || (plot.firstChild as HTMLElement).getAttribute('name') === 'viewer-Grid') continue;
86
+
87
+ if (plot) {
88
+ const canvas = await DG.HtmlUtils.renderToCanvas(plot as HTMLElement);
89
+ const dataUrl = canvas.toDataURL('image/png');
90
+
91
+ imageId = exportWorkbook.addImage({
92
+ base64: dataUrl,
93
+ extension: 'png',
94
+ });
95
+ width = canvas.width;
96
+ height = canvas.height;
97
+ }
98
+ }
99
+
100
+ if (imageId === null || imageId === undefined) continue;
75
101
 
102
+ const worksheet = exportWorkbook.getWorksheet(`Output - ${title}`);
76
103
  if (worksheet) {
77
104
  const columnForImage = ((call.outputs[title] as DG.DataFrame).columns as DG.ColumnList).length + 1;
78
- worksheet.addImage(testImageId, {
105
+ worksheet.addImage(imageId, {
79
106
  tl: {col: columnForImage, row: 0},
80
- ext: {width: canvas.width, height: canvas.height},
107
+ ext: {width, height},
81
108
  });
82
109
  } else {
83
110
  const newWorksheet = exportWorkbook.addWorksheet(`Output - Plot - ${title}`);
84
- newWorksheet.addImage(testImageId, {
111
+ newWorksheet.addImage(imageId, {
85
112
  tl: {col: 0, row: 0},
86
- ext: {width: canvas.width, height: canvas.height},
113
+ ext: {width, height},
87
114
  });
88
115
  }
89
116
  }
@@ -0,0 +1,442 @@
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+ import CodeMirror from 'codemirror';
5
+ import {_package} from '../package';
6
+
7
+ const enum FUNC_PROPS_FIELDS {
8
+ NAME = 'name',
9
+ DESCRIPTION = 'description',
10
+ LANGUAGE = 'language',
11
+ HELP_URL = 'helpUrl',
12
+ REFERENCE = 'reference',
13
+ LOGIN = 'author?.login',
14
+ SAMPLE = 'sample',
15
+ ENVIRONMENT = 'environment',
16
+ TAGS = 'tags'
17
+ };
18
+
19
+ const obligatoryFuncProps = ['name', 'description', 'helpUrl', 'language'];
20
+
21
+ const functionPropsLabels = (key: FUNC_PROPS_FIELDS) => {
22
+ switch (key) {
23
+ case FUNC_PROPS_FIELDS.NAME: return 'Name';
24
+ case FUNC_PROPS_FIELDS.DESCRIPTION: return 'Description';
25
+ case FUNC_PROPS_FIELDS.LOGIN: return 'Author';
26
+ case FUNC_PROPS_FIELDS.HELP_URL: return 'Help URL';
27
+ case FUNC_PROPS_FIELDS.LANGUAGE: return 'Language';
28
+ case FUNC_PROPS_FIELDS.REFERENCE: return 'Reference';
29
+ case FUNC_PROPS_FIELDS.SAMPLE: return 'Sample';
30
+ case FUNC_PROPS_FIELDS.ENVIRONMENT: return 'Environment';
31
+ case FUNC_PROPS_FIELDS.TAGS: return 'Tags';
32
+ }
33
+ };
34
+
35
+ const functionPropsCode = (key: FUNC_PROPS_FIELDS) => {
36
+ switch (key) {
37
+ case FUNC_PROPS_FIELDS.NAME: return 'name';
38
+ case FUNC_PROPS_FIELDS.DESCRIPTION: return 'description';
39
+ case FUNC_PROPS_FIELDS.LOGIN: return 'author';
40
+ case FUNC_PROPS_FIELDS.HELP_URL: return 'helpUrl';
41
+ case FUNC_PROPS_FIELDS.LANGUAGE: return 'language';
42
+ case FUNC_PROPS_FIELDS.REFERENCE: return 'reference';
43
+ case FUNC_PROPS_FIELDS.SAMPLE: return 'sample';
44
+ case FUNC_PROPS_FIELDS.ENVIRONMENT: return 'environment';
45
+ case FUNC_PROPS_FIELDS.TAGS: return 'tags';
46
+ }
47
+ };
48
+
49
+ type FuncPropsState = {
50
+ [FUNC_PROPS_FIELDS.NAME]: string | null,
51
+ [FUNC_PROPS_FIELDS.DESCRIPTION]: string | null,
52
+ [FUNC_PROPS_FIELDS.LANGUAGE]: string | null,
53
+ [FUNC_PROPS_FIELDS.HELP_URL]: string | null,
54
+ [FUNC_PROPS_FIELDS.REFERENCE]: string | null,
55
+ [FUNC_PROPS_FIELDS.LOGIN]: string | null,
56
+ [FUNC_PROPS_FIELDS.SAMPLE]: string | null,
57
+ [FUNC_PROPS_FIELDS.ENVIRONMENT]: string | null,
58
+ [FUNC_PROPS_FIELDS.TAGS]: string | null,
59
+ }
60
+
61
+ const funcParamTypes = [
62
+ DG.TYPE.BOOL,
63
+ DG.TYPE.COLUMN_LIST,
64
+ DG.TYPE.COLUMN,
65
+ DG.TYPE.DATA_FRAME,
66
+ DG.TYPE.DATE_TIME,
67
+ DG.TYPE.FLOAT,
68
+ DG.TYPE.GRAPHICS,
69
+ DG.TYPE.INT,
70
+ DG.TYPE.STRING,
71
+ ];
72
+
73
+ const enum FUNC_PARAM_FIELDS {
74
+ DIRECTION = 'direction',
75
+ TYPE = 'propertyType',
76
+ NAME = 'name',
77
+ DEFAULT_VALUE = 'defaultValue',
78
+ DESCRIPTION = 'description',
79
+ CATEGORY = 'category',
80
+ };
81
+
82
+ const enum DIRECTION {
83
+ INPUT= 'input',
84
+ OUTPUT= 'output',
85
+ }
86
+
87
+ const functionParamsLabels = (key: FUNC_PARAM_FIELDS) => {
88
+ switch (key) {
89
+ case FUNC_PARAM_FIELDS.DIRECTION: return 'Direction';
90
+ case FUNC_PARAM_FIELDS.TYPE: return 'Type';
91
+ case FUNC_PARAM_FIELDS.NAME: return 'Name';
92
+ case FUNC_PARAM_FIELDS.DEFAULT_VALUE: return 'Default value';
93
+ case FUNC_PARAM_FIELDS.DESCRIPTION: return 'Description';
94
+ case FUNC_PARAM_FIELDS.CATEGORY: return 'Category';
95
+ }
96
+ };
97
+
98
+ export function _functionEditor(functionCode: string) {
99
+ const inputScript = DG.Script.create(functionCode);
100
+
101
+ const editorView = DG.View.create();
102
+ editorView.name = 'Function Editor';
103
+
104
+ const functionPropsCopy: FuncPropsState = {
105
+ [FUNC_PROPS_FIELDS.NAME]: inputScript.name || null,
106
+ [FUNC_PROPS_FIELDS.DESCRIPTION]: inputScript.description || null,
107
+ [FUNC_PROPS_FIELDS.LANGUAGE]: inputScript.language || null,
108
+ [FUNC_PROPS_FIELDS.HELP_URL]: inputScript.helpUrl || null,
109
+ [FUNC_PROPS_FIELDS.REFERENCE]: inputScript.reference || null,
110
+ [FUNC_PROPS_FIELDS.LOGIN]: inputScript.author?.login || null,
111
+ [FUNC_PROPS_FIELDS.SAMPLE]: inputScript.sample || null,
112
+ [FUNC_PROPS_FIELDS.ENVIRONMENT]: inputScript.environment || null,
113
+ [FUNC_PROPS_FIELDS.TAGS]: inputScript.tags?.join(' ') || null,
114
+ };
115
+
116
+ const getNewProps = () => {
117
+ const newProps = [];
118
+ for (const key of Object.keys(functionPropsCopy)) {
119
+ if (functionPropsCopy[key as keyof FuncPropsState] == null) {
120
+ newProps.push(key);
121
+ }
122
+ }
123
+ return newProps;
124
+ };
125
+
126
+ let addButton = ui.div();
127
+ let propsForm = ui.div();
128
+ let inputs = ui.div();
129
+
130
+ const renderAddPropButton = () => {
131
+ if (!getNewProps().length) return ui.div();
132
+
133
+ const onItemClick = (item: string) => {
134
+ functionPropsCopy[item as keyof FuncPropsState] = '';
135
+ const newInputs = ui.inputs(
136
+ Object.keys(functionPropsCopy)
137
+ .filter((prop) => functionPropsCopy[prop as keyof FuncPropsState] !== null)
138
+ .map((prop) => addFullWidthInput(
139
+ ui.stringInput(
140
+ functionPropsLabels(prop as keyof FuncPropsState),
141
+ functionPropsCopy[prop as keyof FuncPropsState] || ''), prop,
142
+ )),
143
+ );
144
+ inputs.replaceWith(newInputs);
145
+ inputs = newInputs;
146
+ refreshPreview();
147
+ const newAddButton = renderAddPropButton();
148
+ addButton.replaceWith(newAddButton);
149
+ addButton = newAddButton;
150
+ };
151
+ const menu = DG.Menu.popup().items(getNewProps(), onItemClick);
152
+
153
+ const shevron = ui.iconFA('chevron-down');
154
+ const button = ui.button([ui.icons.add(()=>{}), shevron], () => {
155
+ menu.show();
156
+ });
157
+
158
+ const div = ui.div([button]);
159
+ div.style.cssText += 'margin-left: 152px';
160
+ return div;
161
+ };
162
+
163
+ const addFullWidthInput = (input: DG.InputBase, propName: string) => {
164
+ (input.root.lastChild as HTMLElement).style.cssText+='width: 400px; max-width: inherit;';
165
+ input.onInput(() => {
166
+ functionPropsCopy[propName as keyof typeof functionPropsCopy] = input.stringValue;
167
+ refreshPreview();
168
+ });
169
+ (input.root as HTMLInputElement).placeholder = 'Enter your value...';
170
+ input.root.append(ui.button(ui.icons.delete(()=>{}), () => {
171
+ functionPropsCopy[propName as keyof typeof functionPropsCopy] = null;
172
+ refreshPreview();
173
+ input.root.remove();
174
+ const newAddButton = renderAddPropButton();
175
+ addButton.replaceWith(newAddButton);
176
+ addButton = newAddButton;
177
+ }));
178
+ (input.root.lastChild as HTMLElement).style.cssText+='display: inline-flex; justify-content: center; flex-direction: column';
179
+ if (obligatoryFuncProps.includes(propName)) {
180
+ input.root.style.cssText += 'padding-right: 35.375px';
181
+ (input.root.lastChild as HTMLElement).style.cssText+='display: none;';
182
+ }
183
+ return input;
184
+ };
185
+
186
+ const functionPropsForm = () => {
187
+ addButton = renderAddPropButton();
188
+
189
+ inputs = ui.inputs(
190
+ Object.keys(functionPropsCopy)
191
+ .filter((prop) => !!functionPropsCopy[prop as keyof FuncPropsState])
192
+ .map((prop) => addFullWidthInput(
193
+ ui.stringInput(
194
+ functionPropsLabels(prop as keyof FuncPropsState),
195
+ functionPropsCopy[prop as keyof FuncPropsState] || ''), prop,
196
+ )),
197
+ );
198
+ return ui.panel([
199
+ ui.divV([
200
+ inputs,
201
+ addButton,
202
+ ]),
203
+ ]);
204
+ };
205
+
206
+ let functionInputParamsCopy = inputScript.inputs;
207
+ let functionOutputParamsCopy = inputScript.outputs;
208
+
209
+ const iconsByTypes = (type: DG.TYPE) => {
210
+ switch (type) {
211
+ case DG.TYPE.BOOL: return ui.iconImage(DG.TYPE.BOOL, `${_package.webRoot}/icons/Bool.svg`);
212
+ case DG.TYPE.COLUMN_LIST: return ui.iconImage(DG.TYPE.BOOL, `${_package.webRoot}/icons/Column-list.svg`);
213
+ case DG.TYPE.COLUMN: return ui.iconImage(DG.TYPE.COLUMN, `${_package.webRoot}/icons/Column.svg`);
214
+ case DG.TYPE.DATA_FRAME: return ui.iconImage(DG.TYPE.DATA_FRAME, `${_package.webRoot}/icons/Dataframe.svg`);
215
+ case DG.TYPE.DATE_TIME: return ui.iconImage(DG.TYPE.COLUMN, `${_package.webRoot}/icons/Datetime.svg`);
216
+ case DG.TYPE.FLOAT: return ui.iconImage(DG.TYPE.FLOAT, `${_package.webRoot}/icons/Double.svg`);
217
+ case DG.TYPE.GRAPHICS: return ui.iconImage(DG.TYPE.GRAPHICS, `${_package.webRoot}/icons/Graphics.svg`);
218
+ case DG.TYPE.INT: return ui.iconImage(DG.TYPE.FLOAT, `${_package.webRoot}/icons/Int.svg`);
219
+ case DG.TYPE.STRING: return ui.iconImage(DG.TYPE.STRING, `${_package.webRoot}/icons/String.svg`);
220
+ default: return ui.iconImage('Blob', `${_package.webRoot}/icons/Blob.svg`);
221
+ }
222
+ };
223
+
224
+ const onFunctionParamClick = (paramName: string, card: HTMLElement, direction: DIRECTION) => {
225
+ const acc = ui.accordion();
226
+ acc.root.style.cssText += 'min-width: 400px';
227
+
228
+ acc.addPane('General', ()=> {
229
+ let paramIndex: number;
230
+ let param: DG.Property;
231
+
232
+ if (direction === DIRECTION.INPUT) {
233
+ paramIndex = functionInputParamsCopy.findIndex((input) => input.name === paramName);
234
+ param = functionInputParamsCopy[paramIndex];
235
+ } else {
236
+ paramIndex= functionOutputParamsCopy.findIndex((input) => input.name === paramName);
237
+ param = functionOutputParamsCopy[paramIndex];
238
+ }
239
+
240
+ if (!param) return ui.div('');
241
+
242
+ const updateCard = (propName: string, v: any) => {
243
+ (param as any)[propName] = v;
244
+ const newCard = renderCard(param, direction);
245
+ card.replaceWith(newCard);
246
+ card = newCard;
247
+ refreshPreview();
248
+ };
249
+
250
+ const funcParams: DG.Property[] = [
251
+ (() => {
252
+ const temp = DG.Property.create(FUNC_PARAM_FIELDS.DIRECTION, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.DIRECTION], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.DIRECTION, v), '');
253
+ temp.options({choices: ['input', 'output']});
254
+ return temp;
255
+ })(),
256
+ (() => {
257
+ const temp = DG.Property.create(FUNC_PARAM_FIELDS.TYPE, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.TYPE], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.TYPE, v), '');
258
+ temp.options({choices: funcParamTypes});
259
+ return temp;
260
+ })(),
261
+ DG.Property.create(FUNC_PARAM_FIELDS.NAME, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.NAME], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.NAME, v), ''),
262
+ DG.Property.create(FUNC_PARAM_FIELDS.DEFAULT_VALUE, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.DEFAULT_VALUE], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.DEFAULT_VALUE, v), ''),
263
+ (() => {
264
+ const temp = DG.Property.create(FUNC_PARAM_FIELDS.DESCRIPTION, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.DESCRIPTION], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.DESCRIPTION, v), '');
265
+ temp.options({editor: 'textarea'});
266
+ return temp;
267
+ })(),
268
+ DG.Property.create(FUNC_PARAM_FIELDS.CATEGORY, DG.TYPE.STRING, (x: any) => x[FUNC_PARAM_FIELDS.CATEGORY], (x: any, v) => updateCard(FUNC_PARAM_FIELDS.CATEGORY, v), ''),
269
+ ];
270
+
271
+ const paramProps = funcParams
272
+ .filter((param) => param.name !== FUNC_PARAM_FIELDS.DIRECTION);
273
+
274
+ const result = ui.input.form(param, paramProps);
275
+
276
+ return ui.div(result);
277
+ });
278
+
279
+ acc.addPane('Connections', ()=> {
280
+ return ui.div();
281
+ });
282
+
283
+ acc.addPane('Viewers', ()=> {
284
+ return ui.div();
285
+ });
286
+
287
+
288
+ grok.shell.o = ui.divV([ui.h1(`Param: ${paramName}`), acc.root]);
289
+ };
290
+
291
+ const funcParams: DG.Property[] = [
292
+ DG.Property.jsString(FUNC_PARAM_FIELDS.DIRECTION),
293
+ DG.Property.jsString(FUNC_PARAM_FIELDS.TYPE),
294
+ DG.Property.jsString(FUNC_PARAM_FIELDS.NAME),
295
+ DG.Property.jsString(FUNC_PARAM_FIELDS.DEFAULT_VALUE),
296
+ DG.Property.jsString(FUNC_PARAM_FIELDS.DESCRIPTION),
297
+ DG.Property.jsString(FUNC_PARAM_FIELDS.CATEGORY),
298
+ ];
299
+
300
+
301
+ const renderCard = (functionParam: DG.Property, direction: DIRECTION) => {
302
+ const iconStyle = {style: {
303
+ 'display': 'flex',
304
+ 'flex-direction': 'column',
305
+ 'justify-content': 'center',
306
+ 'width': '32.5px',
307
+ 'align-items': 'center',
308
+ }};
309
+
310
+ const editButtonDiv = ui.div(ui.button(ui.icons.edit(()=>{}), () =>{
311
+ onFunctionParamClick(functionParam.name, tempCard, direction);
312
+ }), {
313
+ style: {
314
+ ...iconStyle.style,
315
+ 'visibility': 'hidden',
316
+ },
317
+ });
318
+
319
+ const tempCard = ui.divH([
320
+ ui.div(iconsByTypes(functionParam.propertyType), iconStyle),
321
+ ui.divV([
322
+ ui.span([functionParam.name], {style: {'font-weight': 'bold'}}),
323
+ ui.span([funcParams
324
+ .filter((param) => param.name !== FUNC_PARAM_FIELDS.NAME)
325
+ .map((param) => (functionParam as any)[param.name])
326
+ .filter((paramValue) => !!paramValue).join(' | '),
327
+ ]),
328
+ ], {style: {'width': '100%', 'padding': '5px'}}),
329
+ editButtonDiv,
330
+ ui.div(ui.button(ui.icons.delete(()=>{}), () =>{
331
+ if (direction === DIRECTION.INPUT) {
332
+ functionInputParamsCopy = functionInputParamsCopy.filter((param) => param !== functionParam);
333
+ } else {
334
+ functionOutputParamsCopy = functionOutputParamsCopy.filter((param) => param !== functionParam);
335
+ }
336
+ refreshPreview();
337
+ tempCard.remove();
338
+ }), iconStyle),
339
+ ], {style: {'border-bottom': 'thin solid #ECEFF2'}});
340
+ tempCard.addEventListener('click', () => onFunctionParamClick(functionParam.name, tempCard, direction));
341
+ tempCard.addEventListener('mouseover', () => editButtonDiv.style.visibility = 'visible');
342
+ tempCard.addEventListener('mouseout', () => editButtonDiv.style.visibility = 'hidden');
343
+ return tempCard;
344
+ };
345
+
346
+ let inputParamCards = ui.divV(
347
+ functionInputParamsCopy.map((functionParam) => renderCard(functionParam, DIRECTION.INPUT)),
348
+ );
349
+ const outputParamCards = ui.divV(
350
+ functionOutputParamsCopy.map((functionParam) => renderCard(functionParam, DIRECTION.OUTPUT)),
351
+ );
352
+
353
+ const area = ui.textInput('', '');
354
+ const myCM = CodeMirror.fromTextArea((area.input as HTMLTextAreaElement), {});
355
+
356
+ const previewDiv = ui.divV([ui.h1('Code preview'), area]);
357
+ previewDiv.style.flexGrow = '1';
358
+
359
+ propsForm = functionPropsForm();
360
+
361
+ const renderAddParamButton = () => {
362
+ const paramProps = funcParams
363
+ .filter((param) => param.name !== FUNC_PARAM_FIELDS.DIRECTION);
364
+
365
+ const newParam: DG.PropertyOptions = {};
366
+
367
+ const onItemClick = () => {
368
+ ui.dialog('Add parameter')
369
+ .add(ui.input.form(newParam, paramProps))
370
+ .onOK(() => {
371
+ functionInputParamsCopy.push(DG.Property.fromOptions(newParam));
372
+ const newInputParamsCards = ui.divV(
373
+ functionInputParamsCopy.map((functionParam) => renderCard(functionParam, DIRECTION.INPUT)),
374
+ );
375
+ inputParamCards.replaceWith(newInputParamsCards);
376
+ inputParamCards = newInputParamsCards;
377
+ refreshPreview();
378
+ })
379
+ .show();
380
+ };
381
+
382
+ const menu = DG.Menu.popup().items(funcParamTypes, onItemClick);
383
+
384
+ const shevron = ui.iconFA('chevron-down');
385
+ const button = ui.button([ui.icons.add(()=>{}), shevron], () => {
386
+ menu.show();
387
+ });
388
+
389
+ const div = ui.div([button]);
390
+ return div;
391
+ };
392
+ const addInputButton = renderAddParamButton();
393
+ const addOutputButton = renderAddParamButton();
394
+
395
+ const tabs = ui.tabControl({
396
+ 'PROPERTIES': propsForm,
397
+ 'PARAMETERS': ui.divV([
398
+ ui.div(ui.h1('Input: '), {style: {'padding': '12px 12px 0px 12px'}}),
399
+ inputParamCards,
400
+ addInputButton,
401
+ ui.div(ui.h1('Output: '), {style: {'padding': '12px 12px 0px 12px'}}),
402
+ outputParamCards,
403
+ addOutputButton,
404
+ ]),
405
+ });
406
+ tabs.root.style.width = '100%';
407
+ tabs.root.style.flexGrow = '3';
408
+
409
+ editorView.append(
410
+ ui.divV([
411
+ tabs,
412
+ previewDiv,
413
+ ]),
414
+ );
415
+ editorView.box = true;
416
+ editorView.setRibbonPanels([
417
+ [
418
+ ui.iconFA('eye', () => {
419
+ previewDiv.hidden ? previewDiv.hidden = false : previewDiv.hidden = true;
420
+ }),
421
+ ui.bigButton('Save', () => grok.shell.info('plus')),
422
+ ],
423
+ ]);
424
+
425
+ const refreshPreview = () => {
426
+ let result = '';
427
+ Object.keys(functionPropsCopy).map((propField) => {
428
+ const propValue = functionPropsCopy[propField as keyof FuncPropsState];
429
+ if (propValue) result += `#${functionPropsCode(propField as keyof FuncPropsState)}: ${propValue}\n`;
430
+ });
431
+ functionInputParamsCopy.map((param) => {
432
+ result += `#input: ${param.propertyType} ${param.name}\n`;
433
+ });
434
+ functionOutputParamsCopy.map((param) => {
435
+ result += `#output: ${param.propertyType} ${param.name}\n`;
436
+ });
437
+ myCM.setValue(result);
438
+ };
439
+
440
+ grok.shell.addView(editorView);
441
+ refreshPreview();
442
+ }
@@ -244,7 +244,7 @@ export async function selectOutliersManually(inputData: DG.DataFrame) {
244
244
  groupsListGrid.root,
245
245
  ], {style: {height: '75%'}}),
246
246
  ]),
247
- ], {style: {height: '100%'}}),
247
+ ], {style: {'height': '100%', 'min-height': '600px'}}),
248
248
  )
249
249
  .onOK(() => {
250
250
  shouldCancel = false;
@@ -268,7 +268,7 @@ export async function selectOutliersManually(inputData: DG.DataFrame) {
268
268
  cancelAllChanges();
269
269
  resolve({augmentedInput: inputData, editedInput});
270
270
  }, 100));
271
- selectionDialog.show({width: 1000, height: 800});
271
+ selectionDialog.show({width: 1000});
272
272
  });
273
273
 
274
274
  return result;
package/src/package.ts CHANGED
@@ -8,6 +8,7 @@ import {exportFuncCall} from './export-funccall';
8
8
  import {_functionParametersGrid} from './function-views/function-parameters-grid';
9
9
  import {ModelCatalogView} from './model-catalog-view';
10
10
  import wu from 'wu';
11
+ import {_functionEditor} from './function-editor/function-editor';
11
12
 
12
13
  let initCompleted: boolean = false;
13
14
  export const _package = new DG.Package();
@@ -52,6 +53,71 @@ export function exportToExcel(call: DG.FuncCall) {
52
53
  exportFuncCall(call);
53
54
  }
54
55
 
56
+ //name: Function Editor
57
+ export function functionEditor() {
58
+ const sampleScript = `
59
+ #name: Chemical Space Using tSNE
60
+ #description: Chemical space using t-distributed Stochastic Neighbor Embedding
61
+ #help-url: https://datagrok.ai/help/domains/chem/functions/tsne
62
+ #language: python
63
+ #sample: chem/smiles_coordinates.csv
64
+ #tags: demo, chem, rdkit
65
+ #input: dataframe data [Input data table]
66
+ #input: column smiles {type:categorical, semType: Molecule} [Molecules, in SMILES format]
67
+ #input: int components = 2 [Number of components]
68
+ #input: int minClusterSize = 3 [Minimum cluster size]
69
+ #output: graphics spanningTree
70
+ #output: graphics linkageTree
71
+ #output: graphics chemSpace
72
+
73
+ import numba
74
+ import hdbscan
75
+ import numpy as np
76
+ import matplotlib.pyplot as plt
77
+ from sklearn.manifold import TSNE
78
+ from rdkit import Chem
79
+ from rdkit.Chem import AllChem
80
+ from rdkit.Chem import Draw
81
+ from rdkit.Chem import DataStructs
82
+
83
+ smiles = data[smiles]
84
+ mols = [Chem.MolFromSmiles(mol) for mol in smiles]
85
+ mols = [mol for mol in mols if mol is not None]
86
+ for mol in mols:
87
+ AllChem.Compute2DCoords(mol)
88
+ X = []
89
+ for mol in mols:
90
+ arr = np.zeros((0,))
91
+ fp = AllChem.GetMorganFingerprintAsBitVect(mol, 2)
92
+ DataStructs.ConvertToNumpyArray(fp, arr)
93
+ X.append(arr)
94
+
95
+ @numba.njit()
96
+ def tanimoto_dist(a, b):
97
+ dotprod = np.dot(a, b)
98
+ tc = dotprod / (np.sum(a) + np.sum(b) - dotprod)
99
+ return 1.0 - tc
100
+
101
+ tsne = TSNE(n_components=components, metric=tanimoto_dist)
102
+ tsne_X = tsne.fit_transform(X)
103
+ cluster_tsne = hdbscan.HDBSCAN(min_cluster_size=minClusterSize, gen_min_span_tree=True)
104
+ cluster_tsne.fit(tsne_X)
105
+
106
+ plt.figure(0)
107
+ cluster_tsne.minimum_spanning_tree_.plot(
108
+ edge_cmap='viridis', edge_alpha=0.6,
109
+ node_size=90, edge_linewidth=2)
110
+
111
+ plt.figure(1)
112
+ cluster_tsne.single_linkage_tree_.plot(cmap='viridis', colorbar=True)
113
+
114
+ plt.figure(2)
115
+ plt.scatter(tsne_X.T[0], tsne_X.T[1], c=cluster_tsne.labels_, cmap='plasma')
116
+ plt.title('Chemical space')
117
+ `;
118
+ _functionEditor(sampleScript);
119
+ }
120
+
55
121
  /* eslint-disable */
56
122
 
57
123
  //description: A spreadsheet that lets you interactively edit parameters and evaluate functions