{ "info": { "author": "Mads Bertelsen", "author_email": "Mads.Bertelsen@esss.se", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# McStasScript\nMcStas API for creating and running McStas instruments from python scripting\n\nPrototype for an API that allow interaction with McStas through an interface like Jupyter Notebooks created under WP5 of PaNOSC.\n\n## Installation\nThe package can be installed using pip\n\n python3 -m pip install McStasScript --upgrade\n\nIt is necessary to configure the package so the McStas installation can be found, here we show how the appropriate code for an Ubuntu system. The configuration is saved permanently, and only needs to be updated when McStas is updated.\n\n from mcstasscript.interface import functions\n my_configurator = functions.Configurator()\n my_configurator.set_mcrun_path(\"/usr/bin/\")\n my_configurator.set_mcstas_path(\"/usr/share/mcstas/2.5/\")\n\n\n## Instructions for basic use:\nImport the interface \n\n from mcstasscript.interface import instr, plotter, functions, reader\n\nNow the package can be used. Start with creating a new instrument, just needs a name\n\n my_instrument = instr.McStas_instr(\"my_instrument_file\")\n\nThen McStas components can be added, here we add a source\n\n my_source = my_instrument.add_component(\"source\", \"Source_simple\")\n my_source.show_parameters() # Can be used to show available parameters for Source simple\n\nThe parameters of the source can be adjusted directly as attributes of the python object\n\n my_source.xwidth = 0.12\n my_source.yheight = 0.12\n my_source.lambda0 = 3\n my_source.dlambda = 2.2\n my_source.focus_xw = 0.05\n my_source.focus_yh = 0.05\n\nA monitor is added as well to get data out of the simulation\n\n PSD = my_instrument.add_component(\"PSD\", \"PSD_monitor\", AT=[0,0,1], RELATIVE=\"source\") \n PSD.xwidth = 0.1\n PSD.yheight = 0.1\n PSD.nx = 200\n PSD.ny = 200\n PSD.filename = \"\\\"PSD.dat\\\"\"\n\nThis simple simulation can be executed from the \n\n data = my_instrument.run_full_instrument(foldername=\"first_run\", increment_folder_name=True)\n\nResults from the monitors would be stored as a list of McStasData objects in the returned data. The counts are stored as numpy arrays. We can read and change the intensity directly and manipulate the data before plotting.\n\n data[0].Intensity\n\nPlotting is usually done in a subplot of all monitors recorded. \n\n plot = plotter.make_sub_plot(data)\n\n## Use in existing project\nIf one wish to work on existing projects using McStasScript, there is a reader included that will read a McStas Instrument file and write the corresponding McStasScript python instrument to disk. Here is an example where the PSI_DMC.instr example is converted:\n\n Reader = reader.McStas_file(\"PSI_DMC.instr\")\n Reader.write_python_file(\"PSI_DMC_generated.py\")\n\nIt is highly advised to run a check between the output of the generated file and the original to ensure the process was sucessful.\n\n## Method overview\nHere is a quick overview of the available methods of the main classes in the project. Most have more options from keyword arguments that are explained in the manual, but also in python help, for example help(instr.McStas_instr.show_components).\n\n instr\n \u2514\u2500\u2500 McStas_instr(str instr_name) # Returns McStas instrument object on initialize\n \u251c\u2500\u2500 show_components(str category_name) # Show available components in given category\n \u251c\u2500\u2500 component_help(str component_name) # Prints component parameters for given component name \n \u251c\u2500\u2500 add_component(str name, str component_name) # Adds component to instrument and returns object\n \u251c\u2500\u2500 add_parameter(str name) # Adds instrument parameter with name\n \u251c\u2500\u2500 add_declare_var(str type, str name) # Adds declared variable with type and name\n \u251c\u2500\u2500 append_initialize(str string) # Appends a line to initialize (c syntax)\n \u251c\u2500\u2500 print_components() # Prints list of components and their location\n \u251c\u2500\u2500 write_full_instrument() # Writes instrument to disk with given name + \".instr\"\n \u2514\u2500\u2500 run_full_instrument() # Runs simulation. Options in keyword arguments. Returns list of McStasData\n\n component # returned by add_component\n \u251c\u2500\u2500 set_AT(list at_list) # Sets component position (list of x,y,z positions in [m])\n \u251c\u2500\u2500 set_ROTATED(list rotated_list) # Sets component rotation (list of x,y,z rotations in [deg])\n \u251c\u2500\u2500 set_RELATIVE(str component_name) # Sets relative to other component name\n \u251c\u2500\u2500 set_parameters(dict input) # Set parameters using dict input\n \u251c\u2500\u2500 set_comment(str string) # Set comment explaining something about the component\n \u2514\u2500\u2500 print_long() # Prints currently contained information on component\n\n functions\n \u251c\u2500\u2500 name_search(str name, list McStasData) # Returns data set with given name from McStasData list\n \u251c\u2500\u2500 name_plot_options(str name, list McStasData, kwargs) # Sends kwargs to dataset with given name\n \u251c\u2500\u2500 load_data(str foldername) # Loads data from folder with McStas data as McStasData list\n \u2514\u2500\u2500 Configurator()\n \u251c\u2500\u2500 set_mcrun_path(str path) # sets mcrun path\n \u251c\u2500\u2500 set_mcstas_path(str path) # sets mcstas path\n \u2514\u2500\u2500 set_line_length(int length) # sets maximum line length\n\n plotter\n \u251c\u2500\u2500 make_plot(list McStasData) # Plots each data set individually\n \u2514\u2500\u2500 make_sub_plot(list McStasData) # Plots data as subplot\n\n reader\n \u2514\u2500\u2500 McStas_file(str filename) # Returns a reader that can extract information from given instr file\n\n InstrumentReader # returned by McStas_file\n \u251c\u2500\u2500 generate_python_file(str filename) # Writes python file with information contaiend in isntrument\n \u2514\u2500\u2500 add_to_instr(McStas_instr Instr) # Adds information from instrument to McStasScirpt instrument\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PaNOSC-ViNYL/McStasScript", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "McStasScript", "package_url": "https://pypi.org/project/McStasScript/", "platform": "", "project_url": "https://pypi.org/project/McStasScript/", "project_urls": { "Homepage": "https://github.com/PaNOSC-ViNYL/McStasScript" }, "release_url": "https://pypi.org/project/McStasScript/0.0.10/", "requires_dist": [ "numpy", "matplotlib" ], "requires_python": "", "summary": "A python scripting interface for McStas", "version": "0.0.10" }, "last_serial": 5670402, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "7fb49bcabf853c67f6f9d191ecdc23e2", "sha256": "eed747eb019516bea4983fec6b3fe4e6851387445336c5699d2d7310d54ba40a" }, "downloads": -1, "filename": "mcstasscript-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "7fb49bcabf853c67f6f9d191ecdc23e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 68122, "upload_time": "2019-07-25T11:51:48", "url": "https://files.pythonhosted.org/packages/3d/5d/c5001c646ff7915cbe349e5a0fec8ac14defa2129b68105e707911b47db7/mcstasscript-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a538067e7e202421630615555565ffaf", "sha256": "1fe70110517b780d101d3c921275f8bfd0cdaf204239f86a80b08840ab788474" }, "downloads": -1, "filename": "McStasScript-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a538067e7e202421630615555565ffaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 208915, "upload_time": "2019-07-25T11:51:51", "url": "https://files.pythonhosted.org/packages/4b/f9/6e1dc06d1b5e99ecdd5e1da24709cbd3921db6a9d568788c7e6c153808db/McStasScript-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "4ac0cd101a80486f2df2618e816bedf3", "sha256": "f2659a3549b4c65e7aa01c9c7582f6d51f8f745efc5ce4f7db0a03a542bda681" }, "downloads": -1, "filename": "McStasScript-0.0.10-py3-none-any.whl", "has_sig": false, "md5_digest": "4ac0cd101a80486f2df2618e816bedf3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1652752, "upload_time": "2019-08-13T06:50:28", "url": "https://files.pythonhosted.org/packages/17/24/f8471ba622358604fd5014d8cb97fa5f98c03762e542841eb87279af46ac/McStasScript-0.0.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c0f34e292987999356f9292fbd366b5", "sha256": "f9cdf62f963d5f0c2e6ad88bbac60c468fc07a960c4cd757066c4d2cbb572498" }, "downloads": -1, "filename": "McStasScript-0.0.10.tar.gz", "has_sig": false, "md5_digest": "4c0f34e292987999356f9292fbd366b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1776545, "upload_time": "2019-08-13T06:50:30", "url": "https://files.pythonhosted.org/packages/c9/a4/44ab220c394e2de8c0cb85f13b39b612cc24d67242f9e0db23aca7d4f3a7/McStasScript-0.0.10.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2b6d162ed4c3390a4de06de9065001af", "sha256": "cc571db38aeb21f84ea5db002b204b04c3bfc9899a5250cc19bc70edf0a32e97" }, "downloads": -1, "filename": "McStasScript-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2b6d162ed4c3390a4de06de9065001af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 71643, "upload_time": "2019-07-25T12:14:50", "url": "https://files.pythonhosted.org/packages/54/82/1588ff75c3662d2987e03eb96eeb67b94905f64f5cf8eb22cfd152ddd654/McStasScript-0.0.2-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "7d4980f673e3f9f0ddd6909455cff669", "sha256": "b9d20f23d760584b35c2e53838442f11c22cab6b2a3e109b1565b813a9f2c8b1" }, "downloads": -1, "filename": "McStasScript-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7d4980f673e3f9f0ddd6909455cff669", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1626824, "upload_time": "2019-07-25T13:53:07", "url": "https://files.pythonhosted.org/packages/45/97/b0e5185f212a204b679e5b9edb8280025ad1700ef85468c3f19a59494ae4/McStasScript-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "588c216133445bfa93b27647639291ee", "sha256": "ccd52ab7d808d4c83923c5efaa07f9d9f8cab8fe6dbd6648e2082ae9723e6b53" }, "downloads": -1, "filename": "McStasScript-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "588c216133445bfa93b27647639291ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1630418, "upload_time": "2019-07-25T14:16:33", "url": "https://files.pythonhosted.org/packages/d3/70/7602b2c9652935c0bea2b99242b8df505d4eda1a2e70003db48f8a209428/McStasScript-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "4753b6e0ac87d4d4d6f55caa1c14c881", "sha256": "9b4df3bd7380d5b399b3d9501c85b601f3eb47614818cdd323b5b45e553d47db" }, "downloads": -1, "filename": "McStasScript-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "4753b6e0ac87d4d4d6f55caa1c14c881", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1633635, "upload_time": "2019-07-26T08:59:55", "url": "https://files.pythonhosted.org/packages/b8/3a/f65a2970ecc28f0adaa65362a9207e7e59ffedbd85d930687ea4e19329c0/McStasScript-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "70965b909bc19e877b44bd40349e5f55", "sha256": "4ea2fe1503b898418cbdd8912f77ec369a17dd0f051562975fa8f0e2e91cd7c8" }, "downloads": -1, "filename": "McStasScript-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "70965b909bc19e877b44bd40349e5f55", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1633636, "upload_time": "2019-07-26T10:32:02", "url": "https://files.pythonhosted.org/packages/44/ff/5efea7664b49597aa257285f179e92ca2592ec2e56f3f109b0f1289bf807/McStasScript-0.0.6-py3-none-any.whl" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "58bc2ee34be60c47c295784a1a1ffa02", "sha256": "ccc30ea22c7195853c9d86026ea893c6a736f70eec83aee3db915c574ba5fa34" }, "downloads": -1, "filename": "McStasScript-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "58bc2ee34be60c47c295784a1a1ffa02", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1633807, "upload_time": "2019-07-26T10:35:40", "url": "https://files.pythonhosted.org/packages/11/7e/dc55f08d8f19cf86419a1759af1b89c83abd2f825fcf37b1b81c856f5674/McStasScript-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc20d7ad5150bedfe79d4698fbf6f877", "sha256": "cbc73e2e16480b95afbb81a5bcf436d9e471550ee4196d917c95e8c5eca06c4b" }, "downloads": -1, "filename": "McStasScript-0.0.7.tar.gz", "has_sig": false, "md5_digest": "bc20d7ad5150bedfe79d4698fbf6f877", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1757840, "upload_time": "2019-07-26T10:35:42", "url": "https://files.pythonhosted.org/packages/bb/2f/ce996681568b3dd516a8731f97a445000935bf9e8b4b1a9c7e838df17802/McStasScript-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "904a90e0c451f8898f26653c00aae373", "sha256": "ddeb955e12351623573db953bf7407bbfe3567e3f2da54d70fc85f2d11643533" }, "downloads": -1, "filename": "McStasScript-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "904a90e0c451f8898f26653c00aae373", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1633811, "upload_time": "2019-07-29T08:41:41", "url": "https://files.pythonhosted.org/packages/0e/e2/c5a26804be30f6a0814abdbf46ef728292bcdad852bd6f91bb7c40a3e2f8/McStasScript-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "553042604d037f175810446648fffb35", "sha256": "20503b261d0755d99168313f321d06912d04a54800a83b61e878c80c45f8f26f" }, "downloads": -1, "filename": "McStasScript-0.0.8.tar.gz", "has_sig": false, "md5_digest": "553042604d037f175810446648fffb35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1757847, "upload_time": "2019-07-29T08:41:43", "url": "https://files.pythonhosted.org/packages/56/0a/c24af13421dd6c3e121bb2cfdd52ac0b3d5c702b8580a34167c4053d832b/McStasScript-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "4c35b4ae3387d3c6c30862aff19ab7fa", "sha256": "ed95e968137942d733a68c2bff23be3f7ef9acf004f7f5f1f10b56b92381d6a8" }, "downloads": -1, "filename": "McStasScript-0.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "4c35b4ae3387d3c6c30862aff19ab7fa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1652740, "upload_time": "2019-08-12T12:42:38", "url": "https://files.pythonhosted.org/packages/d2/a8/d5d6ceb7f94caa5f13da87383a7bc33b90c044501ab69b330f5d9915c5b0/McStasScript-0.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c5cbe39c5ef752fc187a3990d26ea429", "sha256": "6d8b9da4d56bd91a5a8ed9e92b158a8dc66a4d8c8665957bcf79a24f47c99121" }, "downloads": -1, "filename": "McStasScript-0.0.9.tar.gz", "has_sig": false, "md5_digest": "c5cbe39c5ef752fc187a3990d26ea429", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1776533, "upload_time": "2019-08-12T12:42:40", "url": "https://files.pythonhosted.org/packages/98/b6/1a25793f77b2d91c1e78b0626694765539da27789bed1c385949e76786f1/McStasScript-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ac0cd101a80486f2df2618e816bedf3", "sha256": "f2659a3549b4c65e7aa01c9c7582f6d51f8f745efc5ce4f7db0a03a542bda681" }, "downloads": -1, "filename": "McStasScript-0.0.10-py3-none-any.whl", "has_sig": false, "md5_digest": "4ac0cd101a80486f2df2618e816bedf3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1652752, "upload_time": "2019-08-13T06:50:28", "url": "https://files.pythonhosted.org/packages/17/24/f8471ba622358604fd5014d8cb97fa5f98c03762e542841eb87279af46ac/McStasScript-0.0.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c0f34e292987999356f9292fbd366b5", "sha256": "f9cdf62f963d5f0c2e6ad88bbac60c468fc07a960c4cd757066c4d2cbb572498" }, "downloads": -1, "filename": "McStasScript-0.0.10.tar.gz", "has_sig": false, "md5_digest": "4c0f34e292987999356f9292fbd366b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1776545, "upload_time": "2019-08-13T06:50:30", "url": "https://files.pythonhosted.org/packages/c9/a4/44ab220c394e2de8c0cb85f13b39b612cc24d67242f9e0db23aca7d4f3a7/McStasScript-0.0.10.tar.gz" } ] }