Skip to content

Commit d485242

Browse files
committedMar 11, 2025·
No separate NXsensor_scan app anymore, instead NeXus app was updated.
1 parent 2a00182 commit d485242

File tree

2 files changed

+77
-188
lines changed

2 files changed

+77
-188
lines changed
 

‎pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ nexus_parser = "pynxtools.nomad.entrypoints:nexus_parser"
100100
nexus_schema = "pynxtools.nomad.entrypoints:nexus_schema"
101101
nexus_data_converter = "pynxtools.nomad.entrypoints:nexus_data_converter"
102102
nexus_app = "pynxtools.nomad.entrypoints:nexus_app"
103-
nxsensor_scan_app = "pynxtools.nomad.entrypoints:nxsensor_scan_app"
104103
iv_temp_example = "pynxtools.nomad.entrypoints:iv_temp_example"
105104

106105
[project.scripts]

‎src/pynxtools/nomad/entrypoints.py

+77-187
Original file line numberDiff line numberDiff line change
@@ -71,37 +71,29 @@ def load(self):
7171
Column,
7272
Menu,
7373
MenuItemHistogram,
74-
MenuItemOption,
7574
MenuItemPeriodicTable,
7675
MenuItemTerms,
76+
MenuSizeEnum,
7777
SearchQuantities,
7878
)
7979

8080
schema = "pynxtools.nomad.schema.Root"
8181

82-
nxdefs_inheriting_from_sensorscan = [
83-
"NXsensor_scan",
84-
"NXiv_temp",
85-
"NXspm",
86-
"NXsts",
87-
"NXafm",
88-
"NXstm",
89-
]
9082

