Commit bbd7a5c
Extend nexus_helpers with units extraction and code generation
Add tooling to help generate f144_log_streams configuration from NeXus files:
- Add `units` field to StreamInfo dataclass, extracted from 'value' datasets
- Add `suggest_internal_name()` to derive internal names from group paths
- Add `filter_f144_streams()` to filter by writer module, topic, and patterns
- Add `generate_f144_log_streams_code()` to generate Python dict code
- Add CLI options: --f144, --topic, --exclude, --generate, --var-name
Refactor bifrost configuration to use combined f144_log_streams dict:
- Define `f144_log_streams` mapping internal name -> {source, units}
- Derive `f144_attribute_registry` from `f144_log_streams`
- Derive StreamLUT in `_make_bifrost_logs()` from `f144_log_streams`
This keeps source names, internal names, and units co-located in one place.
Example usage:
python -m ess.livedata.nexus_helpers file.hdf --generate --topic bifrost_motion
Original prompt: Can you extend the nexus_helpers.py script to also extract
and list units? Or, going beyond that, it would be good if we could turn this
into a better tool to generate code for attr registry and log_source_mapping.
Is having the two in two parts convenient?
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent ef6cbe7 commit bbd7a5c
File tree
4 files changed
+511
-31
lines changed- src/ess/livedata
- config/instruments/bifrost
- tests
4 files changed
+511
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
235 | 363 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 364 | + | |
239 | 365 | | |
240 | 366 | | |
241 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 64 | | |
73 | 65 | | |
74 | 66 | | |
75 | 67 | | |
76 | | - | |
77 | | - | |
| 68 | + | |
| 69 | + | |
78 | 70 | | |
79 | 71 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 72 | + | |
| 73 | + | |
83 | 74 | | |
84 | 75 | | |
85 | 76 | | |
| |||
88 | 79 | | |
89 | 80 | | |
90 | 81 | | |
91 | | - | |
| 82 | + | |
92 | 83 | | |
93 | 84 | | |
94 | 85 | | |
| |||
0 commit comments