{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "52e2c3bc",
"metadata": {
"execution": {
"iopub.execute_input": "2025-05-15T10:09:52.721902Z",
"iopub.status.busy": "2025-05-15T10:09:52.721691Z",
"iopub.status.idle": "2025-05-15T10:09:55.956600Z",
"shell.execute_reply": "2025-05-15T10:09:55.955745Z"
}
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import finesse\n",
"finesse.configure(plotting=True)\n",
"\n",
"kat = finesse.Model()\n",
"kat.parse(\n",
"\"\"\"\n",
" l l1 P=1-bs1.T\n",
" s s1 l1.p1 bs1.p4 L=1\n",
" sq sq1 db=10\n",
" s s2 sq1.p1 bs1.p1\n",
" bs bs1 R=0.999 L=0 alpha=45\n",
"\n",
" # Set a signal frequency to activate the signal simulation\n",
" # (needed for squeezing effects to be observed)\n",
" fsig(1)\n",
"\n",
" # Output the pure shot noise along with the qnoised detector\n",
" # measuring the effects of the squeezing\n",
" qnoised sqzd_noise bs1.p2.o\n",
" qshot shot_noise bs1.p2.o\n",
"\"\"\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "12cc2efb",
"metadata": {
"execution": {
"iopub.execute_input": "2025-05-15T10:09:55.960123Z",
"iopub.status.busy": "2025-05-15T10:09:55.959328Z",
"iopub.status.idle": "2025-05-15T10:09:57.058453Z",
"shell.execute_reply": "2025-05-15T10:09:57.057721Z"
}
},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {
"filenames": {
"image/svg+xml": "/builds/ifosim/finesse/finesse3/docs/build/jupyter_execute/examples/07_homodyne_1_0.svg"
}
},
"output_type": "display_data"
}
],
"source": [
"out = kat.run(\"xaxis(l1.phase, lin, -90, 90, 360)\")\n",
"out.plot(separate=False);"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e97d43c1",
"metadata": {
"execution": {
"iopub.execute_input": "2025-05-15T10:09:57.066285Z",
"iopub.status.busy": "2025-05-15T10:09:57.060532Z",
"iopub.status.idle": "2025-05-15T10:09:57.881739Z",
"shell.execute_reply": "2025-05-15T10:09:57.876540Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 0, 'LO Phase [deg]')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {
"filenames": {
"image/svg+xml": "/builds/ifosim/finesse/finesse3/docs/build/jupyter_execute/examples/07_homodyne_2_1.svg"
}
},
"output_type": "display_data"
}
],
"source": [
"def to_db(quantity, reference, isAmplitude=False):\n",
" if isAmplitude: factor = 20\n",
" else: factor = 10\n",
"\n",
" return factor*np.log10(quantity/reference)\n",
"\n",
"sqz_db = to_db(out['sqzd_noise'], out['shot_noise'], isAmplitude=True)\n",
"\n",
"fig, ax = plt.subplots()\n",
"ax.plot(out.x0, sqz_db)\n",
"ax.set_ylabel('SQZ / ASQZ [dB]')\n",
"ax.set_xlabel('LO Phase [deg]')"
]
}
],
"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.13.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}