{ "cells": [ { "cell_type": "markdown", "id": "ced3ba2b", "metadata": {}, "source": [ "# graviton" ] }, { "cell_type": "code", "execution_count": 1, "id": "529a5d72", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pyx:\n" ] }, { "ename": "AttributeError", "evalue": "'path' object has no attribute 'curveradius'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[1], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyfeyn2\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrender\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mall\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AllRender\n\u001b[0;32m----> 2\u001b[0m ar \u001b[38;5;241m=\u001b[39m \u001b[43mAllRender\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdemo_propagator\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mgraviton\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/render.py:56\u001b[0m, in \u001b[0;36mRender.demo_propagator\u001b[0;34m(self, d, show)\u001b[0m\n\u001b[1;32m 54\u001b[0m fd\u001b[38;5;241m.\u001b[39mlegs\u001b[38;5;241m.\u001b[39mextend([l1, l2])\n\u001b[1;32m 55\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_feynman_diagram(fd)\n\u001b[0;32m---> 56\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrender\u001b[49m\u001b[43m(\u001b[49m\u001b[43mshow\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mshow\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/all.py:63\u001b[0m, in \u001b[0;36mAllRender.render\u001b[0;34m(self, file, show, subfigure, resolution, width, height)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m subfigure:\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPyx:\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 63\u001b[0m \u001b[43mPyxRender\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfd\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrender\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdirpath\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/pyx.pdf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mdynarg\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 64\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m subfigure:\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mTikz:\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/pyx/pyxrender.py:50\u001b[0m, in \u001b[0;36mPyxRender.render\u001b[0;34m(self, file, show, resolution, width, height)\u001b[0m\n\u001b[1;32m 48\u001b[0m nl \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mapply_layout(v\u001b[38;5;241m.\u001b[39mstyle, nl)\n\u001b[1;32m 49\u001b[0m nl \u001b[38;5;241m=\u001b[39m nl\u001b[38;5;241m.\u001b[39maddLabel(l\u001b[38;5;241m.\u001b[39mlabel)\n\u001b[0;32m---> 50\u001b[0m \u001b[43mpyxfd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 51\u001b[0m wi \u001b[38;5;241m=\u001b[39m WImage(filename\u001b[38;5;241m=\u001b[39mfile, resolution\u001b[38;5;241m=\u001b[39mresolution, width\u001b[38;5;241m=\u001b[39mwidth, height\u001b[38;5;241m=\u001b[39mheight)\n\u001b[1;32m 52\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m show:\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/pyx/diagrams.py:74\u001b[0m, in \u001b[0;36mFeynDiagram.draw\u001b[0;34m(self, outfile, enlargement)\u001b[0m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdraw\u001b[39m(\u001b[38;5;28mself\u001b[39m, outfile, enlargement\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m):\n\u001b[1;32m 72\u001b[0m \u001b[38;5;124;03m\"\"\"Draw the diagram to a file, with the filetype (EPS or PDF)\u001b[39;00m\n\u001b[1;32m 73\u001b[0m \u001b[38;5;124;03m derived from the file extension.\"\"\"\u001b[39;00m\n\u001b[0;32m---> 74\u001b[0m c \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdrawToCanvas\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m c \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m outfile \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 76\u001b[0m c\u001b[38;5;241m.\u001b[39mwritetofile(outfile, page_bbox\u001b[38;5;241m=\u001b[39mc\u001b[38;5;241m.\u001b[39mbbox()\u001b[38;5;241m.\u001b[39menlarged(enlargement))\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/pyx/diagrams.py:67\u001b[0m, in \u001b[0;36mFeynDiagram.drawToCanvas\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m config\u001b[38;5;241m.\u001b[39mgetOptions()\u001b[38;5;241m.\u001b[39mDEBUG:\n\u001b[1;32m 66\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDepth = \u001b[39m\u001b[38;5;124m\"\u001b[39m, obj\u001b[38;5;241m.\u001b[39mgetDepth())\n\u001b[0;32m---> 67\u001b[0m \u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcurrentCanvas\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 69\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcurrentCanvas\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/pyx/lines.py:741\u001b[0m, in \u001b[0;36mGraviton.draw\u001b[0;34m(self, canvas)\u001b[0m\n\u001b[1;32m 739\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m config\u001b[38;5;241m.\u001b[39mgetOptions()\u001b[38;5;241m.\u001b[39mDEBUG:\n\u001b[1;32m 740\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDrawing \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m with styles = \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mstr\u001b[39m(styles))\n\u001b[0;32m--> 741\u001b[0m mypath1 \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetDeformedPath\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 742\u001b[0m mypath2 \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgetDeformedPath(\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m)\n\u001b[1;32m 743\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39minverted:\n", "File \u001b[0;32m~/data/de.neuwirthinformatik.Alexander/Development/git/pyfeyn2/pyfeyn2/render/pyx/lines.py:701\u001b[0m, in \u001b[0;36mGraviton.getDeformedPath\u001b[0;34m(self, sign)\u001b[0m\n\u001b[1;32m 694\u001b[0m intwindings \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mint\u001b[39m(\n\u001b[1;32m 695\u001b[0m \u001b[38;5;241m0.6\u001b[39m\n\u001b[1;32m 696\u001b[0m \u001b[38;5;241m*\u001b[39m pyx\u001b[38;5;241m.\u001b[39munit\u001b[38;5;241m.\u001b[39mtocm(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgetVisiblePath()\u001b[38;5;241m.\u001b[39marclen())\n\u001b[1;32m 697\u001b[0m \u001b[38;5;241m/\u001b[39m pyx\u001b[38;5;241m.\u001b[39munit\u001b[38;5;241m.\u001b[39mtocm(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39marcradius)\n\u001b[1;32m 698\u001b[0m )\n\u001b[1;32m 700\u001b[0m vispath \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgetVisiblePath()\n\u001b[0;32m--> 701\u001b[0m curveradii \u001b[38;5;241m=\u001b[39m \u001b[43mvispath\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcurveradius\u001b[49m([i \u001b[38;5;241m/\u001b[39m \u001b[38;5;241m10.0\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m11\u001b[39m)])\n\u001b[1;32m 702\u001b[0m mincurveradius \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 703\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m curveradius \u001b[38;5;129;01min\u001b[39;00m curveradii:\n", "\u001b[0;31mAttributeError\u001b[0m: 'path' object has no attribute 'curveradius'" ] } ], "source": [ "from pyfeyn2.render.all import AllRender\n", "ar = AllRender().demo_propagator(\"graviton\")" ] }, { "cell_type": "code", "execution_count": null, "id": "35c183c6", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.16 64-bit", "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.9.16" }, "vscode": { "interpreter": { "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" } } }, "nbformat": 4, "nbformat_minor": 5 }