|
36 | 36 | "source": [
|
37 | 37 | "## TL;DR\n",
|
38 | 38 | "\n",
|
39 |
| - "This cell shows how build a pipeline and use it to compute a ``TimeBinned`` histogram with file type of ``FileTypeMcStas``." |
| 39 | + "This cell shows how build a pipeline and use it to compute a ``TimeBinned`` histogram." |
40 | 40 | ]
|
41 | 41 | },
|
42 | 42 | {
|
|
47 | 47 | "source": [
|
48 | 48 | "import sciline as sl\n",
|
49 | 49 | "from ess.nmx.workflow import collect_default_parameters, providers\n",
|
50 |
| - "from ess.nmx.loader import InputFileName, MaximumProbability, DefaultMaximumProbability\n", |
| 50 | + "from ess.nmx.loader import InputFileName, MaximumProbability, DefaultMaximumProbability, DefaultMcStasEventDataSchema, McStasEventDataSchema\n", |
51 | 51 | "from ess.nmx.data import small_mcstas_sample\n",
|
52 | 52 | "from ess.nmx.reduction import TimeBinned, TimeBinStep, get_intervals_mcstas\n",
|
53 | 53 | "from ess.nmx.logging import get_logger as get_nmx_logger\n",
|
54 | 54 | "\n",
|
55 | 55 | "file_path = small_mcstas_sample() # Replace it with your data file path\n",
|
56 |
| - "\n", |
57 |
| - "nmx_workflow = sl.Pipeline(list(providers)+[get_nmx_logger, get_intervals_mcstas],\n", |
58 |
| - " params={\n", |
59 |
| - " **collect_default_parameters(),\n", |
60 |
| - " MaximumProbability: DefaultMaximumProbability,\n", |
61 |
| - " TimeBinStep: TimeBinStep(1),\n", |
62 |
| - " InputFileName: InputFileName(file_path),\n", |
63 |
| - " })\n", |
| 56 | + "mcstas_proivders = [\n", |
| 57 | + " *providers,\n", |
| 58 | + " get_nmx_logger, # For logging.\n", |
| 59 | + " get_intervals_mcstas # Additional provider for McStas data handling.\n", |
| 60 | + "]\n", |
| 61 | + "mcstas_params = {\n", |
| 62 | + " **collect_default_parameters(),\n", |
| 63 | + " TimeBinStep: TimeBinStep(1),\n", |
| 64 | + " InputFileName: InputFileName(file_path),\n", |
| 65 | + " # Additional parameters for McStas data handling.\n", |
| 66 | + " McStasEventDataSchema: DefaultMcStasEventDataSchema,\n", |
| 67 | + " MaximumProbability: DefaultMaximumProbability,\n", |
| 68 | + " }\n", |
| 69 | + "\n", |
| 70 | + "nmx_workflow = sl.Pipeline(mcstas_proivders, params=mcstas_params)\n", |
64 | 71 | "\n",
|
65 | 72 | "time_binned = nmx_workflow.compute(TimeBinned)\n",
|
66 | 73 | "time_binned"
|
|
0 commit comments