analyseScript/20230620_Data_Analysis.ipynb

3130 lines
242 KiB
Plaintext
Raw Normal View History

2023-06-29 11:54:10 +02:00
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Import supporting package"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import numpy as np\n",
"import copy\n",
"\n",
"from uncertainties import ufloat\n",
"from uncertainties import unumpy as unp\n",
"from uncertainties import umath\n",
"import random\n",
"import matplotlib.pyplot as plt\n",
"plt.rcParams['font.size'] = 12\n",
"\n",
"from DataContainer.ReadData import read_hdf5_file\n",
"from Analyser.ImagingAnalyser import ImageAnalyser\n",
"from Analyser.FitAnalyser import FitAnalyser\n",
"from Analyser.FitAnalyser import NewFitModel, DensityProfileBEC2dModel\n",
"from ToolFunction.ToolFunction import *\n",
"\n",
"from scipy.optimize import curve_fit\n",
"\n",
"from ToolFunction.HomeMadeXarrayFunction import errorbar, dataarray_plot_errorbar\n",
"xr.plot.dataarray_plot.errorbar = errorbar\n",
"xr.plot.accessor.DataArrayPlotAccessor.errorbar = dataarray_plot_errorbar\n",
"\n",
"imageAnalyser = ImageAnalyser()\n",
"\n",
"# %matplotlib notebook"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Start a client for parallel computing"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
" <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px;\">Client</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Client-f69f7e77-14be-11ee-a66c-80e82ce2fa8e</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
"\n",
" <tr>\n",
" \n",
" <td style=\"text-align: left;\"><strong>Connection method:</strong> Cluster object</td>\n",
" <td style=\"text-align: left;\"><strong>Cluster type:</strong> distributed.LocalCluster</td>\n",
" \n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" \n",
"\n",
" </table>\n",
"\n",
" \n",
"\n",
" \n",
" <details>\n",
" <summary style=\"margin-bottom: 20px;\"><h3 style=\"display: inline;\">Cluster Info</h3></summary>\n",
" <div class=\"jp-RenderedHTMLCommon jp-RenderedHTML jp-mod-trusted jp-OutputArea-output\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\">\n",
" </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px; margin-top: 0px;\">LocalCluster</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">cbd5084a</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Workers:</strong> 8\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads:</strong> 128\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total memory:</strong> 149.01 GiB\n",
" </td>\n",
" </tr>\n",
" \n",
" <tr>\n",
" <td style=\"text-align: left;\"><strong>Status:</strong> running</td>\n",
" <td style=\"text-align: left;\"><strong>Using processes:</strong> True</td>\n",
"</tr>\n",
"\n",
" \n",
" </table>\n",
"\n",
" <details>\n",
" <summary style=\"margin-bottom: 20px;\">\n",
" <h3 style=\"display: inline;\">Scheduler Info</h3>\n",
" </summary>\n",
"\n",
" <div style=\"\">\n",
" <div>\n",
" <div style=\"width: 24px; height: 24px; background-color: #FFF7E5; border: 3px solid #FF6132; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px;\">Scheduler</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Scheduler-0b555d69-83fd-43e1-9215-9c67aeb6d78c</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm:</strong> tcp://127.0.0.1:61752\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Workers:</strong> 8\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads:</strong> 128\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Started:</strong> Just now\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total memory:</strong> 149.01 GiB\n",
" </td>\n",
" </tr>\n",
" </table>\n",
" </div>\n",
" </div>\n",
"\n",
" <details style=\"margin-left: 48px;\">\n",
" <summary style=\"margin-bottom: 20px;\">\n",
" <h3 style=\"display: inline;\">Workers</h3>\n",
" </summary>\n",
"\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 0</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61792\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61794/status\" target=\"_blank\">http://127.0.0.1:61794/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61755\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-vwm7x29k\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 1</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61793\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61798/status\" target=\"_blank\">http://127.0.0.1:61798/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61756\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-dsm02jmm\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 2</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61810\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61811/status\" target=\"_blank\">http://127.0.0.1:61811/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61757\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-kb6dkrm1\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 3</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61775\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61790/status\" target=\"_blank\">http://127.0.0.1:61790/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61758\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-vtzwx9iy\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 4</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61804\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61806/status\" target=\"_blank\">http://127.0.0.1:61806/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61759\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-a97vh11n\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 5</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61796\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61801/status\" target=\"_blank\">http://127.0.0.1:61801/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61760\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-2jc_h5j9\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 6</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61797\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61800/status\" target=\"_blank\">http://127.0.0.1:61800/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61761\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-mvwb15rr\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
" <div style=\"margin-bottom: 20px;\">\n",
" <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n",
" <details>\n",
" <summary>\n",
" <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 7</h4>\n",
" </summary>\n",
" <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:61805\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 16\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61808/status\" target=\"_blank\">http://127.0.0.1:61808/status</a>\n",
" </td>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 18.63 GiB\n",
" </td>\n",
" </tr>\n",
" <tr>\n",
" <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:61762\n",
" </td>\n",
" <td style=\"text-align: left;\"></td>\n",
" </tr>\n",
" <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-co4d63m7\n",
" </td>\n",
" </tr>\n",
"\n",
" \n",
"\n",
" \n",
"\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div>\n",
" \n",
"\n",
" </details>\n",
"</div>\n",
"\n",
" </details>\n",
" </div>\n",
"</div>\n",
" </details>\n",
" \n",
"\n",
" </div>\n",
"</div>"
],
"text/plain": [
"<Client: 'tcp://127.0.0.1:61752' processes=8 threads=128, memory=149.01 GiB>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from dask.distributed import Client\n",
"client = Client(n_workers=8, threads_per_worker=16, processes=True, memory_limit='20GB')\n",
"client"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Start a client for Mongo DB"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import pymongo\n",
"import xarray_mongodb\n",
"\n",
"from DataContainer.MongoDB import MongoDB\n",
"\n",
"mongoClient = pymongo.MongoClient('mongodb://control:DyLab2021@127.0.0.1:27017/?authMechanism=DEFAULT')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set global path for experiment"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"groupList = [\n",
" \"images/MOT_3D_Camera/in_situ_absorption\",\n",
" \"images/ODT_1_Axis_Camera/in_situ_absorption\",\n",
" \"images/ODT_2_Axis_Camera/in_situ_absorption\",\n",
"]\n",
"\n",
"dskey = {\n",
" \"images/MOT_3D_Camera/in_situ_absorption\": \"camera_0\",\n",
" \"images/ODT_1_Axis_Camera/in_situ_absorption\": \"camera_1\",\n",
" \"images/ODT_2_Axis_Camera/in_situ_absorption\": \"camera_2\",\n",
"}\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"img_dir = 'C:/Users/control/DyLab/Experiments/DyBEC/'\n",
"SequenceName = \"Repetition_scan\"\n",
"folderPath = img_dir + SequenceName + \"/\" + get_date()\n",
"\n",
"mongoDB = mongoClient[SequenceName]\n",
"\n",
"DB = MongoDB(mongoClient, mongoDB, date=get_date())"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Repetition Scans"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## scan MOT freq - Z Comp 0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0001\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in range(len(groupList))\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_1\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (310, 825)\n",
"imageAnalyser.span = (550, 1200)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = Ncount.mean(dim='runs')\n",
"Ncount_std = Ncount.std(dim='runs')\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"plt.xlabel('MOT AOM Freq (MHz)')\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"DB.create_global(shotNum, dataSet)\n",
"DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## scan Push freq"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0002\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in range(len(groupList))\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_1\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (310, 825)\n",
"imageAnalyser.span = (525, 1255)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"plt.xlabel('Push AOM Freq (MHz)')\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"DB.create_global(shotNum, dataSet)\n",
"DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## scan Z comp current"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0005\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in range(len(groupList))\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_1\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (305, 875)\n",
"imageAnalyser.span = (400, 400)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"plt.xlabel('comp Z current (A)')\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"DB.create_global(shotNum, dataSet)\n",
"DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## scan cMOT final Amp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"shotNum = \"0006\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in range(len(groupList))\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_1\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (305, 875)\n",
"imageAnalyser.span = (400, 400)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"plt.xlabel('cMOT final Amp (%)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 25000])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"DB.create_global(shotNum, dataSet)\n",
"DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0011\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in range(len(groupList))\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_1\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (305, 875)\n",
"imageAnalyser.span = (400, 400)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"plt.xlabel('comp Z current (A)')\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"DB.create_global(shotNum, dataSet)\n",
"DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Evaporative Cooling"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"img_dir = '//DyLabNAS/Data/'\n",
"SequenceName = \"Evaporative_Cooling\"\n",
"#folderPath = img_dir + SequenceName + \"/\" + get_date()\n",
"folderPath = img_dir + SequenceName + \"/2023/06/20\"\n",
"\n",
"mongoDB = mongoClient[SequenceName]\n",
"\n",
"DB = MongoDB(mongoClient, mongoDB, date=get_date())"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calibration of the magnetic fields"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.119 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0004\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -6000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 2.9576, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 6000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(2.9445, 2.9601, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 3500])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.189 A, 0.25 Vpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0008\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], maxFileNum = 100, excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -6000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 4.25, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 6000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(4.2375, 4.266, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 3500])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.189 A, 0.5 Vpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0009\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], maxFileNum = 100, excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -6000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 4.25, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 6000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(4.23, 4.275, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 3500])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.189 A, 1 Vpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0010\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], maxFileNum = 100, excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -6000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 4.25, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 6000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(4.23, 4.275, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 3500])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.189 A, 3 Vpp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0011\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], maxFileNum = 80, excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -6000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 4.25, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 6000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(4.22, 4.275, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.ylim([0, 3500])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scan Z offset field during evaporation"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The detected scaning axes and values are: \n",
"\n",
"{'compZ_current_sg': array([0.18 , 0.182, 0.184, 0.186, 0.188, 0.19 , 0.192, 0.194, 0.196,\n",
" 0.198, 0.2 , 0.202, 0.204, 0.206, 0.208, 0.21 , 0.212, 0.214,\n",
" 0.216, 0.218, 0.22 ]), 'runs': array([0., 1., 2.])}\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAm4AAAHPCAYAAADqAFbFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABwfUlEQVR4nO3deVxU5f4H8M+wDZuIgAsIqVdSMrd7yVxKxQ2XNBW1srq5pN1fWm4t7guWpmWlmVZeSyy3XNBSSUXFpVKv6b2JpVnu+wIasg9wfn88HWBggGGYM3POzOf9evHizDnPnPM8HDh851l1kiRJICIiIiLVc7F3BoiIiIjIPAzciIiIiDSCgRsRERGRRjBwIyIiItIIBm5EREREGsHAjYiIiEgjGLgRERERaYSbvTPgKAoKCnDt2jVUq1YNOp3O3tkhIiIiDZEkCffv30dISAhcXMquV2PgZiXXrl1DWFiYvbNBREREGnb58mWEhoaWeZyBm5VUq1YNgPiB+/n5Wf38BoMBu3btQnR0NNzd3a1+frVheR2fs5WZ5XVsLK/jU7rMaWlpCAsLK4wnysLAzUrk5lE/Pz/FAjdvb2/4+fk5xR8Jy+v4nK3MLK9jY3kdn63KXFF3Kw5OICIiItI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x9cLVmVQ6qhtnnEnMH586KfWna2aM5cuNC6/cp0OqBFC1Gbt2ePmObDHGyqU0Z5E/wC4m9s4UJ+MCKyNbvXuJnj7NmzyMrKQvPmzUsda968ORITE5GdnQ1PT0+cPHkSANCsWTO
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"shotNum = \"0015\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (890, 880)\n",
"imageAnalyser.span = (150, 150)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='-ob')\n",
"plt.xlabel('comp Z current (A)')\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()\n",
"\n",
"# DB.create_global(shotNum, dataSet)\n",
"# DB.add_data(shotNum, dataSet_cropOD, engine='xarray')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAG2CAYAAACqK1jJAAAAOX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QVctlMiNWDx6NSYt4aCLf24XJw39jc4I1JjNUyxoX7qzgSh/O0+ofMOpib66GO6TO4TRXTq0wsKGaFx7jKJ8Q2rRPhjMqU3ZmZ4X4sFH4Kal5yumquM3KxZ2Ztxvlwm1o7cJ7ct2bHK8S0KRM4PDZtDnI7x75FaowrlpvnCJffGEI2W2Pzim0D1jzOOuIIHIN087sKDVD+q/UMgA0bNqBJkyaRGI4QdjqGS+HSSy/Fd999h7FjxwIoFxMCQGFhRTs1hYWFKCsrw/r165PvFhQUYJ999pHvWlr2bihNzlfhtttuw7777pv882t9HA6Hw7Ez4tlnn8VnACrSCxqdATQHMKgWT0/ujtjpGa7x48fjT3/6E+6991707NkzLawyi7wclu17ub7LuP7663HVVVcl/y8pKaFFFzdziK0yKDaIEdtB8oLRdn7MVq3KeGbCmIDQMXljXnjnzzs4tZPnMtkOkfXObId3Mvkx82OsIOuvMRtlO9TQTrlYlE2Vk1kQ/rDYTpx1YjLLBsT7llk/KxMzhcxumi4JtwPHt77lOtvumVmtmK4bMzNWP97dK6aQ8+RxEBO52zhSjAL352oRHtLnsTnAcdQciZUzZHpA6XBZmUL6QjGWxBBjYUPtqT7bNsd53nL+ZgIh9H2xNJlZ5TmiyqoYvlx0nzZlPIH08tvYDbFqMR0yqwuXSc1XNnETM2is+qSI3H0ST9bvY0bV0uey52c8axbbtm3DzwYOxEmI19aQh3JjqP8fyu8Jbtu2bSR
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"\n",
"data = dataSet_cropOD.sel(compZ_current_sg = 0.198, runs=0)\n",
"data = data.assign_coords(x=data.x * 2.352 * 5.86)\n",
"data = data.assign_coords(y=data.y * 2.352 * 5.86)\n",
"\n",
"data.plot.pcolormesh(cmap='jet', vmin=0, vmax=2)\n",
"\n",
"plt.title('')\n",
"plt.xlabel('x ($\\mu m$)')\n",
"plt.ylabel('y ($\\mu m$)')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"f:\\Jianshun\\analyseScript\\Analyser\\FitAnalyser.py:86: RuntimeWarning: invalid value encountered in power\n",
" res = (1- ((x-centerx)/(sigmax))**2 - ((y-centery)/(sigmay))**2)**(3 / 2)\n"
]
}
],
"source": [
"data = dataSet_cropOD.sel(compZ_current_sg = 0.198, runs=0)\n",
"\n",
"fitModel = DensityProfileBEC2dModel()\n",
"fitAnalyser_1 = FitAnalyser(fitModel, fitDim=2)\n",
"\n",
"params = fitAnalyser_1.guess(data, dask=\"parallelized\")\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(data, params).load()\n",
"\n",
"# x = np.linspace(2.7725, 2.822, 500)\n",
"# y = np.linspace(2.7725, 2.822, 500)\n",
"# fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=x, y=y, dask=\"parallelized\").load()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\data\\AppData\\Roaming\\Python\\Python39\\site-packages\\numpy\\lib\\function_base.py:2246: RuntimeWarning: invalid value encountered in _get_fit_full_result_single (vectorized)\n",
" outputs = ufunc(*inputs)\n"
]
},
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: 'â–º';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: 'â–¼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
"Dimensions: ()\n",
"Coordinates:\n",
" compZ_current_sg float64 0.198\n",
" runs float64 0.0\n",
"Data variables:\n",
" BEC_amplitude object 792.7896024042066+/-nan\n",
" thermal_amplitude object 0.0+/-nan\n",
" BEC_centerx object 72.03322637975705+/-nan\n",
" BEC_centery object 74.15709273093088+/-nan\n",
" thermal_centerx object 73.1219837873983+/-nan\n",
" thermal_centery object 75.0675362391377+/-nan\n",
" BEC_sigmax object 25.92336716503899+/-nan\n",
" BEC_sigmay object 10.643305951751195+/-nan\n",
" thermal_sigmax object 17.18976684635309+/-nan\n",
" thermal_sigmay object 14.449859669689275+/-nan\n",
" thermalAspectRatio object 0.8406082408706373+/-nan\n",
" condensate_fraction object 1.0+/-nan\n",
"Attributes:\n",
" IMAGE_SUBCLASS: IMAGE_GRAYSCALE\n",
" IMAGE_VERSION: 1.2\n",
" IMAGE_WHITE_IS_ZERO: 0\n",
" x_start: 815\n",
" x_end: 965\n",
" y_end: 955\n",
" y_start: 805\n",
" x_center: 890\n",
" y_center: 880\n",
" x_span: 150\n",
" y_span: 150</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-ee805def-8782-4ff7-aaa5-0307542091fe' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-ee805def-8782-4ff7-aaa5-0307542091fe' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-bbeb3fd8-9d26-42ce-a0f6-9e9fccaac797' class='xr-section-summary-in' type='checkbox' checked><label for='section-bbeb3fd8-9d26-42ce-a0f6-9e9fccaac797' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>compZ_current_sg</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.198</div><input id='attrs-290bd221-ede4-4895-b984-6361188a7a61' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-290bd221-ede4-4895-b984-6361188a7a61' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0fc86fa5-f9e1-436b-96fd-ee93ac5da45c' class='xr-var-data-in' type='checkbox'><label for='data-0fc86fa5-f9e1-436b-96fd-ee93ac5da45c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(0.198)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>runs</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0</div><input id='attrs-0c115949-5d9f-4808-a73d-8486b09d9ef7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0c115949-5d9f-4808-a73d-8486b09d9ef7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7240579c-8983-46b8-8df4-f5586e5c5c9d' class='xr-var-data-in' type='checkbox'><label for='data-7240579c-8983-46b8-8df4-f5586e5c5c9d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(0.)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1b80cf78-e245-4bdf-b9d3-38af0d71eae7' class='xr-section-summary-in' type='checkbox' checked><label for='section-1b80cf78-e245-4bdf-b9d3-38af0d71eae7' class='xr-section-summary' >Data variables: <span>(12)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>BEC_amplitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>792.7896024042066+/-nan</div><input id='attrs-829f02b0-3ab6-4c29-a25b-a21789ce5b42' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-829f02b0-3ab6-4c29-a25b-a21789ce5b42' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1ef932b3-726d-43a3-a5de-0dcf8f5a42f6' class='xr-var-data-in' type='checkbox'><label for='data-1ef932b3-726d-43a3-a5de-0dcf8f5a42f6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(792.7896024042066+/-nan, dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>thermal_amplitude</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>object</div><div clas
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: ()\n",
"Coordinates:\n",
" compZ_current_sg float64 0.198\n",
" runs float64 0.0\n",
"Data variables:\n",
" BEC_amplitude object 792.7896024042066+/-nan\n",
" thermal_amplitude object 0.0+/-nan\n",
" BEC_centerx object 72.03322637975705+/-nan\n",
" BEC_centery object 74.15709273093088+/-nan\n",
" thermal_centerx object 73.1219837873983+/-nan\n",
" thermal_centery object 75.0675362391377+/-nan\n",
" BEC_sigmax object 25.92336716503899+/-nan\n",
" BEC_sigmay object 10.643305951751195+/-nan\n",
" thermal_sigmax object 17.18976684635309+/-nan\n",
" thermal_sigmay object 14.449859669689275+/-nan\n",
" thermalAspectRatio object 0.8406082408706373+/-nan\n",
" condensate_fraction object 1.0+/-nan\n",
"Attributes:\n",
" IMAGE_SUBCLASS: IMAGE_GRAYSCALE\n",
" IMAGE_VERSION: 1.2\n",
" IMAGE_WHITE_IS_ZERO: 0\n",
" x_start: 815\n",
" x_end: 965\n",
" y_end: 955\n",
" y_start: 805\n",
" x_center: 890\n",
" y_center: 880\n",
" x_span: 150\n",
" y_span: 150"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fitAnalyser_1.get_fit_full_result(fitResult_1)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.1654007155341837"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"792.7896024042066 * 147 /1e5"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calibration of the magnetic fields - after connecting the Z coils to the HiPPS"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.119 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0035\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -5000, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 2.8, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 5000, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(2.7725, 2.822, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.140 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0044\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -2500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 3.177, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 2500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(3.158, 3.198, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.200 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0048\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -4500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 4.275, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 4500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(4.260, 4.289, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.259 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0056\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -4500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 5.3, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 4500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(5.34, 5.364, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.329 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0059\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -4500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 6.636, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 4500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(6.62, 6.655, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.419 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0063\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -1500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 8.286, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.1, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 1500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(8.27, 8.305, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"img_dir = 'C:/Users/control/DyLab/Experiments/DyBEC/'\n",
"SequenceName = \"Evaporative_Cooling\"\n",
"folderPath = img_dir + SequenceName + \"/\" + get_date()\n",
"\n",
"mongoDB = mongoClient[SequenceName]\n",
"\n",
"DB = MongoDB(mongoClient, mongoDB, date=get_date())"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Z Offset field = 0.489 A"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"shotNum = \"0002\"\n",
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n",
"\n",
"dataSetDict = {\n",
" dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i], excludeAxis = ['sweep_start_freq', 'sweep_stop_freq'])\n",
" for i in [0]\n",
"}\n",
"\n",
"dataSet = dataSetDict[\"camera_0\"]\n",
"\n",
"print_scanAxis(dataSet)\n",
"\n",
"scanAxis = get_scanAxis(dataSet)\n",
"\n",
"dataSet = auto_rechunk(dataSet)\n",
"\n",
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
"\n",
"imageAnalyser.center = (160, 880)\n",
"imageAnalyser.span = (250, 250)\n",
"imageAnalyser.fraction = (0.1, 0.1)\n",
"\n",
"dataSet_cropOD = imageAnalyser.crop_image(dataSet.OD)\n",
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
"\n",
"Ncount = imageAnalyser.get_Ncount(dataSet_cropOD)\n",
"Ncount_mean = calculate_mean(Ncount)\n",
"Ncount_std = calculate_std(Ncount)\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"\n",
"plt.ylabel('NCount')\n",
"plt.tight_layout()\n",
"#plt.ylim([0, 3500])\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Ncount_mean_1 = Ncount_mean\n",
"Ncount_std_1 = Ncount_std\n",
"\n",
"fitAnalyser_1 = FitAnalyser(\"Gaussian With Offset\", fitDim=1)\n",
"# params = fitAnalyser.guess(Ncount_mean_1, x=scanAxis[0], guess_kwargs=dict(negative=True), dask=\"parallelized\")\n",
"params = fitAnalyser_1.fitModel.make_params()\n",
"params.add(name=\"amplitude\", value= -2500, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"center\", value= 9.575, max=np.inf, min=-np.inf, vary=True)\n",
"params.add(name=\"sigma\", value= 0.2, max=np.inf, min= 0, vary=True)\n",
"params.add(name=\"offset\", value= 2500, max=np.inf, min=-np.inf, vary=True)\n",
"\n",
"fitResult_1 = fitAnalyser_1.fit(Ncount_mean_1, params, x=scanAxis[0]).load()\n",
"freqdata = np.linspace(9.555, 9.595, 500)\n",
"fitCurve_1 = fitAnalyser_1.eval(fitResult_1, x=freqdata, dask=\"parallelized\").load()\n",
"fitCurve_1 = fitCurve_1.assign_coords({'x':np.array(freqdata)})\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"\n",
"Ncount_mean.plot.errorbar(ax=ax, yerr = Ncount_std, fmt='ob')\n",
"fitCurve_1.plot.errorbar(ax=ax, fmt='--g')\n",
"plt.xlabel('Center Frequency (MHz)')\n",
"plt.ylabel('NCount')\n",
"#plt.xlim([2.7828, 2.81625])\n",
"plt.tight_layout()\n",
"plt.grid(visible=1)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f_1 = fitAnalyser_1.get_fit_value(fitResult_1).center\n",
"df_1 = fitAnalyser_1.get_fit_std(fitResult_1).center\n",
"\n",
"print('f = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(f_1)* 1e3,df_1* 1e3]))\n",
"\n",
"s_1 = fitAnalyser_1.get_fit_value(fitResult_1).sigma\n",
"ds_1 = fitAnalyser_1.get_fit_std(fitResult_1).sigma\n",
"\n",
"fwhm_1 = 2.3548200*s_1 * 1e3\n",
"dfwhm_1 = 2.3548200*ds_1 * 1e3\n",
"\n",
"print('fwhm = %.5f \\u00B1 %.5f kHz'% tuple([np.abs(fwhm_1),dfwhm_1]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"f = [2798.24971, 3178.49790, 4275.39905, 5352.17283, 6637.80418, 8288.35264, 9573.59333]\n",
"df = [0.36873, 0.29413, 0.20667, 0.20818, 0.21978, 0.20285, 0.18495]\n",
"z_offset_current = [0.119, 0.140, 0.2, 0.259, 0.329, 0.419, 0.489]\n",
"\n",
"f_fit = f\n",
"df_fit = df\n",
"z_offset_current_fit = z_offset_current\n",
"\n",
"\n",
"x = np.array(z_offset_current_fit)\n",
"y = np.array(f_fit)\n",
"\n",
"# Degree of the fitting polynomial\n",
"deg = 1\n",
"# Parameters from the fit of the polynomial\n",
"p = np.polyfit(x, y, deg)\n",
"m = p[0] # Gradient\n",
"c = p[1] # y-intercept\n",
"\n",
"#print(f'The fitted straight line has equation y = {m:.1f}x {c:=+6.1f}')\n",
"\n",
"# Model the data using the parameters of the fitted straight line\n",
"y_model = np.polyval(p, x)\n",
"\n",
"# Create the linear (1 degree polynomial) model\n",
"model = np.poly1d(p)\n",
"# Fit the model\n",
"y_model = model(x)\n",
"\n",
"# Mean\n",
"y_bar = np.mean(y)\n",
"# Coefficient of determination, R²\n",
"R2 = np.sum((y_model - y_bar)**2) / np.sum((y - y_bar)**2)\n",
"\n",
"#print(f'R² = {R2:.2f}')\n",
"\n",
"fitted_SlopeInkHz = m\n",
"fitted_offsetInkHz = c\n",
"muB = 9.274e-24\n",
"hbar = 6.626e-34 / (2 * np.pi)\n",
"gJ = 1.24\n",
"Slope = (((2 * np.pi * fitted_SlopeInkHz * 1e3)*hbar) / (muB*gJ)) * 1e4\n",
"Offset = (((2 * np.pi * fitted_offsetInkHz * 1e3)*hbar) / (muB*gJ)) * 1e4\n",
"\n",
"def calib_fit(x, B):\n",
" alpha = ((2 * np.pi * fitted_SlopeInkHz * 1e3)*hbar) / (muB*gJ)\n",
" beta = ((2 * np.pi * fitted_offsetInkHz * 1e3)*hbar) / (muB*gJ)\n",
" delta_nu = ((muB * gJ) / hbar) * np.sqrt((B**2-beta**2) + ((alpha * x) + beta)**2)\n",
" return delta_nu / (2 * np.pi * 1e3)\n",
"\n",
"\n",
"popt, pcov = curve_fit(calib_fit, z_offset_current, f, np.array([0.1*1e-4]))\n",
"Boffset = popt[0] * 1e4\n",
"dBoffset = pcov[0][0]**0.5 * 1e4\n",
"\n",
"fig = plt.figure()\n",
"ax = fig.gca()\n",
"plt.clf\n",
"#plt.scatter(z_offset_current, f, c='gray', marker='o', edgecolors='k', s=30)\n",
"plt.errorbar(z_offset_current, f, yerr=df, fmt='o')\n",
"xvals = np.linspace(0, 0.5, 500)\n",
"plt.plot(np.array(xvals), p[1] + p[0] * np.array(xvals), label=f'Line Fit')\n",
"plt.plot(xvals, calib_fit(xvals, *popt), label=f'Curve Fit')\n",
"plt.text(0.25, 2200, f'Line Slope = {Slope:.3f} G/A', fontsize=12)\n",
"plt.text(0.25, 1500, f'Line Offset = {Offset:=.3f} G', fontsize=12)\n",
"plt.text(0.25, 800, f'Bo= {Boffset:=.3f} +/- {dBoffset:=.3f} G', fontsize=12)\n",
"plt.xlabel('Z Offset Coil Current (A)', fontsize=12)\n",
"plt.ylabel('Resonance Frequency (kHz)', fontsize=12)\n",
"plt.xticks(fontsize=12)\n",
"plt.yticks(fontsize=12)\n",
"plt.legend(fontsize=12)\n",
"#plt.xlim(-0.01, 0.04)\n",
"#plt.ylim(0, 2000)\n",
"plt.grid(visible=1)\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"l = list(np.arange(9.555, 9.595, 0.002))\n",
"# l = np.logspace(np.log10(250e-6), np.log10(500e-3), num=15)\n",
"\n",
"l = [round(item, 7) for item in l]\n",
"#random.shuffle(l)\n",
"\n",
"print(l)\n",
"print(len(l))\n",
"np.mean(l)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pixel = 5.86e-6\n",
"M = 0.6827\n",
"F = (1/(0.3725*8.4743e-14)) * (pixel / M)**2\n",
"NCount = 85000\n",
"AtomNumber = NCount * F / 1e8\n",
"print(AtomNumber)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"muB = 9.274e-24\n",
"hbar = 6.626e-34 / (2 * np.pi)\n",
"gJ = 1.24\n",
"Delta = 2 * np.pi * 9573.59333 * 1e3\n",
"\n",
"Bz = (Delta*hbar) / (muB*gJ)\n",
"print(Bz * 1e4)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## ODT 1 Calibration"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"v_high = 2.7\n",
"\"\"\"High Power\"\"\"\n",
"P_arm1_high = 5.776 * v_high - 0.683\n",
"\n",
"v_mid = 0.2076\n",
"\"\"\"Intermediate Power\"\"\"\n",
"P_arm1_mid = 5.815 * v_mid - 0.03651\n",
"\n",
"v_low = 0.0587\n",
"\"\"\"Low Power\"\"\"\n",
"P_arm1_low = 5271 * v_low - 27.5\n",
"\n",
"print(round(P_arm1_high, 3))\n",
"print(round(P_arm1_mid, 3))\n",
"print(round(P_arm1_low, 3))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## ODT 2 Power Calibration"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"v = 0.7607\n",
"P_arm2 = 2.302 * v - 0.06452\n",
"print(round(P_arm2, 3))"
]
}
],
"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.9.12"
},
"vscode": {
"interpreter": {
"hash": "c05913ad4f24fdc6b2418069394dc5835b1981849b107c9ba6df693aafd66650"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}