diff --git a/src/h5web/vis-packs/nexus/hooks.ts b/src/h5web/vis-packs/nexus/hooks.ts index 553656fa2..849cf44b8 100644 --- a/src/h5web/vis-packs/nexus/hooks.ts +++ b/src/h5web/vis-packs/nexus/hooks.ts @@ -48,16 +48,17 @@ function useTitleDataset( return dataset; } -function useAxesDatasets( - group: Group +function useAssociatedDatasets( + group: Group, + type: 'axes' | 'auxiliary_signals' ): (Dataset | undefined)[] { const { valuesStore } = useContext(ProviderContext); - const axisList = getAttributeValue(group, 'axes') || []; - const axisNames = typeof axisList === 'string' ? [axisList] : axisList; - assertArray(axisNames); + const dsetList = getAttributeValue(group, type) || []; + const dsetNames = typeof dsetList === 'string' ? [dsetList] : dsetList; + assertArray(dsetNames); - return axisNames.map((name) => { + return dsetNames.map((name) => { if (name === '.') { return undefined; } @@ -81,8 +82,11 @@ export function useNxData(group: Group): NxData { signalDataset, errorsDataset: findErrorsDataset(group, signalDataset.name), titleDataset: useTitleDataset(group), - axisDatasetMapping: useAxesDatasets(group), + axisDatasetMapping: useAssociatedDatasets(group, 'axes'), silxStyle: getSilxStyle(group), + auxiliaryDatasets: useAssociatedDatasets(group, 'auxiliary_signals').filter( + isDefined + ), }; } diff --git a/src/h5web/vis-packs/nexus/models.ts b/src/h5web/vis-packs/nexus/models.ts index cc8931763..be54a3ca2 100644 --- a/src/h5web/vis-packs/nexus/models.ts +++ b/src/h5web/vis-packs/nexus/models.ts @@ -15,7 +15,8 @@ export type NxAttribute = | 'default' | 'long_name' | 'units' - | 'SILX_style'; + | 'SILX_style' + | 'auxiliary_signals'; export enum NxInterpretation { Spectrum = 'spectrum', @@ -28,6 +29,7 @@ export interface NxData { titleDataset?: Dataset; axisDatasetMapping: AxisDatasetMapping; silxStyle: SilxStyle; + auxiliaryDatasets: Dataset[]; } export type AxisDatasetMapping = (