from typing import Any
from typing import Dict
from typing import List
from typing import Tuple

from . import assert_results


def test_mosaic_scan_multi_detector_without_qt(tmp_path):
    assert_results.assert_without_qt(
        "mosaic_mesh_multi_detector_sumbeforefit.ows",
        get_inputs(tmp_path),
        get_expected_outputs(tmp_path),
        get_expected_hdf5(tmp_path),
    )


def test_mosaic_scan_multi_detector_with_qt(ewoks_orange_canvas, tmp_path):
    assert_results.assert_with_qt(
        ewoks_orange_canvas,
        "mosaic_mesh_multi_detector_sumbeforefit.ows",
        get_inputs(tmp_path),
        get_expected_outputs(tmp_path),
        get_expected_hdf5(tmp_path),
    )


def get_inputs(tmp_path) -> List[Dict[str, Any]]:
    return [
        {
            "label": "Mosaic Mesh (multi detector)",
            "name": "output_filename",
            "value": str(tmp_path / "input.h5"),
        },
        {
            "label": "Concat BLISS scans",
            "name": "bliss_scan_uri",
            "value": str(tmp_path / "concat.h5::/1.1"),
        },
        {
            "label": "Sum Spectra",
            "name": "output_root_uri",
            "value": str(tmp_path / "output.h5::/1.1"),
        },
    ]


def get_expected_outputs(tmp_path) -> Dict[str, Dict[str, Any]]:
    bliss_scan_uri = str(tmp_path / "output.h5::/1.1")
    output_root_uri = str(tmp_path / "output.h5::/1.1")
    return {
        "Mosaic Mesh (multi detector)": {
            "config": str(tmp_path / "input.h5::/1.1/theory/configuration/data"),
            "configs": [str(tmp_path / "input.h5::/1.1/theory/configuration/data")] * 2,
            "detector_names": ["mca0", "mca1"],
            "detector_normalization_template": "0.1/<instrument/{}/live_time>",
            "expo_time": 0.1,
            "filenames": [str(tmp_path / "input.h5")],
            "monitor_name": "I0",
            "monitor_normalization_template": "1000000/<instrument/{}/data>",
            "scan_ranges": [(1, 6)],
        },
        "Pick scans": {
            "bliss_scan_uris": [
                str(tmp_path / f"input.h5::/{i+1}.1") for i in range(6)
            ],
        },
        "Concat BLISS scans": {
            "bliss_scan_uri": str(tmp_path / "concat.h5::/1.1"),
        },
        "Sum Spectra": {
            "detector_name": "mcasum",
            "bliss_scan_uri": bliss_scan_uri,
            "xrf_spectra_uri_template": "instrument/{}/data",
            "output_root_uri": output_root_uri,
            "output_root_group": None,
        },
        "Fit scan (single detector)": {
            "bliss_scan_uri": bliss_scan_uri,
            "detector_name": "mcasum",
            "output_root_uri": output_root_uri,
            "output_root_group": None,
            "xrf_results_uri": str(tmp_path / "output.h5::/1.1/fit/mcasum/results"),
        },
        "Normalize": {
            "bliss_scan_uri": bliss_scan_uri,
            "output_root_uri": output_root_uri,
            "output_root_group": None,
            "xrf_results_uri": str(tmp_path / "output.h5::/1.1/norm/results"),
        },
        "Raw Counters": {
            "bliss_scan_uri": bliss_scan_uri,
            "output_root_uri": output_root_uri,
            "output_root_group": None,
            "xrf_results_uri": str(tmp_path / "output.h5::/1.1/merge/results"),
        },
        "Regrid": {
            "bliss_scan_uri": bliss_scan_uri,
            "output_root_uri": output_root_uri,
            "output_root_group": None,
            "xrf_results_uri": str(tmp_path / "output.h5::/1.1/regrid/results"),
        },
    }