91-
nxsensor_scan_app = AppEntryPoint(
92-
name="NXsensor_scan App",
93-
description="App for NXsensor_scan and inheriting from it classes.",
83+
nexus_app = AppEntryPoint(
84+
name="NeXus App",
85+
description="Simple Generic NeXus app.",
9486
app=App(
9587
# Label of the App
96-
label="Simple Scan",
88+
label="NeXus",
9789
# Path used in the URL, must be unique
98-
path="nxsensor_scan",
90+
path="nexusapp",
9991
# Used to categorize apps in the explore menu
10092
category="Experiment",
10193
# Brief description used in the app menu
102-
description="Search simple scan experiments (NXsensor_scan and inheriting classes), including output of NOMAD CAMELS",
94+
description="A simple search app customized for generic NeXus data.",
10395
# Longer description that can also use markdown
104-
readme="This page allows to search for generic experimental entries corresponding to NXsensor_scan and inheriting from it classes, including output of NOMAD CAMELS. It is similar to the entries search, but with reduced filter set, modified menu on the left and different shown columns. The dashboard directly shows useful interactive statistics about the data",
96+
readme="This page allows to search for generic NeXus Experiment Entries. It is similar to the entries search, but with reduced filter set, modified menu on the left and different shown columns. The dashboard directly shows useful interactive statistics about the data",
10597
# If you want to use quantities from a custom schema, you need to load
10698
# the search quantities from it first here. Note that you can use a glob
10799
# syntax to load the entire package, or just a single schema from a
@@ -147,25 +139,19 @@ def load(self):
147139
search_quantity=f"data.ENTRY[*].definition__field#{schema}",
148140
selected=True,
149141
),
150-
Column(
151-
title="Protocol",
152-
search_quantity=f"data.ENTRY[*].NOTE[?name=='protocol'].file_name__field#{schema}#str",
153-
selected=False,
154-
),
155142
],
156143
# Dictionary of search filters that are always enabled for queries made
157144
# within this app. This is especially important to narrow down the
158145
# results to the wanted subset.
159-
filters_locked={
160-
f"data.ENTRY.definition__field#{schema}": nxdefs_inheriting_from_sensorscan,
161-
},
162-
# filters_locked={"section_defs.definition_qualified_name": [schema]},
146+
filters_locked={"section_defs.definition_qualified_name": [schema]},
163147
# Controls the menu shown on the left
164148
menu=Menu(
149+
size=MenuSizeEnum.MD,
165150
title="Menu",
166151
items=[
167152
Menu(
168153
title="Elements",
154+
size=MenuSizeEnum.XXL,
169155
items=[
170156
MenuItemPeriodicTable(
171157
search_quantity="results.material.elements",
@@ -180,13 +166,42 @@ def load(self):
180166
width=6,
181167
options=0,
182168
),
169+
MenuItemTerms(
170+
search_quantity="results.material.chemical_formula_reduced",
171+
width=6,
172+
options=0,
173+
),
174+
MenuItemTerms(
175+
search_quantity="results.material.chemical_formula_anonymous",
176+
width=6,
177+
options=0,
178+
),
183179
MenuItemHistogram(
184180
x="results.material.n_elements",
185181
),
186182
],
187183
),
184+
Menu(
185+
title="Experiment type",
186+
size=MenuSizeEnum.LG,
187+
items=[
188+
MenuItemTerms(
189+
title="Entry Type",
190+
search_quantity=f"entry_type",
191+
width=12,
192+
options=12,
193+
),
194+
MenuItemTerms(
195+
title="NeXus Class",
196+
search_quantity=f"data.ENTRY.definition__field#{schema}",
197+
width=12,
198+
options=12,
199+
),
200+
],
201+
),
188202
Menu(
189203
title="Instruments",
204+
size=MenuSizeEnum.LG,
190205
items=[
191206
MenuItemTerms(
192207
title="Model",
@@ -204,6 +219,7 @@ def load(self):
204219
),
205220
Menu(
206221
title="Samples",
222+
size=MenuSizeEnum.LG,
207223
items=[
208224
MenuItemTerms(
209225
title="Name",
@@ -220,222 +236,96 @@ def load(self):
220236
],
221237
),
222238
Menu(
223-
title="Authors",
239+
title="Authors / Origin",
240+
size=MenuSizeEnum.LG,
224241
items=[
225242
MenuItemTerms(
226-
title="Name",
243+
title="Entry Author",
227244
search_quantity=f"data.ENTRY.USER.name__field#{schema}",
228245
width=12,
229-
options=12,
246+
options=5,
230247
),
231248
MenuItemTerms(
232-
title="Affiliation",
233-
search_quantity=f"data.ENTRY.USER.affiliation__field#{schema}",
249+
title="User ID / Entry Author",
250+
search_quantity=f"data.ENTRY.userID.name__field#{schema}#str",
234251
width=12,
235-
options=12,
252+
options=5,
236253
),
237-
],
238-
),
239-
Menu(
240-
title="Protocols (NOMAD CAMELS)",
241-
items=[
242254
MenuItemTerms(
243-
title="CAMELS files",
244-
search_quantity=f"data.ENTRY.PROCESS.program__field#{schema}",
255+
title="Upload Author",
256+
search_quantity=f"authors.name",
245257
width=12,
246-
options={
247-
"NOMAD CAMELS": MenuItemOption(
248-
label="NOMAD CAMELS entries only",
249-
),
250-
},
251-
show_header=False,
252-
show_input=False,
258+
options=5,
253259
),
254260
MenuItemTerms(
255-
title="Protocols (only for CAMELS files)",
256-
search_quantity=f"data.ENTRY.NOTE.file_name__field#{schema}#str",
261+
title="Affiliation",
262+
search_quantity=f"data.ENTRY.USER.affiliation__field#{schema}",
257263
width=12,
258-
options=12,
264+
options=5,
259265
),
260266
],
261267
),
268+
MenuItemHistogram(
269+
title="Start Time",
270+
x=f"data.ENTRY.start_time#{schema}",
271+
autorange=True,
272+
),
273+
MenuItemHistogram(
274+
title="Upload Creation Time",
275+
x=f"upload_create_time",
276+
autorange=True,
277+
),
262278
],
263279
),
264280
# Controls the default dashboard shown in the search interface
265281
dashboard={
266282
"widgets": [
267283
{
268-
"type": "histogram",
269-
"show_input": False,
270-
"autorange": True,
271-
"nbins": 30,
284+
"type": "periodic_table",
272285
"scale": "linear",
273-
"quantity": f"data.ENTRY.start_time#{schema}",
274-
"title": "Start Time",
286+
"quantity": f"results.material.elements",
275287
"layout": {
276-
"lg": {"minH": 3, "minW": 3, "h": 6, "w": 10, "y": 0, "x": 0}
288+
"lg": {"minH": 3, "minW": 3, "h": 7, "w": 10, "y": 0, "x": 0}
277289
},
278290
},
279291
{
280292
"type": "terms",
281-
"show_input": False,
293+
"show_input": True,
282294
"scale": "linear",
283295
"quantity": f"entry_type",
284296
"title": "Entry Type",
285297
"layout": {
286-
"lg": {"minH": 3, "minW": 3, "h": 6, "w": 5, "y": 6, "x": 0}
298+
"lg": {"minH": 3, "minW": 3, "h": 7, "w": 4, "y": 0, "x": 10}
287299
},
288300
},
289301
{
290302
"type": "terms",
291-
"show_input": False,
303+
"show_input": True,
292304
"scale": "linear",
293-
"quantity": f"data.ENTRY.SAMPLE.sample_id__field#{schema}",
294-
"title": "Sample ID",
305+
"quantity": f"data.ENTRY.definition__field#{schema}",
306+
"title": "NeXus Class",
295307
"layout": {
296-
"lg": {"minH": 3, "minW": 3, "h": 12, "w": 4, "y": 0, "x": 14}
308+
"lg": {"minH": 3, "minW": 3, "h": 7, "w": 4, "y": 0, "x": 14}
297309
},
298310
},
299311
{
300312
"type": "terms",
301-
"show_input": False,
313+
"show_input": True,
302314
"scale": "linear",
303315
"quantity": f"data.ENTRY.USER.name__field#{schema}",
304316
"title": "Author",
305317
"layout": {
306-
"lg": {"minH": 3, "minW": 3, "h": 6, "w": 5, "y": 6, "x": 5}
318+
"lg": {"minH": 3, "minW": 3, "h": 7, "w": 4, "y": 0, "x": 18}
307319
},
308320
},
309321
{
310322
"type": "terms",
311-
"show_input": False,
323+
"show_input": True,
312324
"scale": "linear",
313325
"quantity": f"data.ENTRY.SAMPLE.name__field#{schema}",
314326
"title": "Sample",
315327
"layout": {
316-
"lg": {"minH": 3, "minW": 3, "h": 12, "w": 4, "y": 0, "x": 10}
317-
},
318-
},
319-
]
320-
},
321-
),
322-
)
323-
324-
nexus_app = AppEntryPoint(
325-
name="NexusApp",
326-
description="Simple Generic NeXus app.",
327-
app=App(
328-
# Label of the App
329-
label="NeXus",
330-
# Path used in the URL, must be unique
331-
path="nexusapp",
332-
# Used to categorize apps in the explore menu
333-
category="Experiment",
334-
# Brief description used in the app menu
335-
description="A simple search app customized for generic NeXus data.",
336-
# Longer description that can also use markdown
337-
readme="This is a simple App to support basic search for NeXus based Experiment Entries.",
338-
# If you want to use quantities from a custom schema, you need to load
339-
# the search quantities from it first here. Note that you can use a glob
340-
# syntax to load the entire package, or just a single schema from a
341-
# package.
342-
search_quantities=SearchQuantities(
343-
include=[f"*#{schema}"],
344-
),
345-
# Controls which columns are shown in the results table
346-
columns=[
347-
Column(quantity="entry_id", selected=True),
348-
Column(quantity=f"entry_type", selected=True),
349-
Column(
350-
title="definition",
351-
quantity=f"data.ENTRY[*].definition__field#{schema}",
352-
selected=True,
353-
),
354-
Column(
355-
title="start_time",
356-
quantity=f"data.ENTRY[*].start_time__field#{schema}",
357-
selected=True,
358-
),
359-
Column(
360-
title="title",
361-
quantity=f"data.ENTRY[*].title__field#{schema}",
362-
selected=True,
363-
),
364-
],
365-
# Dictionary of search filters that are always enabled for queries made
366-
# within this app. This is especially important to narrow down the
367-
# results to the wanted subset. Any available search filter can be
368-
# targeted here. This example makes sure that only entries that use
369-
# MySchema are included.
370-
filters_locked={"section_defs.definition_qualified_name": [schema]},
371-
# Controls the menu shown on the left
372-
menu=Menu(
373-
title="Material",
374-
items=[
375-
Menu(
376-
title="elements",
377-
items=[
378-
MenuItemPeriodicTable(
379-
quantity="results.material.elements",
380-
),
381-
MenuItemTerms(
382-
quantity="results.material.chemical_formula_hill",
383-
width=6,
384-
options=0,
385-
),
386-
MenuItemTerms(
387-
quantity="results.material.chemical_formula_iupac",
388-
width=6,
389-
options=0,
390-
),
391-
MenuItemHistogram(
392-
x="results.material.n_elements",
393-
),
394-
],
395-
)
396-
],
397-
),
398-
# Controls the default dashboard shown in the search interface
399-
dashboard={
400-
"widgets": [
401-
{
402-
"type": "histogram",
403-
"show_input": False,
404-
"autorange": True,
405-
"nbins": 30,
406-
"scale": "linear",
407-
"quantity": f"data.ENTRY.start_time__field#{schema}",
408-
"title": "Start Time",
409-
"layout": {
410-
"lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 0, "x": 0}
411-
},
412-
},
413-
{
414-
"type": "terms",
415-
"show_input": False,
416-
"scale": "linear",
417-
"quantity": f"entry_type",
418-
"title": "Entry Type",
419-
"layout": {
420-
"lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 12}
421-
},
422-
},
423-
{
424-
"type": "terms",
425-
"show_input": False,
426-
"scale": "linear",
427-
"quantity": f"data.ENTRY.definition__field#{schema}",
428-
"title": "Definition",
429-
"layout": {
430-
"lg": {"minH": 3, "minW": 3, "h": 8, "w": 4, "y": 0, "x": 16}
431-
},
432-
},
433-
{
434-
"type": "periodic_table",
435-
"scale": "linear",
436-
"quantity": f"results.material.elements",
437-
"layout": {
438-
"lg": {"minH": 3, "minW": 3, "h": 4, "w": 12, "y": 4, "x": 0}
328+
"lg": {"minH": 3, "minW": 3, "h": 7, "w": 4, "y": 0, "x": 22}
439329
},
440330
},
441331
]

0 commit comments

Comments
 (0)
Please sign in to comment.