diff --git a/docs/tutorials/00_amplitude_estimation.ipynb b/docs/tutorials/00_amplitude_estimation.ipynb index 5f1cd4f..c1124ae 100644 --- a/docs/tutorials/00_amplitude_estimation.ipynb +++ b/docs/tutorials/00_amplitude_estimation.ipynb @@ -323,7 +323,7 @@ "source": [ "ae_circuit = ae.construct_circuit(problem)\n", "ae_circuit.decompose().draw(\n", - " \"mpl\", style=\"iqx\"\n", + " \"mpl\", style=\"clifford\"\n", ") # decompose 1 level: exposes the Phase estimation circuit!" ] }, @@ -349,7 +349,7 @@ "\n", "\n", "basis_gates = [\"h\", \"ry\", \"cry\", \"cx\", \"ccx\", \"p\", \"cp\", \"x\", \"s\", \"sdg\", \"y\", \"t\", \"cz\"]\n", - "transpile(ae_circuit, basis_gates=basis_gates, optimization_level=2).draw(\"mpl\", style=\"iqx\")" + "transpile(ae_circuit, basis_gates=basis_gates, optimization_level=2).draw(\"mpl\", style=\"clifford\")" ] }, { @@ -413,7 +413,7 @@ ], "source": [ "iae_circuit = iae.construct_circuit(problem, k=3)\n", - "iae_circuit.draw(\"mpl\", style=\"iqx\")" + "iae_circuit.draw(\"mpl\", style=\"clifford\")" ] }, { @@ -531,7 +531,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" @@ -547,7 +547,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/docs/tutorials/01_portfolio_optimization.ipynb b/docs/tutorials/01_portfolio_optimization.ipynb index c038412..facac02 100644 --- a/docs/tutorials/01_portfolio_optimization.ipynb +++ b/docs/tutorials/01_portfolio_optimization.ipynb @@ -400,7 +400,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/02_portfolio_diversification.ipynb b/docs/tutorials/02_portfolio_diversification.ipynb index 04a590d..0fa929d 100644 --- a/docs/tutorials/02_portfolio_diversification.ipynb +++ b/docs/tutorials/02_portfolio_diversification.ipynb @@ -787,7 +787,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/03_european_call_option_pricing.ipynb b/docs/tutorials/03_european_call_option_pricing.ipynb index 8b37142..aeb46c4 100644 --- a/docs/tutorials/03_european_call_option_pricing.ipynb +++ b/docs/tutorials/03_european_call_option_pricing.ipynb @@ -739,7 +739,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/04_european_put_option_pricing.ipynb b/docs/tutorials/04_european_put_option_pricing.ipynb index 462e6a2..26a33a5 100644 --- a/docs/tutorials/04_european_put_option_pricing.ipynb +++ b/docs/tutorials/04_european_put_option_pricing.ipynb @@ -497,7 +497,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/05_bull_spread_pricing.ipynb b/docs/tutorials/05_bull_spread_pricing.ipynb index 195bc68..98b6d39 100644 --- a/docs/tutorials/05_bull_spread_pricing.ipynb +++ b/docs/tutorials/05_bull_spread_pricing.ipynb @@ -447,7 +447,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/06_basket_option_pricing.ipynb b/docs/tutorials/06_basket_option_pricing.ipynb index 8267751..2e71391 100644 --- a/docs/tutorials/06_basket_option_pricing.ipynb +++ b/docs/tutorials/06_basket_option_pricing.ipynb @@ -583,7 +583,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/07_asian_barrier_spread_pricing.ipynb b/docs/tutorials/07_asian_barrier_spread_pricing.ipynb index a25cc67..a0b38f2 100644 --- a/docs/tutorials/07_asian_barrier_spread_pricing.ipynb +++ b/docs/tutorials/07_asian_barrier_spread_pricing.ipynb @@ -688,7 +688,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/08_fixed_income_pricing.ipynb b/docs/tutorials/08_fixed_income_pricing.ipynb index f05b4ab..6cd051d 100644 --- a/docs/tutorials/08_fixed_income_pricing.ipynb +++ b/docs/tutorials/08_fixed_income_pricing.ipynb @@ -439,7 +439,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/09_credit_risk_analysis.ipynb b/docs/tutorials/09_credit_risk_analysis.ipynb index 9d71f1c..f917f76 100644 --- a/docs/tutorials/09_credit_risk_analysis.ipynb +++ b/docs/tutorials/09_credit_risk_analysis.ipynb @@ -1272,7 +1272,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/10_qgan_option_pricing.ipynb b/docs/tutorials/10_qgan_option_pricing.ipynb index e2b36af..4f6ff53 100644 --- a/docs/tutorials/10_qgan_option_pricing.ipynb +++ b/docs/tutorials/10_qgan_option_pricing.ipynb @@ -344,7 +344,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/11_time_series.ipynb b/docs/tutorials/11_time_series.ipynb index 62431a5..95d2d5a 100644 --- a/docs/tutorials/11_time_series.ipynb +++ b/docs/tutorials/11_time_series.ipynb @@ -536,7 +536,7 @@ } ], "source": [ - "import qiskit.tools.jupyter\n", + "import tutorial_magics\n", "\n", "%qiskit_version_table\n", "%qiskit_copyright" diff --git a/docs/tutorials/tutorial_magics.py b/docs/tutorials/tutorial_magics.py new file mode 100644 index 0000000..22d88bd --- /dev/null +++ b/docs/tutorials/tutorial_magics.py @@ -0,0 +1,96 @@ +# This code is part of a Qiskit project +# +# (C) Copyright IBM 2017, 2024 +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. +# pylint: disable=unused-argument + +"""A module for version and copyright magics.""" + +import datetime +import platform +import time +from sys import modules + +from IPython import get_ipython +from IPython.core.magic import line_magic, Magics, magics_class +from IPython.display import HTML, display + +import qiskit + + +@magics_class +class Copyright(Magics): + """A class of status magic functions.""" + + @line_magic + def qiskit_copyright(self, line="", cell=None): + """A Jupyter magic function return qiskit copyright""" + now = datetime.datetime.now() + + html = "
© Copyright IBM 2017, %s.
" % now.year + html += "This code is licensed under the Apache License, Version 2.0. You may
"
+ html += "obtain a copy of this license in the LICENSE.txt file in the root directory
"
+ html += "of this source tree or at http://www.apache.org/licenses/LICENSE-2.0."
+
+ html += "
Any modifications or derivative works of this code must retain this
"
+ html += "copyright notice, and modified files need to carry a notice indicating
"
+ html += "that they have been altered from the originals.
Software | Version |
---|---|
{name} | {version} |
System information | |
{name} | {version} |
%s |