Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,585 changes: 0 additions & 1,585 deletions 3-mcstas/mcstas-powder-diffraction-short.ipynb

This file was deleted.

99 changes: 29 additions & 70 deletions 3-mcstas/mcstas-powder-diffraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
},
"outputs": [],
"source": [
"instrument.settings(ncount=4.0e6, mpi=4, suppress_output=True, NeXus=True, output_path=\"first_run\")"
"instrument.settings(ncount=4.0e6, mpi=6, suppress_output=True, NeXus=True, output_path=\"first_run\")"
]
},
{
Expand Down Expand Up @@ -735,14 +735,10 @@
"slideshow": {
"slide_type": ""
},
"tags": [
"solution",
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
"instrument.available_components(\"optics\")\n",
"instrument.component_help(\"DiskChopper\")"
]
},
Expand Down Expand Up @@ -775,10 +771,7 @@
},
"outputs": [],
"source": [
"make_powder_instrument.add_chopper_calculations(instrument)\n",
"\n",
"# If low on time, its possible to add the calculations and choppper component, solving question 7 and 8. Only run one of the two functions.\n",
"#make_powder_instrument.add_chopper(instrument)"
"make_powder_instrument.add_chopper_calculations(instrument)"
]
},
{
Expand All @@ -804,10 +797,7 @@
"slideshow": {
"slide_type": ""
},
"tags": [
"solution",
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
Expand All @@ -825,19 +815,19 @@
"tags": []
},
"source": [
"### Add chopper component and set parameters\n",
"### Adding chopper component and set parameters\n",
"\n",
"Use the `add_component` method on the instrument object to add a chopper.\n",
"Place it in the component sequence according to your answer in question 6 by using either the `before` or `after` keyword argument.\n",
"The `add_component` method on the instrument object is used to add the chopper component.\n",
"It is placed in the component sequence according to the correct answer in question 6 by using the `after` keyword argument.\n",
"\n",
"The `add_component` method returns a component object, store that in a python variable.\n",
"The `add_component` method returns a component object, which is stored in a python variable.\n",
"\n",
"Set the following parameters on the chopper component object:\n",
"The following parameters on the chopper component object are set:\n",
"- `yheight`: 0.05 m\n",
"- `radius`: 0.35 m\n",
"- `nslit`: 1.0\n",
"- `theta_0`: 7.0 deg\n",
"- `delay`: To the variable calculated in the instrument (use quotation marks)\n",
"- `delay`: To the variable calculated in the instrument (using quotation marks)\n",
"- `nu`: A calculation using the `frequency_multiplier` variable, \"frequency_multiplier*14.0\"\n"
]
},
Expand All @@ -850,10 +840,7 @@
"slideshow": {
"slide_type": ""
},
"tags": [
"solution",
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
Expand All @@ -866,24 +853,6 @@
"chopper.delay = \"delay\" # Variable with calculated delay"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52a34b9e-0579-4673-a9cb-e69b5e3e6e57",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-output"
]
},
"outputs": [],
"source": [
"quiz.question_7(instrument)"
]
},
{
"cell_type": "markdown",
"id": "427be722-2d19-4783-8d59-d8e1f1ed1bfe",
Expand All @@ -896,14 +865,12 @@
},
"source": [
"### Placing the component in space\n",
"The next task is to specify the physical location of the component, this is done using the `set_AT` method on the component object.\n",
"Next the physical location of the component is specified, this is done using the `set_AT` method on the component object.\n",
"This method takes a list of 3 numbers, corresponding to the `x`, `y` and `z` coordinates of the component. If just a single number is specified instead of a list, that is assumed to be the `z` coordinate.\n",
"\n",
"One can also specify in what coordinate system one wants to work, which can be that of any preceding component.\n",
"Use the `RELATIVE` keyword to work in the `Source` coordinate system.\n",
"The position of the chopper is needed for calculating the phase, so it is available as a variable in the instrument, use this variable to set the position.\n",
"\n",
"Set the chopper position, a variable is already created with the name \"chopper_position\" and value of 6.5 meters, this is the distance relative to the neutron Source."
"The `RELATIVE` keyword is used to selecting the `Source` coordinate system.\n",
"The position of the chopper is needed for calculating the phase, so it is available as a variable in the instrument, which is used to set the `z` coordinate in the position. When the `set_AT` method is only given one value, it is assumed to be the `z` coordinate."
]
},
{
Expand All @@ -915,10 +882,7 @@
"slideshow": {
"slide_type": ""
},
"tags": [
"solution",
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
Expand All @@ -927,7 +891,7 @@
},
{
"cell_type": "markdown",
"id": "f5b55bd1-bdcd-4553-9182-cbce5662211c",
"id": "07eaa5b5-74fa-4cca-a58d-006a81118269",
"metadata": {
"editable": true,
"slideshow": {
Expand All @@ -936,30 +900,30 @@
"tags": []
},
"source": [
"To check if the component was added correctly, provide your instrument object to the *question_8* function below."
"### Verify new component\n",
"\n",
"Now that the chopper has been added to the instrument, let's show the component sequence again to verify it was added correctly."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "027d2865-ed60-406e-a696-ba18c65488a9",
"id": "1ee44e85-36a7-4fd3-941f-838350ad6067",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-output"
]
"tags": []
},
"outputs": [],
"source": [
"quiz.question_8(instrument)"
"instrument.show_diagram()"
]
},
{
"cell_type": "markdown",
"id": "07eaa5b5-74fa-4cca-a58d-006a81118269",
"id": "396dd76e-b58d-41fe-aa40-b22d82d4484e",
"metadata": {
"editable": true,
"slideshow": {
Expand All @@ -968,28 +932,23 @@
"tags": []
},
"source": [
"### Verify new component\n",
"\n",
"Now that the chopper has been added to the instrument, let's show the component sequence again to verify it was added correctly."
"### The question below verifies the chopper was added correctly"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1ee44e85-36a7-4fd3-941f-838350ad6067",
"id": "76c9c1f9-4e2a-44f9-ba86-f32f65cd6fce",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"solution",
"hide-cell"
]
"tags": []
},
"outputs": [],
"source": [
"instrument.show_diagram()"
"quiz.question_8(instrument)"
]
},
{
Expand Down Expand Up @@ -1377,7 +1336,7 @@
},
"outputs": [],
"source": [
"instrument.settings(ncount=4.0e8, mpi=4, suppress_output=True, NeXus=True)"
"instrument.settings(ncount=4.0e7, mpi=6, suppress_output=True, NeXus=True)"
]
},
{
Expand Down Expand Up @@ -1618,7 +1577,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
Loading