{ "cells": [ { "cell_type": "markdown", "id": "ffb4504d-271b-49ff-aae7-2e17b4028445", "metadata": {}, "source": [ "# Analyzer" ] }, { "cell_type": "code", "execution_count": 1, "id": "2e7e4ea5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[3.74939946e-33+0.j 6.12323400e-17+0.j]\n", " [6.12323400e-17+0.j 1.00000000e+00+0.j]]\n" ] } ], "source": [ "import nexus as nx\n", "import numpy as np\n", "\n", "# set beam along pi polarization via initialization parameters\n", "# those values are the default arguments\n", "analyzer = nx.Analyzer(efficiency = 1, mixing_angle = 0, canting_angle = 90)\n", "\n", "print(analyzer.matrix)" ] }, { "cell_type": "code", "execution_count": 2, "id": "7ff0a071", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[0.5+0.j 0. -0.5j]\n", " [0. +0.5j 0.5+0.j ]]\n" ] } ], "source": [ "analyzer = nx.Analyzer()\n", "analyzer.CircularLeft()\n", "\n", "print(analyzer.matrix)" ] }, { "cell_type": "code", "execution_count": 3, "id": "455da296", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-------------------------------------------------------------------------------------------\n", " NEXUS WARNING in Analyzer\n", " warning: removed in version 2.0.0\n", "-------------------------------------------------------------------------------------------\n", "[[0.5+0.j 0. -0.5j]\n", " [0. +0.5j 0.5+0.j ]]\n" ] } ], "source": [ "# will not work starting from verison 2\n", "analyzer.SetJonesMatrix(np.array([[1,0], [0,1]], dtype=complex))\n", "print(analyzer.matrix)" ] }, { "cell_type": "code", "execution_count": 4, "id": "5cb0c3f9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[0.5+0.j 0. -0.5j]\n", " [0. +0.5j 0.5+0.j ]]\n" ] } ], "source": [ "print(analyzer.ElectronicAmplitudeMatrix(0))" ] }, { "cell_type": "code", "execution_count": 5, "id": "7429c530", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-------------------------------------------------------------------------------------------\n", " NEXUS WARNING in Analyzer\n", " warning: removed in version 2.0.0\n", "-------------------------------------------------------------------------------------------\n", "[[0.5+0.j 0. -0.5j]\n", " [0. +0.5j 0.5+0.j ]]\n" ] } ], "source": [ "# will not work starting from verison 2\n", "analyzer.SetJonesMatrix(np.array([[1,0], [0,0]], dtype=complex))\n", "print(analyzer.matrix)" ] }, { "cell_type": "code", "execution_count": 6, "id": "1b8ddd96", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-------------------------------------------------------------------------------------------\n", " NEXUS WARNING in Analyzer\n", " warning: removed in version 2.0.0\n", "-------------------------------------------------------------------------------------------\n", "Analyzer\n", " .id: \n", " .efficiency: Var.value = 1.0, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " .mixing_angle: Var.value = 45.0, .min = -45.0, .max = 45.0, .fit: False, .id: \n", " .canting_angle: Var.value = 0.0, .min = -90.0, .max = 90.0, .fit: False, .id: \n", " .matrix:\n", "[[0.5+0.j 0. -0.5j]\n", " [0. +0.5j 0.5+0.j ]]\n", "\n" ] } ], "source": [ "# will not work starting from verison 2\n", "analyzer.Rotate(45)\n", "print(analyzer)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.9" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }