{ "cells": [ { "cell_type": "markdown", "id": "decent-error", "metadata": {}, "source": [ "# Installation\n", "McStasScript needs to be installed and then configured. There are two ways to install, either through pip or from the source code directly. The configuration can be done after installation and changed at any point.\n", "\n", "Before installing McStasScript, install McStas or McXtrace as described on [www.mcstas.org](https://www.mcstas.org) or [www.mcxtrace.org](https://www.mcxtrace.org)." ] }, { "cell_type": "markdown", "id": "crude-continuity", "metadata": {}, "source": [ "## Pip\n", "The standard way to install McStasScript is through pip. For Unix and OS X, use this line in the terminal. For windows, use the McStas-shell or McXtrace-shell to run the install." ] }, { "cell_type": "markdown", "id": "ceramic-community", "metadata": {}, "source": [ "```\n", "pip install McStasScript --upgrade\n", "```" ] }, { "cell_type": "markdown", "id": "introductory-monitor", "metadata": {}, "source": [ "## From source\n", "A developer might one to install directly from source, this makes it easier to contribute to the project and see how changes to the code affect the package.\n", "\n", "Open a terminal and go to the location where the source code should be located, and use these commands." ] }, { "cell_type": "markdown", "id": "lesser-identifier", "metadata": {}, "source": [ "```\n", "git clone https://github.com/PaNOSC-ViNYL/McStasScript.git\n", "cd McStasScript\n", "pip install -r requirements.txt\n", "pip install -e .\n", "```" ] }, { "cell_type": "markdown", "id": "sound-familiar", "metadata": {}, "source": [ "## Configuration\n", "The McStasScript package has a configuration file in the source directory that can be changed with a text editor or through a configurator class included in the package. The configuration needs the path of the mcrun / mxrun executable and the base directory of the McStas/McXtrace installation.\n", "\n", "### Typical Mac OS configuration\n", "\n", "```\n", "import mcstasscript as ms\n", "my_configurator = ms.Configurator()\n", "my_configurator.set_mcrun_path(\"/Applications/McStas-2.7.1.app/Contents/Resources/mcstas/2.7.1/bin/\")\n", "my_configurator.set_mcstas_path(\"/Applications/McStas-2.7.1.app/Contents/Resources/mcstas/2.7.1/\")\n", "my_configurator.set_mxrun_path(\"/Applications/McXtrace-1.5.app/Contents/Resources/mcxtrace/1.5/bin/\")\n", "my_configurator.set_mcxtrace_path(\"/Applications/McXtrace-1.5.app/Contents/Resources/mcxtrace/1.5/\")\n", "print(my_configurator)\n", "```\n", "\n", "### Typical Unix configuration\n", "\n", "```\n", "import mcstasscript as ms\n", "my_configurator = ms.Configurator()\n", "my_configurator.set_mcrun_path(\"/usr/bin/\")\n", "my_configurator.set_mcstas_path(\"/usr/share/mcstas/2.7.1/\")\n", "my_configurator.set_mxrun_path(\"/usr/bin/\")\n", "my_configurator.set_mcxtrace_path(\"/usr/share/mcxtrace/1.5/\")\n", "print(my_configurator)\n", "```\n", "\n", "### Typical Windows configuration\n", "\n", "```\n", "import mcstasscript as ms\n", "my_configurator = ms.Configurator()\n", "my_configurator.set_mcrun_path(\"\\\\mcstas-2.7.1\\\\bin\\\\\")\n", "my_configurator.set_mcstas_path(\"\\\\mcstas-2.7.1\\\\lib\\\\\")\n", "my_configurator.set_mxrun_path(\"\\\\mcxtrace-1.5\\\\bin\\\\\")\n", "my_configurator.set_mcxtrace_path(\"\\\\mcxtrace-1.5\\\\lib\\\\\") \n", "print(my_configurator)\n", "```" ] }, { "cell_type": "markdown", "id": "stainless-class", "metadata": {}, "source": [ "## Tests\n", "In order to ensure the installation and configuration was successful, one can run the test suite. Navigate to the folder containing the McStasScript source code and run:\n", "```\n", "pytest\n", "```\n", "\n", "If pytest has not been installed yet, it can be installed with\n", "```\n", "pip install pytest\n", "```" ] }, { "cell_type": "code", "execution_count": null, "id": "creative-prison", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.8" } }, "nbformat": 4, "nbformat_minor": 5 }