{ "info": { "author": "Antonio Serrano", "author_email": "toni.sm91@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# PENGEOMGEN\n\nPython library for easy generation of PENELOPE PENGEOM geometry-definition file.\n\nPENGEOM can describe any material system consisting of homogeneous bodies limited by quadric surfaces. Its geometry definition file is a strictly formatted text lines that define blocks of elements \\[1\\]. Write manually a geometry description file can be a long and hard task (for example, a medium complex material system may have thousands of very strictly formatted lines).\n\nPenGeom.jar (a Java GUI application which is not part of the PENELOPE distribution package) allows the definition of the geometry and its visualization \\[2\\] through a visual interface. \n\n**pengeomgen** provide a simple, light and very customizable object-oriented API for create and export the strictly formatted geometry definition file for work with PENELOPE PENGEOM. A single class allows the definition of all basic and others predefined elements.\n\nReferences:\n\n> \\[1\\] F. Salvat. *PENELOPE, a code system for Monte Carlo simulation of electron and photon transport*. Workshop Proceedings, Barcelona, Spain. NEA/MBDAV/R(2019)1.\n\n> \\[2\\] Almansa, J., F. Salvat-Pujol, G. D\u00c3\u00adaz-Londo\u00c3\u00b1o, A. Carnicer, A. M. Lallena, and F. Salvat. *PENGEOM, A general-purpose geometry package for Monte Carlo simulation of radiation transport in complex material structures*. Comput. Phys. Commun. 199. (2016).\n\n## Setup\n\n```bash\n$ pip3 install pengeomgen\n```\n\n## Example of usage\n\n```python\nimport pengeomgen\n\ng=pengeomgen.GeometryDefinition(\"The pythonic champagne glass\")\n\ns1=g.surface(indices=( 0, 0, 0, 1, -1), zscale=9)\ns2=g.surface(indices=( 0, 0, 0, 1, -1), zscale=7)\ns4=g.surface_plane(zshift=-6)\ns5=g.surface_plane(zshift=-6.4)\ns6=g.surface_plane(zshift=-6.8)\n\ng.surface_paraboloid(\"S7\")\ng.surface_paraboloid(\"S8\", scale=(0.98, 0.98, 1), translation=(0, 0, 0.35))\n\ng.surface_cone(\"S9\", scale=(0.012, 0.012, 1), translation=(0, 0, -20))\ng.surface_cone(\"S10\", scale=(3.7, 3.7, 1), translation=(0, 0, -6))\ng.surface_cone(\"S11\", scale=(5.1, 5.1, 1), translation=(0, 0, -6.35))\n\ng.body(\"B1\", 2, surfaces=[(s1,-1), (\"S7\",-1), (\"S8\", 1)], comment=\"cup body\")\ng.body(\"B2\", 1, surfaces=[(\"S8\",-1), (s2,-1)], comment=\"liquid\")\ng.body(\"B3\", 2, surfaces=[(s5, 1), (\"S9\",-1), (\"S7\", 1)], comment=\"trunk\")\ng.body(\"B4\", 0, surfaces=[(s5,-1), (s6, 1), (\"S11\",-1)], comment=\"foot hole\")\ng.body(\"B5\", 2, surfaces=[(s4,-1), (s6, 1), (\"S10\",-1)], bodies=[\"B3\", \"B4\"], comment=\"foot body\")\n\nprint(g)\n\n# export the geometry definition file\ng.export_definition(\"glass\")\n```\n\n## Usage and API\n\nThe main name provided by the pengeomgen package is **GeometryDefinition**. This is a class name for manage the block of elements in a geometry definition file. Through its interface (methods), we can define surfaces, bodies, modules (in one line of code) using easy numeric notation and others features. Also, we can do operations like: clone, include external geometry definition, etc. \n\n```python\nimport pengeomgen\n\ng = pengeomgen.GeometryDefinition(description=\"\", unit=\"cm\", angle=\"DEG\")\n```\n* description (string): informative text\n* unit (string): unit of measurement for length (translation). This parameter allows us to define the material system in the units of the schematics, as example. The current unit (see the table below) is converted to centimeter when the geometry definition file is exported\n* angle (string): unit of measure for angles (rotation). This parameter can be \"rad\", \"RAD\" (radian) or \"deg\", \"DEG\" (degree)\n\n> The unit and angle parameters can be overwrite in the methods described below for construct quadric surfaces, modules and clones\n\nArgument (string) | Unit of measurement \n--------------------------- | --------------------- \nmm, millimeter, millimeters | millimeter\ncm, centimeter, centimeters | centimeter (default)\ndm, decimeter, decimeters | decimeter\nm, meter, meters | meter\nin, inch, inches | inch\nft, foot, feet | foot\n\n#### - Export geometry definition to a file\n\nFor export the constructed geometry definition to a file, we can call the **export_definition** method. This method has as only parameter the absolute or relative path of the output file. \n\n```python\ng.export_definition(\"output_file_path\")\n```\n\n#### - Show void inner volumes\n\nThe inner volumes can be modeled with the material value (a numeric value less or equal to zero). It\u00e2\u20ac\u2122s recommended that the material value be less than zero instead of zero, Then, with the method **show_void_inner_volumes** we can change the sign of the materials with negative values to positive (solid material) before export it.\n\n```python\ng.show_void_inner_volumes(show=True)\n```\n\n#### - Describe a material system using quadric surfaces\n\nThe methods for describe a material system using quadric surfaces, bodies and modules and make others operations are detailed in the next sections.\n\n### Surfaces\n\nThe method **surface** allows the creation of quadric surfaces (reduced form by default) according to the next formatted text lines for the reduced form and implicit form respectively.\n\nReduced form:\n```\n0000000000000000000000000000000000000000000000000000000000000000\nSURFACE ( A4) comment: reduced form\nINDICES=(I2,I2,I2,I2,I2)\nX-SCALE=( E22.15 , I4) (DEFAULT=1.0)\nY-SCALE=( E22.15 , I4) (DEFAULT=1.0)\nZ-SCALE=( E22.15 , I4) (DEFAULT=1.0)\n OMEGA=( E22.15 , I4) DEG (DEFAULT=0.0)\n THETA=( E22.15 , I4) DEG (DEFAULT=0.0)\n PHI=( E22.15 , I4) DEG (DEFAULT=0.0)\nX-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nY-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nZ-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\n```\n\nImplicit form:\n```\n0000000000000000000000000000000000000000000000000000000000000000\nSURFACE ( A4) comment: implicit form\nINDICES=( 0, 0, 0, 0, 0)\n AXX=( E22.15 , I4) (DEFAULT=0.0)\n AXY=( E22.15 , I4) (DEFAULT=0.0)\n AXZ=( E22.15 , I4) (DEFAULT=0.0)\n AYY=( E22.15 , I4) (DEFAULT=0.0)\n AYZ=( E22.15 , I4) (DEFAULT=0.0)\n AZZ=( E22.15 , I4) (DEFAULT=0.0)\n AX=( E22.15 , I4) (DEFAULT=0.0)\n AY=( E22.15 , I4) (DEFAULT=0.0)\n AZ=( E22.15 , I4) (DEFAULT=0.0)\n A0=( E22.15 , I4) (DEFAULT=0.0)\n1111111111111111111111111111111111111111111111111111111111111111\n OMEGA=( E22.15 , I4) DEG (DEFAULT=0.0)\n THETA=( E22.15 , I4) DEG (DEFAULT=0.0)\n PHI=( E22.15 , I4) DEG (DEFAULT=0.0)\nX-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nY-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nZ-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\n```\n\nMethod and arguments:\n\n```python\nsurface(label=None, indices=(1,1,1,1,1), scale=(1,1,1), \n rotation=(0,0,0), translation=(0,0,0), starred=False, comment=\"\", **kwargs)\n```\n\n* label (string): user label of the element (maximum 4 characters). This parameter is optional. If the user doesn\u00e2\u20ac\u2122t set it, an internal state machine assigns an unique 4-character value in the range XAAA to ZZZZ. An element without explicit label can be reference only through its instance\n* indices (tuple): coefficients for the reduced form of the surface representation (I1, I2, I3, I4, I5)\n* scale (tuple): scale factors for the X, Y and Z axes (X-SCALE, Y-SCALE, Z-SCALE) \n* rotation (tuple): rotation values defined through the Euler angles (OMEGA, THETA, PHI)\n* translation (tuple): translation values for the X, Y and Z axes (X-SHIFT, Y-SHIFT, Z-SHIFT) \n* starred (boolean): if True its allow to define fixed surfaces, which will not be affected by possible translations or rotations in subsequent stages of the geometry definition\n* comment (string): short text description\n* **return value:** instance of the current Surface object \n\n> Also, we can use the assignment of a single parameter for specify the value of one compressed item in the tuples referred to the scaling, rotation and translation. The single parameters are: xscale (X-SCALE), yscale (Y-SCALE), zscale (Z-SCALE), omega (OMEGA), theta (THETA), phi (PHI), xshift (X-SHIFT), yshift (Y-SHIFT) and zshift (Z-SHIFT). In that case, the value of the single parameter overwrites the value of its respective item in the tuple, when both parameters are present.\n\nCustom surfaces:\n\nFor grant an easy, agile and fast construction of the geometry definitions of a material system the class GeometryDefinition includes several methods that map custom and predefined reduced quadric surfaces. These surfaces are defined in the next table, with its coefficients and its method names respectively. All methods are reimplementation of the generic **surface** method, they just set the value of the coefficients (indices) according to the representation.\n\nSurface | Coefficients | Method of the class (API)\n--------------------- | ---------------- | -----------------------------\nPlane | ( 0, 0, 0, 1, 0) | surface_plane\nSphere | ( 1, 1, 1, 0,-1) | surface_sphere\nCylinder | ( 1, 1, 0, 0,-1) | surface_cylinder\nHyperbolic cylinder | ( 1,-1, 0, 0,-1) | surface_hyperbolic_cylinder\nCone | ( 1, 1,-1, 0, 0) | surface_cone\nOne sheet hyperboloid | ( 1, 1,-1, 0,-1) | surface_one_sheet_hyperboloid\nTwo sheet hyperboloid | ( 1, 1,-1, 0, 1) | surface_two_sheet_hyperboloid\nParaboloid | ( 1, 1, 0,-1, 0) | surface_paraboloid\nParabolic cylinder | ( 1, 0, 0,-1, 0) | surface_parabolic_cylinder\nHyperbolic paraboloid | ( 1,-1, 0,-1, 0) | surface_hyperbolic_paraboloid\n\nSurfaces in implicit form:\n\nWe can use the method **surface** for create surfaces in implicit form setting all items of the tuple of the coefficients (indices) to zero. However, the method **surface_implicit_form** do this for us. There is a set of single parameters for specify the geometry of this surface: AXX, AXY, AXZ, AYY, AYZ, AZZ, AX, AY, AZ, A0 according to the model. We can set the useful values for our implementation; the others take as default value zero. For this implementation, the values of the scale are ignored in anyone of this representation (tuple or single parameter).\n\n### Body\n\nThe method **body** allows the creation of homogeneous bodies limited by quadric surfaces according to the next formatted text lines:\n\n```\n0000000000000000000000000000000000000000000000000000000000000000\nBODY ( A4) comment\nMATERIAL( A4)\nSURFACE ( A4), SIDE POINTER=(I2)\nBODY ( A4)\nMODULE ( A4)\n```\n\nMethod and arguments:\n\n```python\nbody(label=None, material=0, surfaces=[], bodies=[], modules=[], comment=\"\")\n```\n* label (string): user label of the element (maximum 4 characters). This parameter is optional. If the user doesn\u00e2\u20ac\u2122t set it, an internal state machine assigns an unique 4-character value in the range XAAA to ZZZZ. An element without explicit label can be reference only through its instance\n* material (string or integer): number of the material identification conform with the convention adopted in the simulation\n* surfaces (list of tuples): boundary surfaces of the current body. Each tuple contains the label (string) or the instance (surface object) of the boundary surface and its surface side pointer (integer: 1 or -1)\n* bodies (list of string or body objects): boundary bodies of the current body\n* modules (list of string or module objects): boundary modules of the current body\n* comment (string): short text description\n* **return value:** instance of the current Body object \n\n### Module\n\nThe method **module** allows the creation of modules according to the next formatted text lines:\n\n```\n0000000000000000000000000000000000000000000000000000000000000000\nMODULE ( A4) comment\nMATERIAL( A4)\nSURFACE ( A4), SIDE POINTER=(I2)\nBODY ( A4)\nMODULE ( A4)\n1111111111111111111111111111111111111111111111111111111111111111\n OMEGA=( E22.15 , I4) DEG (DEFAULT=0.0)\n THETA=( E22.15 , I4) DEG (DEFAULT=0.0)\n PHI=( E22.15 , I4) DEG (DEFAULT=0.0)\nX-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nY-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nZ-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\n```\n\nMethod and arguments:\n\n```python\nmodule(label=None, material=0, surfaces=[], bodies=[], modules=[], \n rotation=(0,0,0), translation=(0,0,0), comment=\"\", **kwargs)\n```\n* label (string): user label of the element (maximum 4 characters). This parameter is optional. If the user doesn\u00e2\u20ac\u2122t set it, an internal state machine assigns an unique 4-character value in the range XAAA to ZZZZ. An element without explicit label can be reference only through its instance\n* material (string or integer): number of the material identification conform with the convention adopted in the simulation\n* surfaces (list of tuples): boundary surfaces of the current module. Each tuple contains the label (string) or the instance (surface object) of the boundary surface and its surface side pointer (integer: 1 or -1)\n* bodies (list of string or body objects): boundary bodies of the current module\n* modules (list of string or module objects): boundary modules of the current module\n* rotation (tuple): rotation values defined through the Euler angles (OMEGA, THETA, PHI)\n* translation (tuple): translation values for the X, Y and Z axes (X-SHIFT, Y-SHIFT, Z-SHIFT) \n* comment (string): short text description\n* **return value:** instance of the current Module object \n\n> Like the surfaces, we can use the assignment of a single parameter for specify the value of one compressed item in the tuples referred to the rotation and translation. The single parameters are: omega (OMEGA), theta (THETA), phi (PHI), xshift (X-SHIFT), yshift (Y-SHIFT) and zshift (Z-SHIFT). In that case, the value of the single parameter overwrites the value of its respective component in the tuple, when both parameters are present. \n\n### Clone\n\nThe method **clone** allows the clonation of modules (bodies cannot be cloned; to clone a body that is limited only by surfaces, define it as a module) according to the next formatted text lines:\n\n```\n0000000000000000000000000000000000000000000000000000000000000000\nCLONE ( A4) copies one module and moves it\nMODULE ( A4) original module\n1111111111111111111111111111111111111111111111111111111111111111\n OMEGA=( E22.15 , I4) DEG (DEFAULT=0.0)\n THETA=( E22.15 , I4) DEG (DEFAULT=0.0)\n PHI=( E22.15 , I4) DEG (DEFAULT=0.0)\nX-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nY-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\nZ-SHIFT=( E22.15 , I4) (DEFAULT=0.0)\n```\n\nMethod and arguments:\n\n```python\nclone(label=None, module=\"\", rotation=(0,0,0), translation=(0,0,0), comment=\"\", **kwargs)\n```\n* label (string): user label of the element (maximum 4 characters). This parameter is optional. If the user doesn\u00e2\u20ac\u2122t set it, an internal state machine assigns an unique 4-character value in the range XAAA to ZZZZ. An element without explicit label can be reference only through its instance\n* module (string or module object): label or instance of the module to be cloned\n* rotation (tuple): rotation values defined through the Euler angles (OMEGA, THETA, PHI)\n* translation (tuple): translation values for the X, Y and Z axes (X-SHIFT, Y-SHIFT, Z-SHIFT) \n* comment (string): short text description\n* **return value:** instance of the current Clone object \n\n> Like the surfaces and equal to modules, we can use the assignment of a single parameter for specify the value of one compressed item in the tuples referred to the rotation and translation. The single parameters are: omega (OMEGA), theta (THETA), phi (PHI), xshift (X-SHIFT), yshift (Y-SHIFT) and zshift (Z-SHIFT). In that case, the value of the single parameter overwrites the value of its respective component in the tuple, when both parameters are present. \n\n### Include\n\nThe method **include** allows the insertion of other geometry definition files according to the next formatted text lines:\n\n```\n0000000000000000000000000000000000000000000000000000000000000000\nINCLUDE comment\n FILE=(filename.ext)\n```\n\nMethod and arguments:\n\n```python\nfile(filename, starred=False, comment=\"\")\n```\n* filename (string): absolute or relative path of the geometry definition file to be included\n* starred (boolean): if True its allow the included file to be considered as if it were part of the main file\n* comment (string): short text description\n* **return value:** instance of the current Include object \n\n### End\n\nThe method **end** cancel the reading of geometry data for the PENELOPE PENGEOM application (if this method is called in the middle of a geometry definition of some material system, all elements after this call are ignored for the application). By default this generator includes this element at the end of the geometry definition, then, its call is not mandatory.\n\n```\n0000000000000000000000000000000000000000000000000000000000000000\nEND 0000000000000000000000000000000000000000000000000000000\n```\n\nMethod and arguments:\n\n```python\nend()\n```\n* **return value:** instance of the current End object \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/Toni-SM/pengeomgen", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pengeomgen", "package_url": "https://pypi.org/project/pengeomgen/", "platform": "", "project_url": "https://pypi.org/project/pengeomgen/", "project_urls": { "Homepage": "https://github.com/Toni-SM/pengeomgen" }, "release_url": "https://pypi.org/project/pengeomgen/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "An easy geometry-definition file generator for PENELOPE PENGEOM", "version": "0.0.2" }, "last_serial": 5661024, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "c6b2ce6b2415073ca51c1254739c80a9", "sha256": "43426741d366883b748440bd3308c3feb57530f7a98105343f8b5edfc2978f7c" }, "downloads": -1, "filename": "pengeomgen-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c6b2ce6b2415073ca51c1254739c80a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7916, "upload_time": "2019-07-20T19:36:01", "url": "https://files.pythonhosted.org/packages/c0/8b/b38a7840774d9b8cf6b2db50de05ce69d5f30b3d3a5b21faaaa4bfa49463/pengeomgen-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9fc67ab78056d4996fa0c030a6174f4c", "sha256": "7e8d5a52ba5ff75b31ff1caeaa589f32e77b363328b645ac525d2ae81f7386df" }, "downloads": -1, "filename": "pengeomgen-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9fc67ab78056d4996fa0c030a6174f4c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11326, "upload_time": "2019-07-20T19:36:16", "url": "https://files.pythonhosted.org/packages/cb/a9/f2b3542995c3244138f7f7a80f98bfeb708134d932e4abe9ac09ed300967/pengeomgen-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f27a20047fd3671f386f48d8cc1511a3", "sha256": "086b00b0fd56dde15cfda7b850b9b6b9bfaa84e29e9ed987e6517d9d53e046e0" }, "downloads": -1, "filename": "pengeomgen-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f27a20047fd3671f386f48d8cc1511a3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13038, "upload_time": "2019-08-11T05:16:55", "url": "https://files.pythonhosted.org/packages/78/64/79524db9d27e72a1c0df452fb8c2b1827ec903f1fd66a79e839876ffb780/pengeomgen-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3c89203bae422698ab5382700c5185b6", "sha256": "595ede54df4dd2cb467447fed6e68b0e7fb89f5e77efb40db93f9e7690d7894e" }, "downloads": -1, "filename": "pengeomgen-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3c89203bae422698ab5382700c5185b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14123, "upload_time": "2019-08-11T05:17:20", "url": "https://files.pythonhosted.org/packages/53/e8/672258915e40e48f3cfd796c7a34613b2d0722c30920a53563ffe31b97d9/pengeomgen-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f27a20047fd3671f386f48d8cc1511a3", "sha256": "086b00b0fd56dde15cfda7b850b9b6b9bfaa84e29e9ed987e6517d9d53e046e0" }, "downloads": -1, "filename": "pengeomgen-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f27a20047fd3671f386f48d8cc1511a3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13038, "upload_time": "2019-08-11T05:16:55", "url": "https://files.pythonhosted.org/packages/78/64/79524db9d27e72a1c0df452fb8c2b1827ec903f1fd66a79e839876ffb780/pengeomgen-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3c89203bae422698ab5382700c5185b6", "sha256": "595ede54df4dd2cb467447fed6e68b0e7fb89f5e77efb40db93f9e7690d7894e" }, "downloads": -1, "filename": "pengeomgen-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3c89203bae422698ab5382700c5185b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14123, "upload_time": "2019-08-11T05:17:20", "url": "https://files.pythonhosted.org/packages/53/e8/672258915e40e48f3cfd796c7a34613b2d0722c30920a53563ffe31b97d9/pengeomgen-0.0.2.tar.gz" } ] }