diff --git a/_website/tutorials/introduction/upgrade_guide_020.ipynb b/_website/tutorials/introduction/upgrade_guide_020.ipynb index 5a1b103..740419d 100644 --- a/_website/tutorials/introduction/upgrade_guide_020.ipynb +++ b/_website/tutorials/introduction/upgrade_guide_020.ipynb @@ -24,6 +24,7 @@ "# standard imports\n", "import zfit\n", "import zfit.z.numpy as znp # use this \"numpy-like\" for mathematical operations\n", + "import zfit_physics as zphys # physics module, with new physics-inspired PDFs\n", "from zfit import z" ] }, @@ -35,6 +36,8 @@ "outputs": [], "source": [ "# example usage of the numpy-like backend, use it if possible\n", + "\n", + "\n", "@z.function\n", "def maximum(x, y):\n", " return znp.maximum(x, y)\n", @@ -133,7 +136,7 @@ "outputs": [], "source": [ "# this allows, for example, for a more intuitive way\n", - "np.linspace(*obs12.v1.limits, 7)" + "np.linspace(*obs12.v1.limits, num=7)" ] }, { @@ -205,7 +208,7 @@ "source": [ "## PDFs\n", "\n", - "- there are a plethora of new PDFs, mostly covering physics inspired use-cases. Amongst the interesting ones are a `GeneralizedCB`, a more general version of the `DoubleCB` that should be preferred in the future. Also a Voigt profile is available, Bernstein polynomials, QGauss, GaussExpTail, etc.\n", + "- there are a plethora of new PDFs, mostly covering physics inspired use-cases. Amongst the interesting ones are a `GeneralizedCB`, a more general version of the `DoubleCB` that should be preferred in the future. A Voigt profile is available, Bernstein polynomials, QGauss, GaussExpTail, etc. and in [zfit-physics](https://zfit.readthedocs.io/en/latest/user_api/zfit.pdf.html#physics-pdfs) HEP specific PDFS , from `CMSShape`, `Cruijff`, `Novosibirsk` and more. \n", "- the `TruncatedPDF` has been added to allow for a more flexible way of truncating a PDF. Any PDF can be converted to a truncated version using `to_truncated` (which, by default, truncates to the limits of the space).\n", "- PDFs have a new `plot` method that allows for a quick plotting of the PDF (it takes an \"obs\" argument that allows to simply project it!). This is still experimental and may changes, the main purpose is to allow for a quick check of the PDF in interactive environments. The function is fully compatible with matplotlib and takes an `ax` argument, it also allows to pass through any keyword arguments to the plotting function." ] @@ -217,7 +220,8 @@ "metadata": {}, "outputs": [], "source": [ - "# all the new PDFs" + "# all the new PDFs\n", + "print(zfit.pdf.__all__)" ] }, { @@ -226,6 +230,16 @@ "id": "18", "metadata": {}, "outputs": [], + "source": [ + "print(zphys.pdf.__all__)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19", + "metadata": {}, + "outputs": [], "source": [ "# create a PDF\n", "pdf = zfit.pdf.Gauss(\n", @@ -240,7 +254,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -251,7 +265,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -261,7 +275,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "22", "metadata": {}, "source": [ "## Loss and minimizer\n", @@ -281,7 +295,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -294,7 +308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -304,7 +318,7 @@ }, { "cell_type": "markdown", - "id": "24", + "id": "25", "metadata": {}, "source": [ "## Result\n", @@ -317,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -330,7 +344,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -341,7 +355,7 @@ }, { "cell_type": "markdown", - "id": "27", + "id": "28", "metadata": {}, "source": [ "## Serialization\n", @@ -357,7 +371,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -368,7 +382,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29", + "id": "30", "metadata": {}, "outputs": [], "source": [ @@ -380,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "30", + "id": "31", "metadata": {}, "source": [ "## Parameters as arguments\n", @@ -393,7 +407,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31", + "id": "32", "metadata": {}, "outputs": [], "source": [ @@ -408,7 +422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32", + "id": "33", "metadata": {}, "outputs": [], "source": [ @@ -431,7 +445,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -444,11 +458,13 @@ { "cell_type": "code", "execution_count": null, - "id": "34", + "id": "35", "metadata": {}, "outputs": [], "source": [ "# creating a PDF looks also different, but here we use the name of the parametrization and the axis (integers)\n", + "\n", + "\n", "class MyGauss2D(zfit.pdf.ZPDF):\n", " _PARAMS = (\"mu\", \"sigma\")\n", " _N_OBS = 2\n", @@ -465,7 +481,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35", + "id": "36", "metadata": {}, "outputs": [], "source": [ @@ -476,7 +492,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36", + "id": "37", "metadata": {}, "outputs": [], "source": [] diff --git a/introduction/upgrade_guide_020.ipynb b/introduction/upgrade_guide_020.ipynb index 5a1b103..740419d 100644 --- a/introduction/upgrade_guide_020.ipynb +++ b/introduction/upgrade_guide_020.ipynb @@ -24,6 +24,7 @@ "# standard imports\n", "import zfit\n", "import zfit.z.numpy as znp # use this \"numpy-like\" for mathematical operations\n", + "import zfit_physics as zphys # physics module, with new physics-inspired PDFs\n", "from zfit import z" ] }, @@ -35,6 +36,8 @@ "outputs": [], "source": [ "# example usage of the numpy-like backend, use it if possible\n", + "\n", + "\n", "@z.function\n", "def maximum(x, y):\n", " return znp.maximum(x, y)\n", @@ -133,7 +136,7 @@ "outputs": [], "source": [ "# this allows, for example, for a more intuitive way\n", - "np.linspace(*obs12.v1.limits, 7)" + "np.linspace(*obs12.v1.limits, num=7)" ] }, { @@ -205,7 +208,7 @@ "source": [ "## PDFs\n", "\n", - "- there are a plethora of new PDFs, mostly covering physics inspired use-cases. Amongst the interesting ones are a `GeneralizedCB`, a more general version of the `DoubleCB` that should be preferred in the future. Also a Voigt profile is available, Bernstein polynomials, QGauss, GaussExpTail, etc.\n", + "- there are a plethora of new PDFs, mostly covering physics inspired use-cases. Amongst the interesting ones are a `GeneralizedCB`, a more general version of the `DoubleCB` that should be preferred in the future. A Voigt profile is available, Bernstein polynomials, QGauss, GaussExpTail, etc. and in [zfit-physics](https://zfit.readthedocs.io/en/latest/user_api/zfit.pdf.html#physics-pdfs) HEP specific PDFS , from `CMSShape`, `Cruijff`, `Novosibirsk` and more. \n", "- the `TruncatedPDF` has been added to allow for a more flexible way of truncating a PDF. Any PDF can be converted to a truncated version using `to_truncated` (which, by default, truncates to the limits of the space).\n", "- PDFs have a new `plot` method that allows for a quick plotting of the PDF (it takes an \"obs\" argument that allows to simply project it!). This is still experimental and may changes, the main purpose is to allow for a quick check of the PDF in interactive environments. The function is fully compatible with matplotlib and takes an `ax` argument, it also allows to pass through any keyword arguments to the plotting function." ] @@ -217,7 +220,8 @@ "metadata": {}, "outputs": [], "source": [ - "# all the new PDFs" + "# all the new PDFs\n", + "print(zfit.pdf.__all__)" ] }, { @@ -226,6 +230,16 @@ "id": "18", "metadata": {}, "outputs": [], + "source": [ + "print(zphys.pdf.__all__)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "19", + "metadata": {}, + "outputs": [], "source": [ "# create a PDF\n", "pdf = zfit.pdf.Gauss(\n", @@ -240,7 +254,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -251,7 +265,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -261,7 +275,7 @@ }, { "cell_type": "markdown", - "id": "21", + "id": "22", "metadata": {}, "source": [ "## Loss and minimizer\n", @@ -281,7 +295,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -294,7 +308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -304,7 +318,7 @@ }, { "cell_type": "markdown", - "id": "24", + "id": "25", "metadata": {}, "source": [ "## Result\n", @@ -317,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -330,7 +344,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -341,7 +355,7 @@ }, { "cell_type": "markdown", - "id": "27", + "id": "28", "metadata": {}, "source": [ "## Serialization\n", @@ -357,7 +371,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -368,7 +382,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29", + "id": "30", "metadata": {}, "outputs": [], "source": [ @@ -380,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "30", + "id": "31", "metadata": {}, "source": [ "## Parameters as arguments\n", @@ -393,7 +407,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31", + "id": "32", "metadata": {}, "outputs": [], "source": [ @@ -408,7 +422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32", + "id": "33", "metadata": {}, "outputs": [], "source": [ @@ -431,7 +445,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -444,11 +458,13 @@ { "cell_type": "code", "execution_count": null, - "id": "34", + "id": "35", "metadata": {}, "outputs": [], "source": [ "# creating a PDF looks also different, but here we use the name of the parametrization and the axis (integers)\n", + "\n", + "\n", "class MyGauss2D(zfit.pdf.ZPDF):\n", " _PARAMS = (\"mu\", \"sigma\")\n", " _N_OBS = 2\n", @@ -465,7 +481,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35", + "id": "36", "metadata": {}, "outputs": [], "source": [ @@ -476,7 +492,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36", + "id": "37", "metadata": {}, "outputs": [], "source": []