-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Switches to furo theme (#47) - Updates examples to new style (#51, #67) - Adds new examples (#54, #55, #58) - Marks the documentation unstable (#72) Signed-off-by: John Pennycook <[email protected]>
- Loading branch information
Showing
160 changed files
with
20,378 additions
and
3,765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
_downloads/07075ea048bb69f84e56a96405892fba/plot_customized_navchart.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Customized Navigation Chart\n\nA customized navigation chart.\n\nIn this example, we show how to customize a navigation chart by increasing the\nnumber of axis ticks and by annotating one of the datapoints. Adjusting the\nnumber of axis ticks can improve a reader's ability to discern between two\nsimilar values, while annotations can be useful to draw attention to certain\npoints and/or provide some additional context.\n\nInstead of trying to expose all possible customization options as arguments to\n:py:func:`p3analysis.plot.navchart`, the function returns a\n:py:class:`p3analysis.plot.NavChart` object that provides direct access to library\ninternals. When using the :py:mod:`matplotlib` backend it is possible to\naccess the :py:class:`matplotlib.axes.Axes` that were used and subsequently\ncall any number of :py:mod:`matplotlib` functions. In our example, we can\nuse :py:meth:`matplotlib.axes.Axes.set_xticks` and\n:py:meth:`matplotlib.axes.Axes.set_yticks` to control the ticks, and can use\n:py:meth:`matplotlib.axes.Axes.annotate` for annotations.\n\n.. NOTE::\n :py:mod:`matplotlib` is currently the only backend supported by the P3\n Analysis Library, but this is subject to change.\n\n.. TIP::\n If you have any trouble customizing a navigation chart, or the\n :py:class:`~p3analysis.plot.backend.NavChart` object does not provide access to the\n internals you are looking for, then please [open an issue](https://github.com/intel/p3-analysis-library/issues/new/choose).\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Initialize synthetic data\n# (not shown, but available in script download)\n\n# Read performance portability and code divergence data into pandas DataFrame\npp = pd.DataFrame(pp_data)\ncd = pd.DataFrame(cd_data)\n\n# Generate a navigation chart with custom style options\nlegend = p3analysis.plot.Legend(loc=\"center left\", bbox_to_anchor=(1.0, 0.5))\nastyle = p3analysis.plot.ApplicationStyle(markers=[\"x\", \"*\", \"s\", \"o\", \"P\"])\nnavchart = p3analysis.plot.navchart(pp, cd, size=(5, 5), legend=legend, style=astyle)\n\n# Further customize the navigation chart using matplotlib\n# In this example, we add a label and adjust the ticks\nax = navchart.get_axes()\nax.annotate(\n \"Balances performance and code re-use.\",\n xy=(0.7, 0.7),\n xytext=(0.2, 0.55),\n arrowprops=dict(facecolor='black', shrink=0.05),\n)\nax.set_xticks([x * 0.1 for x in range(0, 11)])\nax.set_yticks([y * 0.1 for y in range(0, 11)])\n\nnavchart.save(\"customized-navchart.png\")" | ||
] | ||
} | ||
], | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Binary file modified
BIN
-36 Bytes
(100%)
_downloads/0c8f924ed3a2f732c6a73301834a9f3a/case-studies_python.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
_downloads/32adcc08533a44cfc53b5a4b6e78c2d3/plot_customized_navchart.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2023 Intel Corporation | ||
# SPDX-License-Identifier: 0BSD | ||
""" | ||
Customized Navigation Chart | ||
=========================== | ||
A customized navigation chart. | ||
In this example, we show how to customize a navigation chart by increasing the | ||
number of axis ticks and by annotating one of the datapoints. Adjusting the | ||
number of axis ticks can improve a reader's ability to discern between two | ||
similar values, while annotations can be useful to draw attention to certain | ||
points and/or provide some additional context. | ||
Instead of trying to expose all possible customization options as arguments to | ||
:py:func:`p3analysis.plot.navchart`, the function returns a | ||
:py:class:`p3analysis.plot.NavChart` object that provides direct access to library | ||
internals. When using the :py:mod:`matplotlib` backend it is possible to | ||
access the :py:class:`matplotlib.axes.Axes` that were used and subsequently | ||
call any number of :py:mod:`matplotlib` functions. In our example, we can | ||
use :py:meth:`matplotlib.axes.Axes.set_xticks` and | ||
:py:meth:`matplotlib.axes.Axes.set_yticks` to control the ticks, and can use | ||
:py:meth:`matplotlib.axes.Axes.annotate` for annotations. | ||
.. NOTE:: | ||
:py:mod:`matplotlib` is currently the only backend supported by the P3 | ||
Analysis Library, but this is subject to change. | ||
.. TIP:: | ||
If you have any trouble customizing a navigation chart, or the | ||
:py:class:`~p3analysis.plot.backend.NavChart` object does not provide access to the | ||
internals you are looking for, then please `open an issue | ||
<https://github.com/intel/p3-analysis-library/issues/new/choose>`_. | ||
""" | ||
|
||
# Initialize synthetic data | ||
# (not shown, but available in script download) | ||
# sphinx_gallery_start_ignore | ||
from collections import defaultdict | ||
|
||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
|
||
import p3analysis | ||
|
||
pp_data = defaultdict(list) | ||
cd_data = defaultdict(list) | ||
for data in [pp_data, cd_data]: | ||
data["problem"] += ["Synthetic"] * 5 | ||
data["application"] += [ | ||
"Unportable", | ||
"Ideal", | ||
"Per-Platform Source", | ||
"Portability Framework", | ||
"Specialized", | ||
] | ||
pp_data["app pp"] += [0, 1, 1, 0.5, 0.7] | ||
cd_data["divergence"] += [1, 0, 1, 0, 0.3] | ||
# sphinx_gallery_end_ignore | ||
|
||
# Read performance portability and code divergence data into pandas DataFrame | ||
pp = pd.DataFrame(pp_data) | ||
cd = pd.DataFrame(cd_data) | ||
|
||
# Generate a navigation chart with custom style options | ||
legend = p3analysis.plot.Legend(loc="center left", bbox_to_anchor=(1.0, 0.5)) | ||
astyle = p3analysis.plot.ApplicationStyle(markers=["x", "*", "s", "o", "P"]) | ||
navchart = p3analysis.plot.navchart(pp, cd, size=(5, 5), legend=legend, style=astyle) | ||
|
||
# Further customize the navigation chart using matplotlib | ||
# In this example, we add a label and adjust the ticks | ||
ax = navchart.get_axes() | ||
ax.annotate( | ||
"Balances performance and code re-use.", | ||
xy=(0.7, 0.7), | ||
xytext=(0.2, 0.55), | ||
arrowprops=dict(facecolor='black', shrink=0.05), | ||
) | ||
ax.set_xticks([x * 0.1 for x in range(0, 11)]) | ||
ax.set_yticks([y * 0.1 for y in range(0, 11)]) | ||
|
||
navchart.save("customized-navchart.png") |
Binary file added
BIN
+8.13 KB
_downloads/33ebb1e5f3c0c327518929e0081f5a18/plot_babelstream_cascade.zip
Binary file not shown.
43 changes: 43 additions & 0 deletions
43
_downloads/36eb5c73460de2b4f5af873867d4d962/plot_customized_cascade.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Customized Cascade\n\nA customized cascade plot.\n\nIn this example, we show how to customize a cascade plot by changing the limits\nof the y-axis. Although the default limit (of 1) is useful for comparing many\nplots side-by-side, in practice it is often useful to be able to zoom-in on\nspecific regions of data. For example, when dealing with applications that do\nnot achieve very high levels of architectural efficiency, setting a lower\nmaximum value for the y-axis can improve readability.\n\nInstead of trying to expose all possible customization options as arguments to\n:py:func:`p3analysis.plot.cascade`, the function returns a\n:py:class:`p3analysis.plot.CascadePlot` object that provides direct access to library\ninternals. When using the :py:mod:`matplotlib` backend it is possible to\naccess the :py:class:`matplotlib.axes.Axes` that were used and subsequently\ncall any number of :py:mod:`matplotlib` functions. In our example, we can\nuse :py:meth:`matplotlib.axes.Axes.set_ylim` to update the y-axis.\n\n.. NOTE::\n :py:mod:`matplotlib` is currently the only backend supported by the P3\n Analysis Library, but this is subject to change.\n\n.. TIP::\n If you have any trouble customizing a plot, or the\n :py:class:`~p3analysis.plot.backend.CascadePlot` object does not provide access to\n the internals you are looking for, then please [open an issue](https://github.com/intel/p3-analysis-library/issues/new/choose).\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Initialize synthetic performance efficiency data\n# (not shown, but available in script download)\n\n# Read performance efficiency data into pandas DataFrame\ndf = pd.DataFrame(data)\n\n# Generate a cascade plot with custom style options\nlegend = p3analysis.plot.Legend(loc=\"center left\", bbox_to_anchor=(0.91, 0.225), ncols=2)\npstyle = p3analysis.plot.PlatformStyle(colors=\"GnBu\")\nastyle = p3analysis.plot.ApplicationStyle(markers=[\"x\", \"s\", \"p\", \"h\", \"H\", \"v\"])\ncascade = p3analysis.plot.cascade(df, size=(6, 5), platform_legend=legend, platform_style=pstyle, application_style=astyle)\n\n# Further customize the cascade plot using matplotlib\n# In this example, we adjust the range of the y-axis to improve readability\n# This may be necessary for studies using architectural efficiency\ncascade.get_axes(\"eff\").set_ylim([0, 0.12])\ncascade.get_axes(\"pp\").set_ylim([0, 0.12])\n\ncascade.save(\"customized-cascade.png\")" | ||
] | ||
} | ||
], | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Binary file added
BIN
+20.8 KB
_downloads/3e6eedd9c8ee0dac2f8e11671ca04b72/application_efficiency.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.