lhcb-ntuple-wizard-test 1.1.14 → 1.2.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/dist/components/ConfigDict.js +39 -38
- package/dist/components/ConfigList.js +33 -29
- package/dist/components/ConfigNode.js +135 -132
- package/dist/components/ConfigValue.js +22 -18
- package/dist/components/Dataset.js +7 -3
- package/dist/components/Decay.js +1 -2
- package/dist/components/DecayItem.js +49 -45
- package/dist/components/DecayTag.js +10 -7
- package/dist/components/DecayTree.js +153 -146
- package/dist/components/DecaysList.js +38 -35
- package/dist/components/DescriptorsSearch.js +192 -187
- package/dist/components/EventTypeBadge.js +9 -6
- package/dist/components/ItemSearch.js +15 -10
- package/dist/components/LinesTable.js +464 -462
- package/dist/components/NtupleWizard.js +32 -27
- package/dist/components/ParticleTag.js +10 -7
- package/dist/components/SearchItem.js +34 -31
- package/dist/components/SelectParticle.js +14 -10
- package/dist/components/SelectTag.js +10 -9
- package/dist/components/SelectTool.js +10 -9
- package/dist/components/SelectVariables.js +24 -22
- package/dist/components/StrippingBadge.js +10 -7
- package/dist/components/StrippingLine.js +8 -6
- package/dist/components/TupleTool.js +4 -3
- package/dist/components/VariablesSearch.js +15 -10
- package/dist/components/loki/LokiDict.js +184 -0
- package/dist/components/loki/LokiEditor.js +199 -0
- package/dist/components/loki/LokiForm.js +116 -0
- package/dist/components/semantic.js +97 -0
- package/dist/components/semform.js +184 -0
- package/dist/components/worker.js +196 -0
- package/dist/config.json +1 -1
- package/dist/contexts/MetadataContext.js +8 -7
- package/dist/lib/DTTConfig.js +8 -8
- package/package.json +25 -2
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _Form = _interopRequireDefault(require("react-bootstrap/Form"));
|
|
8
|
+
var _Button = _interopRequireDefault(require("react-bootstrap/Button"));
|
|
9
|
+
var _semantic = require("./semantic");
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
|
|
21
|
+
* (c) Copyright 2024 CERN for the benefit of the LHCb Collaboration *
|
|
22
|
+
* *
|
|
23
|
+
* This software is distributed under the terms of the GNU General Public *
|
|
24
|
+
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
25
|
+
* *
|
|
26
|
+
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
27
|
+
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
28
|
+
* or submit itself to any jurisdiction. *
|
|
29
|
+
\*****************************************************************************/
|
|
30
|
+
function getmetafromcontext() {
|
|
31
|
+
const context = (0, _react.useContext)(_MetadataContext.default);
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Make the output of the search more readable
|
|
37
|
+
* @param {Array} data
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
function FormatOutput(_ref) {
|
|
41
|
+
let {
|
|
42
|
+
data
|
|
43
|
+
} = _ref;
|
|
44
|
+
let topchoice_ttool = [data.ttool[0]];
|
|
45
|
+
let data_ttool = data.ttool.slice(1);
|
|
46
|
+
let topchoice_loki = [data.loki[0]];
|
|
47
|
+
let data_loki = data.loki.slice(1);
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
51
|
+
children: "Best match (TupleTools):"
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
53
|
+
children: topchoice_ttool.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
54
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
55
|
+
children: "Matched TupleTool:"
|
|
56
|
+
}), " ", item[2] === "LoKi_functors" ? "LoKi__Hybrid__TupleTool" : item[2], /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
59
|
+
children: "Variable name:"
|
|
60
|
+
}), " ", item[1]]
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
63
|
+
children: "Definition:"
|
|
64
|
+
}), " ", item[0]]
|
|
65
|
+
})]
|
|
66
|
+
})]
|
|
67
|
+
}, index))
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
69
|
+
children: "Other matches (TupleTools):"
|
|
70
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
71
|
+
children: data_ttool.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
72
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
73
|
+
children: "Matched TupleTool:"
|
|
74
|
+
}), " ", item[2] === "LoKi_functors" ? "LoKi__Hybrid__TupleTool" : item[2], /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
77
|
+
children: "Variable name:"
|
|
78
|
+
}), " ", item[1]]
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
81
|
+
children: "Definition:"
|
|
82
|
+
}), " ", item[0]]
|
|
83
|
+
})]
|
|
84
|
+
})]
|
|
85
|
+
}, index))
|
|
86
|
+
})]
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
88
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
89
|
+
children: "Best match (LoKi functors):"
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
91
|
+
children: topchoice_loki.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
93
|
+
children: "Matched TupleTool:"
|
|
94
|
+
}), " ", item[2] === "LoKi_functors" ? "LoKi__Hybrid__TupleTool" : item[2], /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
97
|
+
children: "Variable name:"
|
|
98
|
+
}), " ", item[1]]
|
|
99
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
100
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
101
|
+
children: "Definition:"
|
|
102
|
+
}), " ", item[0]]
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
}, index))
|
|
106
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
107
|
+
children: "Other matches (LoKi functors):"
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
109
|
+
children: data_loki.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
110
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
111
|
+
children: "Matched TupleTool:"
|
|
112
|
+
}), " ", item[2] === "LoKi_functors" ? "LoKi__Hybrid__TupleTool" : item[2], /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
113
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
114
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
115
|
+
children: "Variable name:"
|
|
116
|
+
}), " ", item[1]]
|
|
117
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
119
|
+
children: "Definition:"
|
|
120
|
+
}), " ", item[0]]
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
}, index))
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
FormatOutput.propTypes = {
|
|
129
|
+
data: _propTypes.default.objectOf(_propTypes.default.array).isRequired
|
|
130
|
+
};
|
|
131
|
+
const SearchTTool = () => {
|
|
132
|
+
const [inputData, setInputData] = (0, _react.useState)({
|
|
133
|
+
query: ""
|
|
134
|
+
});
|
|
135
|
+
const [responseData, setResponseData] = (0, _react.useState)(null);
|
|
136
|
+
let metadata = getmetafromcontext();
|
|
137
|
+
// Load the model and embed the corpus when the component mounts
|
|
138
|
+
(0, _react.useMemo)(async () => {
|
|
139
|
+
await (0, _semantic.loadModel)("TaylorAI/gte-tiny");
|
|
140
|
+
await (0, _semantic.embedCorpus)(metadata);
|
|
141
|
+
}, []);
|
|
142
|
+
const handleChange = event => {
|
|
143
|
+
setInputData(_objectSpread(_objectSpread({}, inputData), {}, {
|
|
144
|
+
query: event.target.value
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
const handleSubmit = async event => {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
// clean input field
|
|
150
|
+
setInputData({
|
|
151
|
+
query: ""
|
|
152
|
+
});
|
|
153
|
+
let response = await (0, _semantic.getSimilarity)(inputData.query);
|
|
154
|
+
setResponseData(response);
|
|
155
|
+
};
|
|
156
|
+
const handleDelete = () => {
|
|
157
|
+
setResponseData(null);
|
|
158
|
+
};
|
|
159
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.default, {
|
|
160
|
+
onSubmit: handleSubmit,
|
|
161
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Form.default.Group, {
|
|
162
|
+
controlId: "formQuery",
|
|
163
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.default.Label, {
|
|
164
|
+
children: "Search for TupleTools"
|
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Form.default.Control, {
|
|
166
|
+
type: "text",
|
|
167
|
+
value: inputData.query,
|
|
168
|
+
onChange: handleChange
|
|
169
|
+
})]
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
171
|
+
variant: "primary",
|
|
172
|
+
type: "submit",
|
|
173
|
+
children: "Submit"
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
|
|
175
|
+
disabled: !responseData,
|
|
176
|
+
action: handleDelete
|
|
177
|
+
}), responseData && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
178
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(FormatOutput, {
|
|
179
|
+
data: responseData
|
|
180
|
+
})
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
var _default = exports.default = SearchTTool;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _transformers = require("@xenova/transformers");
|
|
4
|
+
/*****************************************************************************\
|
|
5
|
+
* (c) Copyright 2024 CERN for the benefit of the LHCb Collaboration *
|
|
6
|
+
* *
|
|
7
|
+
* This software is distributed under the terms of the GNU General Public *
|
|
8
|
+
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
9
|
+
* *
|
|
10
|
+
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
11
|
+
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
12
|
+
* or submit itself to any jurisdiction. *
|
|
13
|
+
\*****************************************************************************/
|
|
14
|
+
|
|
15
|
+
// This is so that we will download the models from huggingface.co
|
|
16
|
+
_transformers.env.allowLocalModels = false;
|
|
17
|
+
_transformers.env.useBrowserCache = false;
|
|
18
|
+
// store the embeddings in a dict
|
|
19
|
+
let query_embedding;
|
|
20
|
+
/**
|
|
21
|
+
* @type {Object.<string, Array>}
|
|
22
|
+
*/
|
|
23
|
+
let embedding_dict = {};
|
|
24
|
+
/**
|
|
25
|
+
* @type {pipeline}
|
|
26
|
+
*/
|
|
27
|
+
let embedder;
|
|
28
|
+
|
|
29
|
+
// these will hold the information to tie variable explanations to TupleTools
|
|
30
|
+
let dataKeys;
|
|
31
|
+
let paths;
|
|
32
|
+
/**
|
|
33
|
+
* @type {Array}
|
|
34
|
+
* */
|
|
35
|
+
let vars;
|
|
36
|
+
/**
|
|
37
|
+
* This function calculates the embedding and stores it in a dict.
|
|
38
|
+
* If the text is already embedded, it will return the embedding from the dict.
|
|
39
|
+
* @param {string} text
|
|
40
|
+
* @param {bool} embedNew
|
|
41
|
+
* @returns embeddingVector
|
|
42
|
+
*/
|
|
43
|
+
async function embed(text) {
|
|
44
|
+
let embedNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
45
|
+
if (text in embedding_dict) {
|
|
46
|
+
return embedding_dict[text];
|
|
47
|
+
}
|
|
48
|
+
const e0 = await embedder(text, {
|
|
49
|
+
pooling: "mean",
|
|
50
|
+
normalize: true
|
|
51
|
+
});
|
|
52
|
+
if (embedNew) {
|
|
53
|
+
embedding_dict[text] = e0.data;
|
|
54
|
+
}
|
|
55
|
+
return e0.data;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* This function calculates the cosine similarity between two embeddings.
|
|
59
|
+
* @param {Array} corpus_embedding
|
|
60
|
+
* @param {Array} query_embedding
|
|
61
|
+
* @returns cosine similarity
|
|
62
|
+
* */
|
|
63
|
+
function calcCosSim(corpus_embedding, query_embedding) {
|
|
64
|
+
let dotProduct = 0;
|
|
65
|
+
let queryMag = 0;
|
|
66
|
+
let embMag = 0;
|
|
67
|
+
let loop_length = query_embedding.length;
|
|
68
|
+
// because the embeddings might have different dimensions
|
|
69
|
+
if (query_embedding.length > corpus_embedding.length) {
|
|
70
|
+
loop_length = corpus_embedding.length;
|
|
71
|
+
}
|
|
72
|
+
for (let i = 0; i < loop_length; i++) {
|
|
73
|
+
dotProduct += query_embedding[i] * corpus_embedding[i];
|
|
74
|
+
queryMag += query_embedding[i] * query_embedding[i];
|
|
75
|
+
embMag += corpus_embedding[i] * corpus_embedding[i];
|
|
76
|
+
}
|
|
77
|
+
const sim = dotProduct / (Math.sqrt(queryMag) * Math.sqrt(embMag));
|
|
78
|
+
return sim;
|
|
79
|
+
}
|
|
80
|
+
/**This is a helper function to read the nested json file containing the documentation.
|
|
81
|
+
* @returns [vars, paths, dataKeys]
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
function readJsonFile(data) {
|
|
85
|
+
// go through nested object
|
|
86
|
+
vars = [];
|
|
87
|
+
paths = [];
|
|
88
|
+
const iterateObject = function (obj) {
|
|
89
|
+
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
90
|
+
Object.keys(obj).forEach(key => {
|
|
91
|
+
const currentPath = path ? "".concat(path, ".").concat(key) : key;
|
|
92
|
+
if (obj[key] instanceof Object) {
|
|
93
|
+
iterateObject(obj[key], currentPath);
|
|
94
|
+
} else {
|
|
95
|
+
vars.push(obj[key]);
|
|
96
|
+
paths.push(currentPath);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// go through data and put it into an array
|
|
102
|
+
const dataArray = Object.values(data);
|
|
103
|
+
dataKeys = Object.keys(data);
|
|
104
|
+
iterateObject(dataArray);
|
|
105
|
+
return [vars, paths, dataKeys];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// worker on message definition
|
|
109
|
+
self.onmessage = async event => {
|
|
110
|
+
const message = event.data;
|
|
111
|
+
switch (message.type) {
|
|
112
|
+
case "init":
|
|
113
|
+
// load the model and reset the embedding dict
|
|
114
|
+
embedding_dict = {};
|
|
115
|
+
embedder = await (0, _transformers.pipeline)("feature-extraction", message.model, {
|
|
116
|
+
progress_callback: progress => {
|
|
117
|
+
self.postMessage({
|
|
118
|
+
type: "progress",
|
|
119
|
+
progress: progress
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
break;
|
|
124
|
+
case "corpus":
|
|
125
|
+
{
|
|
126
|
+
// embed the corpus or load the embeddings
|
|
127
|
+
readJsonFile(message.kgdoc); // this is so we can later match variables to tupletools
|
|
128
|
+
|
|
129
|
+
Object.keys(message.emb).forEach(key => {
|
|
130
|
+
let embarr = [];
|
|
131
|
+
for (const fl of message.emb[key].split(",")) {
|
|
132
|
+
embarr.push(fl.replace("[", "").replace("]", "").replace("np.float32", "").replace("(", "").replace(")", "").replace(" ", ""));
|
|
133
|
+
}
|
|
134
|
+
embedding_dict[key] = embarr;
|
|
135
|
+
});
|
|
136
|
+
self.postMessage({
|
|
137
|
+
type: "corpus"
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "similarity":
|
|
142
|
+
{
|
|
143
|
+
//calculate query embedding and then calculate similarity
|
|
144
|
+
query_embedding = await embed(message.query, false);
|
|
145
|
+
let sim_dict = {};
|
|
146
|
+
Object.keys(embedding_dict).forEach(key => {
|
|
147
|
+
sim_dict[key] = calcCosSim(embedding_dict[key], query_embedding);
|
|
148
|
+
});
|
|
149
|
+
// sort by highest similarity (closest to 1)
|
|
150
|
+
const sortedSimDict = Object.fromEntries(Object.entries(sim_dict).sort((_ref, _ref2) => {
|
|
151
|
+
let [, a] = _ref;
|
|
152
|
+
let [, b] = _ref2;
|
|
153
|
+
return b - a;
|
|
154
|
+
}));
|
|
155
|
+
const top5 = Object.fromEntries(Object.entries(sortedSimDict).slice(0, 20));
|
|
156
|
+
let loki_result = [];
|
|
157
|
+
let ttool_result = [];
|
|
158
|
+
let result = {
|
|
159
|
+
loki: loki_result,
|
|
160
|
+
ttool: ttool_result
|
|
161
|
+
};
|
|
162
|
+
Object.keys(top5).forEach(key => {
|
|
163
|
+
if (key === "basic,charged: : ") {
|
|
164
|
+
return;
|
|
165
|
+
} // This is a workaround until we implement a fix in Analysis (and corresponding DaVinci release)
|
|
166
|
+
let description = key.substring(key.indexOf(":") + 2);
|
|
167
|
+
let variable = key.substring(0, key.indexOf(":") - 1);
|
|
168
|
+
let varpath = paths[vars.indexOf(description)];
|
|
169
|
+
let tupletool = dataKeys[varpath.split(".")[0]];
|
|
170
|
+
if (tupletool === "LoKi_functors") {
|
|
171
|
+
if (top5[key] > 0.86) {
|
|
172
|
+
if (loki_result.length < 5) {
|
|
173
|
+
loki_result.push([description, variable, tupletool]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
if (top5[key] > 0.75) {
|
|
178
|
+
if (ttool_result.length < 5) {
|
|
179
|
+
ttool_result.push([description, variable, tupletool]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
if (loki_result.length === 0) {
|
|
185
|
+
loki_result.push(["No matches found", "No matches found", "No matches found"]);
|
|
186
|
+
}
|
|
187
|
+
if (ttool_result.length === 0) {
|
|
188
|
+
ttool_result.push(["No matches found", "No matches found", "No matches found"]);
|
|
189
|
+
}
|
|
190
|
+
self.postMessage({
|
|
191
|
+
type: "result",
|
|
192
|
+
result: result
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
package/dist/config.json
CHANGED
|
@@ -16,7 +16,11 @@ var _utils = require("../lib/utils");
|
|
|
16
16
|
var _config2 = _interopRequireDefault(require("../config"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
|
|
20
24
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
21
25
|
* *
|
|
22
26
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -26,7 +30,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
26
30
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
27
31
|
* or submit itself to any jurisdiction. *
|
|
28
32
|
\*****************************************************************************/
|
|
29
|
-
|
|
30
33
|
const MetadataContext = exports.MetadataContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
31
34
|
var _default = exports.default = MetadataContext;
|
|
32
35
|
const useMetadataContext = _init => (0, _react.useContext)(MetadataContext);
|
|
@@ -49,12 +52,10 @@ function createMetadataProvider(_config, _ref) {
|
|
|
49
52
|
const getMetadata = async () => {
|
|
50
53
|
Object.keys(_config.metadata_files).forEach((key, _index) => {
|
|
51
54
|
(0, _utils.loadDict)(_config.metadata_files[key]).then(result => {
|
|
52
|
-
setMetadata(prevState => ({
|
|
53
|
-
...prevState,
|
|
55
|
+
setMetadata(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
|
|
54
56
|
[key]: result
|
|
55
57
|
}));
|
|
56
|
-
setLoaded(prevState => ({
|
|
57
|
-
...prevState,
|
|
58
|
+
setLoaded(prevState => _objectSpread(_objectSpread({}, prevState), {}, {
|
|
58
59
|
[key]: true
|
|
59
60
|
}));
|
|
60
61
|
}, e => {
|
|
@@ -67,7 +68,7 @@ function createMetadataProvider(_config, _ref) {
|
|
|
67
68
|
}, []);
|
|
68
69
|
if (error) {
|
|
69
70
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("h1", {
|
|
70
|
-
children: ["Oops: ",
|
|
71
|
+
children: ["Oops: ", "".concat(error)]
|
|
71
72
|
});
|
|
72
73
|
} else {
|
|
73
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MetadataContext.Provider, {
|
package/dist/lib/DTTConfig.js
CHANGED
|
@@ -64,7 +64,7 @@ class DTTConfig {
|
|
|
64
64
|
// Set the class+name combination
|
|
65
65
|
setName(name) {
|
|
66
66
|
const safeName = name.replace(/\W/g, "");
|
|
67
|
-
this.config.name =
|
|
67
|
+
this.config.name = "DecayTreeTuple/".concat(safeName);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Return the name of the DecayTreeTuple algorithm
|
|
@@ -89,16 +89,16 @@ class DTTConfig {
|
|
|
89
89
|
this.pruneGroups();
|
|
90
90
|
if (branch.length === 0) {
|
|
91
91
|
return this.config;
|
|
92
|
-
} else if (
|
|
92
|
+
} else if ("".concat(branch) in this.config.branches) {
|
|
93
93
|
return this.config.branches[branch];
|
|
94
94
|
} else {
|
|
95
|
-
if (!(
|
|
96
|
-
this.config.groups[
|
|
95
|
+
if (!("".concat(branch) in this.config.groups)) {
|
|
96
|
+
this.config.groups["".concat(branch)] = {
|
|
97
97
|
particles: branch.map(element => this.config.branches[element].particle),
|
|
98
98
|
tools: []
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
return this.config.groups[
|
|
101
|
+
return this.config.groups["".concat(branch)];
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -106,7 +106,7 @@ class DTTConfig {
|
|
|
106
106
|
findTool(target, toolString) {
|
|
107
107
|
const index = target.tools.findIndex(tool => toolString in tool);
|
|
108
108
|
if (index < 0) {
|
|
109
|
-
throw new Error(
|
|
109
|
+
throw new Error("".concat(toolString, " not found in ").concat(target));
|
|
110
110
|
}
|
|
111
111
|
return index;
|
|
112
112
|
}
|
|
@@ -117,7 +117,7 @@ class DTTConfig {
|
|
|
117
117
|
let target = this.getTarget(branch);
|
|
118
118
|
// The toolString identifies the tool in the target's tool list
|
|
119
119
|
// If the tool is given a name (recommended), append it following a slash
|
|
120
|
-
const toolString = toolName.length ?
|
|
120
|
+
const toolString = toolName.length ? "".concat(toolClass, "/").concat(toolName) : toolClass;
|
|
121
121
|
// Add the tool to the list if not already there
|
|
122
122
|
try {
|
|
123
123
|
this.findTool(target, toolString);
|
|
@@ -128,7 +128,7 @@ class DTTConfig {
|
|
|
128
128
|
target.tools.push(toolConfig);
|
|
129
129
|
return true;
|
|
130
130
|
}
|
|
131
|
-
throw new Error(
|
|
131
|
+
throw new Error("".concat(toolString, " already exists in ").concat(target));
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// Return a dict containing the default configuration of a TupleTool
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lhcb-ntuple-wizard-test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "An application to access large-scale open data from LHCb",
|
|
5
5
|
"url": "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend/issues",
|
|
6
6
|
"private": false,
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
+
"browser": {
|
|
14
|
+
"fs": false,
|
|
15
|
+
"path": false,
|
|
16
|
+
"os": false
|
|
17
|
+
},
|
|
13
18
|
"dependencies": {
|
|
14
19
|
"@vitejs/plugin-react": "^4.2.1",
|
|
15
20
|
"bootstrap": "^5.1.3",
|
|
@@ -24,11 +29,29 @@
|
|
|
24
29
|
"react-bootstrap": "^2.0.3",
|
|
25
30
|
"react-bootstrap-icons": "^1.6.1",
|
|
26
31
|
"react-dom": "^17.0.2",
|
|
32
|
+
"react-app-polyfill": "^3.0.0",
|
|
33
|
+
"react-dev-utils": "^12.0.1",
|
|
27
34
|
"react-graph-vis": "^1.0.7",
|
|
28
35
|
"react-infinite-scroll-component": "^6.1.0",
|
|
29
36
|
"react-router-dom": "^5.2.0",
|
|
30
37
|
"react-select": "^4.3.1",
|
|
31
|
-
"
|
|
38
|
+
"react-overlays": "5.2.1",
|
|
39
|
+
"@mui/material": "latest",
|
|
40
|
+
"@emotion/react": "latest",
|
|
41
|
+
"@emotion/styled": "latest",
|
|
42
|
+
"@mui/joy": "latest",
|
|
43
|
+
"@avcs/autosuggest": "latest",
|
|
44
|
+
"@webscopeio/react-textarea-autocomplete": "^4.9.2",
|
|
45
|
+
"@monaco-editor/react": "^4.6.0",
|
|
46
|
+
"monaco-editor-nls": "^3.1.0",
|
|
47
|
+
"monaco-editor": "^0.44.0",
|
|
48
|
+
"monaco-editor-core": "^0.44.0",
|
|
49
|
+
"monaco-languageclient": "0.13.1-next.9",
|
|
50
|
+
"react-monaco-editor": "^0.55.0",
|
|
51
|
+
"monaco-editor-webpack-plugin": "^7.1.0",
|
|
52
|
+
"vite": "^5.1.1",
|
|
53
|
+
"@xenova/transformers": "^2.16.1",
|
|
54
|
+
"web-vitals": "^2.1.4"
|
|
32
55
|
},
|
|
33
56
|
"overrides": {
|
|
34
57
|
"autoprefixer": "10.4.5"
|