diff --git a/docs/user-guide/tof/dream.ipynb b/docs/user-guide/tof/dream.ipynb index 9959947..0e30c45 100644 --- a/docs/user-guide/tof/dream.ipynb +++ b/docs/user-guide/tof/dream.ipynb @@ -296,10 +296,20 @@ "workflow.visualize(time_of_flight.TofData)" ] }, + { + "cell_type": "markdown", + "id": "19", + "metadata": {}, + "source": [ + "We can see from the workflow diagram that we are still missing the simulated neutrons that are used to build the lookup table.\n", + "\n", + "Those are obtained by running a quick `tof` simulation of the beamline:" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -311,7 +321,7 @@ }, { "cell_type": "markdown", - "id": "20", + "id": "21", "metadata": {}, "source": [ "### Inspecting the lookup table\n", @@ -328,7 +338,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -349,7 +359,7 @@ }, { "cell_type": "markdown", - "id": "22", + "id": "23", "metadata": {}, "source": [ "The lookup table is then obtained by computing the weighted mean of the time-of-flight inside each time-of-arrival bin.\n", @@ -360,7 +370,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -373,7 +383,7 @@ { "attachments": {}, "cell_type": "markdown", - "id": "24", + "id": "25", "metadata": {}, "source": [ "### Computing a time-of-flight coordinate\n", @@ -384,7 +394,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -394,7 +404,7 @@ }, { "cell_type": "markdown", - "id": "26", + "id": "27", "metadata": {}, "source": [ "Histogramming the data for a plot should show a profile with 6 bumps that correspond to the frames:" @@ -403,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27", + "id": "28", "metadata": {}, "outputs": [], "source": [ @@ -412,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "28", + "id": "29", "metadata": {}, "source": [ "### Converting to wavelength\n", @@ -423,7 +433,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29", + "id": "30", "metadata": {}, "outputs": [], "source": [ @@ -442,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "30", + "id": "31", "metadata": {}, "source": [ "### Comparing to the ground truth\n", @@ -454,7 +464,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31", + "id": "32", "metadata": {}, "outputs": [], "source": [ @@ -471,7 +481,7 @@ }, { "cell_type": "markdown", - "id": "32", + "id": "33", "metadata": {}, "source": [ "## Multiple detector pixels\n", @@ -487,7 +497,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -504,7 +514,7 @@ }, { "cell_type": "markdown", - "id": "34", + "id": "35", "metadata": {}, "source": [ "Our raw data has now a `detector_number` dimension of length 2.\n", @@ -515,7 +525,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35", + "id": "36", "metadata": {}, "outputs": [], "source": [ @@ -534,7 +544,7 @@ }, { "cell_type": "markdown", - "id": "36", + "id": "37", "metadata": {}, "source": [ "Computing time-of-flight is done in the same way as above.\n", @@ -544,7 +554,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37", + "id": "38", "metadata": {}, "outputs": [], "source": [ @@ -577,7 +587,7 @@ }, { "cell_type": "markdown", - "id": "38", + "id": "39", "metadata": {}, "source": [ "## Handling time overlap between subframes\n", @@ -597,7 +607,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39", + "id": "40", "metadata": {}, "outputs": [], "source": [ @@ -627,7 +637,7 @@ }, { "cell_type": "markdown", - "id": "40", + "id": "41", "metadata": {}, "source": [ "We can now see that there is no longer a gap between the two frames at the center of each pulse (green region).\n", @@ -639,14 +649,14 @@ { "cell_type": "code", "execution_count": null, - "id": "41", + "id": "42", "metadata": {}, "outputs": [], "source": [ "# Update workflow\n", "workflow[time_of_flight.SimulationResults] = time_of_flight.simulate_beamline(\n", " choppers=disk_choppers,\n", - " neutrons=2_000_000\n", + " number_of_neutrons=2_000_000\n", ")\n", "workflow[time_of_flight.RawData] = ess_beamline.get_monitor(\"detector\")[0]\n", "\n", @@ -665,7 +675,7 @@ }, { "cell_type": "markdown", - "id": "42", + "id": "43", "metadata": {}, "source": [ "The data in the lookup table contains both the mean time-of-flight for each distance and time-of-arrival bin,\n", @@ -682,7 +692,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43", + "id": "44", "metadata": {}, "outputs": [], "source": [ @@ -692,7 +702,7 @@ }, { "cell_type": "markdown", - "id": "44", + "id": "45", "metadata": {}, "source": [ "The workflow has a parameter which is used to mask out regions where the standard deviation is above a certain threshold.\n", @@ -706,7 +716,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45", + "id": "46", "metadata": {}, "outputs": [], "source": [ @@ -717,7 +727,7 @@ }, { "cell_type": "markdown", - "id": "46", + "id": "47", "metadata": {}, "source": [ "We can now see that the central region is masked out.\n", @@ -732,7 +742,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47", + "id": "48", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/user-guide/tof/wfm.ipynb b/docs/user-guide/tof/wfm.ipynb index 125629e..bce977f 100644 --- a/docs/user-guide/tof/wfm.ipynb +++ b/docs/user-guide/tof/wfm.ipynb @@ -307,12 +307,9 @@ "outputs": [], "source": [ "workflow = sl.Pipeline(\n", - " time_of_flight.standard_providers(), params=time_of_flight.default_parameters()\n", + " time_of_flight.providers(), params=time_of_flight.default_parameters()\n", ")\n", - "workflow[time_of_flight.Facility] = \"ess\"\n", - "workflow[time_of_flight.Choppers] = disk_choppers\n", "workflow[time_of_flight.RawData] = raw_data\n", - "workflow[time_of_flight.NumberOfNeutrons] = 3_000_000\n", "workflow[time_of_flight.LtotalRange] = Ltotal, Ltotal\n", "workflow[time_of_flight.LookupTableRelativeErrorThreshold] = 0.1\n", "\n", @@ -323,6 +320,29 @@ "cell_type": "markdown", "id": "18", "metadata": {}, + "source": [ + "We can see from the workflow diagram that we are still missing the simulated neutrons that are used to build the lookup table.\n", + "\n", + "Those are obtained by running a quick `tof` simulation of the beamline:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19", + "metadata": {}, + "outputs": [], + "source": [ + "workflow[time_of_flight.SimulationResults] = time_of_flight.simulate_beamline(\n", + " choppers=disk_choppers,\n", + " neutrons=3_000_000\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "20", + "metadata": {}, "source": [ "### Inspecting the lookup table\n", "\n", @@ -338,7 +358,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -359,7 +379,7 @@ }, { "cell_type": "markdown", - "id": "20", + "id": "22", "metadata": {}, "source": [ "The lookup table is then obtained by computing the weighted mean of the time-of-flight inside each time-of-arrival bin.\n", @@ -370,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -388,7 +408,7 @@ { "attachments": {}, "cell_type": "markdown", - "id": "22", + "id": "24", "metadata": {}, "source": [ "We can see that the orange lines follow the center of the colored areas.\n", @@ -404,7 +424,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "25", "metadata": {}, "outputs": [], "source": [ @@ -414,7 +434,7 @@ }, { "cell_type": "markdown", - "id": "24", + "id": "26", "metadata": {}, "source": [ "Histogramming the data for a plot should show a profile with 6 bumps that correspond to the frames:" @@ -423,7 +443,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -432,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "26", + "id": "28", "metadata": {}, "source": [ "### Converting to wavelength\n", @@ -443,7 +463,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -462,7 +482,7 @@ }, { "cell_type": "markdown", - "id": "28", + "id": "30", "metadata": {}, "source": [ "### Comparing to the ground truth\n", @@ -474,7 +494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29", + "id": "31", "metadata": {}, "outputs": [], "source": [