def get_expected_hdf5(tmp_path) -> Tuple[str, Dict[str, Any]]:
    output_path = tmp_path / "output.h5"
    expected = {
        "@NX_class": "NXroot",
        "@extra_attrs": {"default"},
        "1.1": {
            "@NX_class": "NXentry",
            "@extra_attrs": {"default"},
            "end_time@shape": (),
            "fit": {
                "@NX_class": "NXcollection",
                "@extra_attrs": {"default"},
                "mcasum": {
                    "@NX_class": "NXprocess",
                    "@extra_attrs": {"default"},
                    "configuration": {
                        "@NX_class": "NXnote",
                        "data@shape": (),
                        "date@shape": (),
                        "type@shape": (),
                    },
                    "program@shape": (),
                    "results": {
                        "@NX_class": "NXcollection",
                        "@extra_attrs": {"default"},
                        "derivatives": {
                            "@NX_class": "NXdata",
                            "@axes": ["energy"],
                            "@signals": {
                                "Scatter_Compton000",
                                "Si_K",
                                "Ce_L",
                                "Ca_K",
                                "Scatter_Peak000",
                                "Fe_K",
                            },
                            "Ca_K@shape": (1024,),
                            "Ce_L@shape": (1024,),
                            "Fe_K@shape": (1024,),
                            "Scatter_Compton000@shape": (1024,),
                            "Scatter_Peak000@shape": (1024,),
                            "Si_K@shape": (1024,),
                            "energy@shape": (1024,),
                            "energy@units": "keV",
                        },
                        "diagnostics": {
                            "@NX_class": "NXdata",
                            "@signals": {"nFreeParameters", "nObservations"},
                            "nFreeParameters@shape": (3000,),
                            "nObservations@shape": (3000,),
                        },
                        "fit": {
                            "@NX_class": "NXdata",
                            "@axes": [".", "energy"],
                            "@signals": {"data", "model", "residuals"},
                            "data@shape": (3000, 1024),
                            "energy@shape": (1024,),
                            "energy@units": "keV",
                            "model@shape": (3000, 1024),
                            "residuals@shape": (3000, 1024),
                        },
                        "massfractions": {
                            "@NX_class": "NXdata",
                            "@signals": {"Ce_L", "Ca_K", "Fe_K", "Si_K"},
                            "Ca_K@shape": (3000,),
                            "Ce_L@shape": (3000,),
                            "Fe_K@shape": (3000,),
                            "Si_K@shape": (3000,),
                        },
                        "parameters": {
                            "@NX_class": "NXdata",
                            "@signals": {
                                "Scatter_Compton000",
                                "Si_K",
                                "Ce_L",
                                "Ca_K",
                                "Scatter_Peak000",
                                "Fe_K",
                            },
                            "Ca_K@shape": (3000,),
                            "Ce_L@shape": (3000,),
                            "Fe_K@shape": (3000,),
                            "Scatter_Compton000@shape": (3000,),
                            "Scatter_Peak000@shape": (3000,),
                            "Si_K@shape": (3000,),
                        },
                        "uncertainties": {
                            "@NX_class": "NXdata",
                            "@signals": {
                                "Scatter_Compton000",
                                "Si_K",
                                "Ce_L",
                                "Ca_K",
                                "Scatter_Peak000",
                                "Fe_K",
                            },
                            "Ca_K@shape": (3000,),
                            "Ce_L@shape": (3000,),
                            "Fe_K@shape": (3000,),
                            "Scatter_Compton000@shape": (3000,),
                            "Scatter_Peak000@shape": (3000,),
                            "Si_K@shape": (3000,),
                        },
                    },
                    "version@shape": (),
                },
            },
            "instrument": {
                "@NX_class": "NXinstrument",
                "I0": {"@NX_class": "NXdetector", "data@shape": (3000,)},
                "mca0": {
                    "@NX_class": "NXdetector",
                    "data@shape": (3000, 1024),
                    "elapsed_time@shape": (3000,),
                    "event_count_rate@shape": (3000,),
                    "events@shape": (3000,),
                    "fractional_dead_time@shape": (3000,),
                    "live_time@shape": (3000,),
                    "roi1@shape": (3000,),
                    "roi2@shape": (3000,),
                    "spectrum@shape": (3000, 1024),
                    "trigger_count_rate@shape": (3000,),
                    "trigger_live_time@shape": (3000,),
                    "triggers@shape": (3000,),
                },
                "mca1": {
                    "@NX_class": "NXdetector",
                    "data@shape": (3000, 1024),
                    "elapsed_time@shape": (3000,),
                    "event_count_rate@shape": (3000,),
                    "events@shape": (3000,),
                    "fractional_dead_time@shape": (3000,),
                    "live_time@shape": (3000,),
                    "roi1@shape": (3000,),
                    "roi2@shape": (3000,),
                    "spectrum@shape": (3000, 1024),
                    "trigger_count_rate@shape": (3000,),
                    "trigger_live_time@shape": (3000,),
                    "triggers@shape": (3000,),
                },
                "mcasum": {
                    "@NX_class": "NXdetector",
                    "data@shape": (3000, 1024),
                    "data@interpretation": "spectrum",
                },
                "positioners": {
                    "@NX_class": "NXcollection",
                    "energy@shape": (),
                    "energy@units": "keV",
                    "sampy@shape": (3000,),
                    "sampy@units": "um",
                    "sampz@shape": (3000,),
                    "sampz@units": "um",
                },
                "positioners_end": {
                    "@NX_class": "NXcollection",
                    "energy@shape": (),
                    "energy@units": "keV",
                    "sampy@shape": (3000,),
                    "sampy@units": "um",
                    "sampz@shape": (3000,),
                    "sampz@units": "um",
                },
                "positioners_start": {
                    "@NX_class": "NXcollection",
                    "energy@shape": (),
                    "energy@units": "keV",
                    "sampy@shape": (3000,),
                    "sampy@units": "um",
                    "sampz@shape": (3000,),
                    "sampz@units": "um",
                },
                "sampy": {
                    "@NX_class": "NXpositioner",
                    "value@shape": (3000,),
                    "value@units": "um",
                },
                "sampz": {
                    "@NX_class": "NXpositioner",
                    "value@shape": (3000,),
                    "value@units": "um",
                },
            },
            "measurement": {
                "@NX_class": "NXcollection",
                "I0@shape": (3000,),
                "mca0@shape": (3000, 1024),
                "mca0_elapsed_time@shape": (3000,),
                "mca0_event_count_rate@shape": (3000,),
                "mca0_events@shape": (3000,),
                "mca0_fractional_dead_time@shape": (3000,),
                "mca0_live_time@shape": (3000,),
                "mca0_roi1@shape": (3000,),
                "mca0_roi2@shape": (3000,),
                "mca0_trigger_count_rate@shape": (3000,),
                "mca0_trigger_live_time@shape": (3000,),
                "mca0_triggers@shape": (3000,),
                "mca1@shape": (3000, 1024),
                "mca1_elapsed_time@shape": (3000,),
                "mca1_event_count_rate@shape": (3000,),
                "mca1_events@shape": (3000,),
                "mca1_fractional_dead_time@shape": (3000,),
                "mca1_live_time@shape": (3000,),
                "mca1_roi1@shape": (3000,),
                "mca1_roi2@shape": (3000,),
                "mca1_trigger_count_rate@shape": (3000,),
                "mca1_trigger_live_time@shape": (3000,),
                "mca1_triggers@shape": (3000,),
                "mcasum@shape": (3000, 1024),
                "mcasum@interpretation": "spectrum",
                "sampy@shape": (3000,),
                "sampy@units": "um",
                "sampz@shape": (3000,),
                "sampz@units": "um",
            },
            "merge": {
                "@NX_class": "NXprocess",
                "@extra_attrs": {"default"},
                "configuration": {
                    "@NX_class": "NXnote",
                    "data@shape": (),
                    "date@shape": (),
                    "type@shape": (),
                },
                "program@shape": (),
                "results": {
                    "@NX_class": "NXcollection",
                    "@extra_attrs": {"default"},
                    "massfractions": {
                        "@NX_class": "NXdata",
                        "@signals": {"Ce_L", "Si_K", "Fe_K", "Ca_K"},
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                    "parameters": {
                        "@NX_class": "NXdata",
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Scatter_Compton000@shape": (3000,),
                        "Scatter_Peak000@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                    "rawcounters": {
                        "@NX_class": "NXdata",
                        "@signals": {
                            "mca1_trigger_count_rate",
                            "mca1_event_count_rate",
                            "mca0_trigger_count_rate",
                            "mca0_trigger_live_time",
                            "mca1_roi2",
                            "mca1_roi1",
                            "I0",
                            "mca1_triggers",
                            "mca0_event_count_rate",
                            "mca1_live_time",
                            "mca1_trigger_live_time",
                            "mca1_fractional_dead_time",
                            "mca1_elapsed_time",
                            "mca0_triggers",
                            "mca0_events",
                            "mca0_elapsed_time",
                            "sampy",
                            "mca0_fractional_dead_time",
                            "mca0_roi1",
                            "mca1_events",
                            "mca0_live_time",
                            "sampz",
                            "mca0_roi2",
                        },
                        "I0@shape": (3000,),
                        "mca0_elapsed_time@shape": (3000,),
                        "mca0_event_count_rate@shape": (3000,),
                        "mca0_events@shape": (3000,),
                        "mca0_fractional_dead_time@shape": (3000,),
                        "mca0_live_time@shape": (3000,),
                        "mca0_roi1@shape": (3000,),
                        "mca0_roi2@shape": (3000,),
                        "mca0_trigger_count_rate@shape": (3000,),
                        "mca0_trigger_live_time@shape": (3000,),
                        "mca0_triggers@shape": (3000,),
                        "mca1_elapsed_time@shape": (3000,),
                        "mca1_event_count_rate@shape": (3000,),
                        "mca1_events@shape": (3000,),
                        "mca1_fractional_dead_time@shape": (3000,),
                        "mca1_live_time@shape": (3000,),
                        "mca1_roi1@shape": (3000,),
                        "mca1_roi2@shape": (3000,),
                        "mca1_trigger_count_rate@shape": (3000,),
                        "mca1_trigger_live_time@shape": (3000,),
                        "mca1_triggers@shape": (3000,),
                        "sampy@shape": (3000,),
                        "sampy@units": "um",
                        "sampz@shape": (3000,),
                        "sampz@units": "um",
                    },
                    "uncertainties": {
                        "@NX_class": "NXdata",
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Scatter_Compton000@shape": (3000,),
                        "Scatter_Peak000@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                },
                "version@shape": (),
            },
            "norm": {
                "@NX_class": "NXprocess",
                "@extra_attrs": {"default"},
                "configuration": {
                    "@NX_class": "NXnote",
                    "data@shape": (),
                    "date@shape": (),
                    "type@shape": (),
                },
                "program@shape": (),
                "results": {
                    "@NX_class": "NXcollection",
                    "@extra_attrs": {"default"},
                    "massfractions": {
                        "@NX_class": "NXdata",
                        "@signals": {"Ce_L", "Si_K", "Fe_K", "Ca_K"},
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                    "parameters": {
                        "@NX_class": "NXdata",
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Scatter_Compton000@shape": (3000,),
                        "Scatter_Peak000@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                    "uncertainties": {
                        "@NX_class": "NXdata",
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (3000,),
                        "Ce_L@shape": (3000,),
                        "Fe_K@shape": (3000,),
                        "Scatter_Compton000@shape": (3000,),
                        "Scatter_Peak000@shape": (3000,),
                        "Si_K@shape": (3000,),
                    },
                },
                "version@shape": (),
            },
            "regrid": {
                "@NX_class": "NXprocess",
                "@extra_attrs": {"default"},
                "configuration": {
                    "@NX_class": "NXnote",
                    "data@shape": (),
                    "date@shape": (),
                    "type@shape": (),
                },
                "program@shape": (),
                "results": {
                    "@NX_class": "NXcollection",
                    "@extra_attrs": {"default"},
                    "coordinates": {
                        "@NX_class": "NXcollection",
                        "closest_grid_distance": {
                            "@NX_class": "NXdata",
                            "@axes": ["sampy", "sampz"],
                            "@signals": {"distance"},
                            "distance@shape": (3000,),
                            "sampy@shape": (3000,),
                            "sampy@long_name": "sampy (um)",
                            "sampy@units": "um",
                            "sampz@shape": (3000,),
                            "sampz@long_name": "sampz (um)",
                            "sampz@units": "um",
                            "title@shape": (),
                        },
                        "closest_scatter_distance": {
                            "@NX_class": "NXdata",
                            "@axes": ["sampy", "sampz"],
                            "@signals": {"distance"},
                            "distance@shape": (3456,),
                            "sampy@shape": (3456,),
                            "sampy@long_name": "sampy (um)",
                            "sampy@units": "um",
                            "sampz@shape": (3456,),
                            "sampz@long_name": "sampz (um)",
                            "sampz@units": "um",
                            "title@shape": (),
                        },
                        "coordinates": {
                            "@NX_class": "NXdata",
                            "@axes": ["sampy", "sampz"],
                            "@signals": {"coordinate_type"},
                            "coordinate_type@shape": (6456,),
                            "sampy@shape": (6456,),
                            "sampy@long_name": "sampy (um)",
                            "sampy@units": "um",
                            "sampz@shape": (6456,),
                            "sampz@long_name": "sampz (um)",
                            "sampz@units": "um",
                            "title@shape": (),
                        },
                        "grid_coordinates": {
                            "@NX_class": "NXdata",
                            "@axes": ["sampy", "sampz"],
                            "@signals": {"has_data"},
                            "has_data@shape": (3456,),
                            "sampy@shape": (3456,),
                            "sampy@long_name": "sampy (um)",
                            "sampy@units": "um",
                            "sampz@shape": (3456,),
                            "sampz@long_name": "sampz (um)",
                            "sampz@units": "um",
                            "title@shape": (),
                        },
                        "scatter_coordinates": {
                            "@NX_class": "NXdata",
                            "@axes": ["sampy", "sampz"],
                            "@signals": {"indices"},
                            "indices@shape": (3000,),
                            "sampy@shape": (3000,),
                            "sampy@long_name": "sampy (um)",
                            "sampy@units": "um",
                            "sampz@shape": (3000,),
                            "sampz@long_name": "sampz (um)",
                            "sampz@units": "um",
                            "title@shape": (),
                        },
                    },
                    "massfractions": {
                        "@NX_class": "NXdata",
                        "@axes": ["sampz", "sampy"],
                        "@signals": {"Ce_L", "Si_K", "Fe_K", "Ca_K"},
                        "Ca_K@shape": (54, 64),
                        "Ce_L@shape": (54, 64),
                        "Fe_K@shape": (54, 64),
                        "Si_K@shape": (54, 64),
                        "sampy@shape": (64,),
                        "sampy@long_name": "sampy (um)",
                        "sampy@units": "um",
                        "sampy_indices@shape": (),
                        "sampz@shape": (54,),
                        "sampz@long_name": "sampz (um)",
                        "sampz@units": "um",
                        "sampz_indices@shape": (),
                    },
                    "parameters": {
                        "@NX_class": "NXdata",
                        "@axes": ["sampz", "sampy"],
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (54, 64),
                        "Ce_L@shape": (54, 64),
                        "Fe_K@shape": (54, 64),
                        "Scatter_Compton000@shape": (54, 64),
                        "Scatter_Peak000@shape": (54, 64),
                        "Si_K@shape": (54, 64),
                        "sampy@shape": (64,),
                        "sampy@long_name": "sampy (um)",
                        "sampy@units": "um",
                        "sampy_indices@shape": (),
                        "sampz@shape": (54,),
                        "sampz@long_name": "sampz (um)",
                        "sampz@units": "um",
                        "sampz_indices@shape": (),
                    },
                    "rawcounters": {
                        "@NX_class": "NXdata",
                        "@axes": ["sampz", "sampy"],
                        "@signals": {
                            "mca1_trigger_count_rate",
                            "mca1_event_count_rate",
                            "mca0_trigger_count_rate",
                            "mca0_trigger_live_time",
                            "mca1_roi2",
                            "mca1_roi1",
                            "I0",
                            "mca1_triggers",
                            "mca0_event_count_rate",
                            "mca1_live_time",
                            "mca1_trigger_live_time",
                            "mca1_fractional_dead_time",
                            "mca1_elapsed_time",
                            "mca0_triggers",
                            "mca0_events",
                            "mca0_elapsed_time",
                            "mca0_fractional_dead_time",
                            "mca0_roi1",
                            "mca1_events",
                            "mca0_live_time",
                            "mca0_roi2",
                        },
                        "I0@shape": (54, 64),
                        "mca0_elapsed_time@shape": (54, 64),
                        "mca0_event_count_rate@shape": (54, 64),
                        "mca0_events@shape": (54, 64),
                        "mca0_fractional_dead_time@shape": (54, 64),
                        "mca0_live_time@shape": (54, 64),
                        "mca0_roi1@shape": (54, 64),
                        "mca0_roi2@shape": (54, 64),
                        "mca0_trigger_count_rate@shape": (54, 64),
                        "mca0_trigger_live_time@shape": (54, 64),
                        "mca0_triggers@shape": (54, 64),
                        "mca1_elapsed_time@shape": (54, 64),
                        "mca1_event_count_rate@shape": (54, 64),
                        "mca1_events@shape": (54, 64),
                        "mca1_fractional_dead_time@shape": (54, 64),
                        "mca1_live_time@shape": (54, 64),
                        "mca1_roi1@shape": (54, 64),
                        "mca1_roi2@shape": (54, 64),
                        "mca1_trigger_count_rate@shape": (54, 64),
                        "mca1_trigger_live_time@shape": (54, 64),
                        "mca1_triggers@shape": (54, 64),
                        "sampy@shape": (64,),
                        "sampy@long_name": "sampy (um)",
                        "sampy@units": "um",
                        "sampy_indices@shape": (),
                        "sampz@shape": (54,),
                        "sampz@long_name": "sampz (um)",
                        "sampz@units": "um",
                        "sampz_indices@shape": (),
                    },
                    "title@shape": (),
                    "uncertainties": {
                        "@NX_class": "NXdata",
                        "@axes": ["sampz", "sampy"],
                        "@signals": {
                            "Scatter_Compton000",
                            "Si_K",
                            "Ce_L",
                            "Ca_K",
                            "Scatter_Peak000",
                            "Fe_K",
                        },
                        "Ca_K@shape": (54, 64),
                        "Ce_L@shape": (54, 64),
                        "Fe_K@shape": (54, 64),
                        "Scatter_Compton000@shape": (54, 64),
                        "Scatter_Peak000@shape": (54, 64),
                        "Si_K@shape": (54, 64),
                        "sampy@shape": (64,),
                        "sampy@long_name": "sampy (um)",
                        "sampy@units": "um",
                        "sampy_indices@shape": (),
                        "sampz@shape": (54,),
                        "sampz@long_name": "sampz (um)",
                        "sampz@units": "um",
                        "sampz_indices@shape": (),
                    },
                },
                "version@shape": (),
            },
            "start_time@shape": (),
            "sumspectra": {
                "@NX_class": "NXprocess",
                "@extra_attrs": {"default"},
                "configuration": {
                    "@NX_class": "NXnote",
                    "data@shape": (),
                    "date@shape": (),
                    "type@shape": (),
                },
                "mcasum": {
                    "@NX_class": "NXdata",
                    "@signals": {"data"},
                    "data@shape": (3000, 1024),
                    "data@interpretation": "spectrum",
                },
                "program@shape": (),
                "version@shape": (),
            },
        },
    }
    return output_path, expected
