Skip to content

Tutorial: writing application definitions, building readers#744

Merged
lukaspie merged 17 commits intomasterfrom
workshop
Mar 17, 2026
Merged

Tutorial: writing application definitions, building readers#744
lukaspie merged 17 commits intomasterfrom
workshop

Conversation

@lukaspie
Copy link
Collaborator

This is in preparation for the datathon at BESSY II on March 23/24.

Adds:

  • a full tutorial for writing an application definition NXdouble_slit
  • a how-to focussed on building NXdouble_slit as well, but aimed at more experienced users
  • example nxdl and yaml files
  • an extensive tutorial for building a generic reader plugin using the pynxtools-plugin-template (Part 1)
  • another tutorial for building a reader plugin, but focussed on the user's own data (Part 2)

@lukaspie lukaspie changed the title Workshop Tutorial: writing application definitions, building readers Mar 12, 2026
Copy link
Collaborator

@mkuehbach mkuehbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good body of work and useful a deep tutorial.

@lukaspie lukaspie marked this pull request as ready for review March 16, 2026 13:03
lukaspie and others added 17 commits March 17, 2026 13:49
The workshop branch of the nexus definitions adds NXsimple, used as
the tutorial target for the pynxtools reader workshop.
Step-by-step tutorial for participants to implement a MultiFormatReader
from scratch using NXsimple and mock data files. Covers:

- Setup with the workshop plugin template
- HDF5 and YAML data exploration
- 5 reader method exercises (handle_hdf5_file, handle_eln_file,
  get_attr, get_eln_data, get_data), each with ??? collapsible solution
- Config file mapping exercise with full solution
- Running the converter and inspecting output

Also adds tutorial/build-a-reader.md to mkdocs.yaml nav and extends
cspell dictionary with the example reader name.
Day 1 (build-a-reader.md):
- Add architecture flow diagram at the top
- Explicit ~time estimates per section
- Part 0: explain NeXus purpose before any code
- Part 1: data exploration with expected output shown
- Each exercise: goal, steps, check-your-work snippet, solution
- Checkpoint section after callbacks (Ex 3–5) with runnable test
- Part 8: running tests with the test framework
- Bonus exercises: post_process, second format, plot output
- Troubleshooting table with 8 common errors
- Summary table mapping each step to its key concept

Day 2 (bring-your-own-data.md):
- Rewritten for diverse data formats
- Format detective script for unknown files
- Format coverage: HDF5, CSV/TSV, VAMAS, SpecsLab XML, SpecsLab SQLite,
  Igor Pro IBW, Scienta TXT, NetCDF, TIFF/detector images, JSON/YAML,
  arbitrary binary (fallback pattern)
- Adapter pattern: always flatten to self.data dict, rest is identical
- Multiple entries / spectra per file
- Unit conversion in callbacks
- Derived quantities in post_process
- Writing a minimal NXDL appdef when none exists
- 9-point checklist before leaving
- Comprehensive error/fix table

mkdocs.yaml: Workshop subsection under Tutorials with both days
cspell: 20 new words added
Co-authored-by: Markus Kühbach <mkuehbach@users.noreply.github.com>
Co-authored-by: Markus Kühbach <mkuehbach@users.noreply.github.com>
Co-authored-by: Markus Kühbach <mkuehbach@users.noreply.github.com>
Co-authored-by: Markus Kühbach <mkuehbach@users.noreply.github.com>
@mkuehbach
Copy link
Collaborator

height and material in NXslit not found but that can be added also later in a consolidation feature branch where add definitions for all those concepts for which there is currently neither an explicit nor an inherited docstring.

@mkuehbach
Copy link
Collaborator

mkuehbach commented Mar 17, 2026

Go ahead merging this @lukaspie but check if updating with master is required.

Copy link
Collaborator

@mkuehbach mkuehbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lukaspie lukaspie merged commit b5ef8ed into master Mar 17, 2026
10 of 17 checks passed
@lukaspie lukaspie deleted the workshop branch March 17, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants