2022 lines
5.0 MiB
Plaintext
2022 lines
5.0 MiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"# Import supporting package"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import lmfit\n",
|
||
|
"import xarray as xr\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import numpy as np\n",
|
||
|
"import copy\n",
|
||
|
"\n",
|
||
|
"import glob\n",
|
||
|
"\n",
|
||
|
"import xrft\n",
|
||
|
"import finufft\n",
|
||
|
"\n",
|
||
|
"from uncertainties import ufloat\n",
|
||
|
"from uncertainties import unumpy as unp\n",
|
||
|
"from uncertainties import umath\n",
|
||
|
"\n",
|
||
|
"from datetime import datetime\n",
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"\n",
|
||
|
"#test\n",
|
||
|
"plt.rcParams['font.size'] = 18\n",
|
||
|
"\n",
|
||
|
"from scipy.ndimage import gaussian_filter\n",
|
||
|
"import matplotlib as mpl\n",
|
||
|
"from scipy.interpolate import CubicSpline\n",
|
||
|
"from scipy.optimize import curve_fit\n",
|
||
|
"mpl.rc('xtick', labelsize=8)\n",
|
||
|
"mpl.rc('ytick', labelsize=8)\n",
|
||
|
"\n",
|
||
|
"from DataContainer.ReadData import read_hdf5_file, read_hdf5_global, read_hdf5_run_time, read_csv_file\n",
|
||
|
"from Analyser.ImagingAnalyser import ImageAnalyser\n",
|
||
|
"from Analyser.FitAnalyser import FitAnalyser\n",
|
||
|
"from Analyser.FitAnalyser import ThomasFermi2dModel, DensityProfileBEC2dModel, Polylog22dModel\n",
|
||
|
"from Analyser.FFTAnalyser import fft, ifft, fft_nutou\n",
|
||
|
"from ToolFunction.ToolFunction import *\n",
|
||
|
"\n",
|
||
|
"import time\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"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T13:58:29.507478500Z",
|
||
|
"start_time": "2023-08-01T13:58:29.454111800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# get center of thresholded image\n",
|
||
|
"def calc_thresh(data):\n",
|
||
|
" shape = np.shape(data)\n",
|
||
|
" thresh = np.zeros(shape)\n",
|
||
|
" sigma = 0.4\n",
|
||
|
"\n",
|
||
|
" if len(shape) == 4:\n",
|
||
|
" blurred = gaussian_filter(data, sigma=sigma)\n",
|
||
|
" for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" thresh[i,j] = np.where(blurred[i,j] < np.max(blurred[i,j])*0.3,0,1)\n",
|
||
|
"\n",
|
||
|
" elif len(shape) == 3:\n",
|
||
|
" blurred = gaussian_filter(data, sigma=sigma)\n",
|
||
|
" for i in range(0,shape[0]):\n",
|
||
|
" thresh[i] = np.where(blurred[i] < np.max(blurred[i])*0.3,0,1)\n",
|
||
|
"\n",
|
||
|
" else:\n",
|
||
|
" print(\"Shape of data is wrong, output is empty\")\n",
|
||
|
"\n",
|
||
|
" return thresh\n",
|
||
|
"\n",
|
||
|
"def calc_cen(thresh1):\n",
|
||
|
" \"\"\"\n",
|
||
|
" returns array: [Y_center,X_center]\n",
|
||
|
" \"\"\"\n",
|
||
|
" cen = np.zeros(2)\n",
|
||
|
" (Y,X) = np.shape(thresh1)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" thresh1 = thresh1 /np.sum(thresh1)\n",
|
||
|
"\n",
|
||
|
" # marginal distributions\n",
|
||
|
" dx = np.sum(thresh1, 0)\n",
|
||
|
" dy = np.sum(thresh1, 1)\n",
|
||
|
"\n",
|
||
|
" # expected values\n",
|
||
|
" cen[0] = np.sum(dx * np.arange(X))\n",
|
||
|
" cen[1] = np.sum(dy * np.arange(Y))\n",
|
||
|
" return cen\n",
|
||
|
"\n",
|
||
|
"def calc_cen_bulk(thresh):\n",
|
||
|
" \"\"\"\n",
|
||
|
" returns array in shape of input, containing array with [Y_center,X_center] for each image\n",
|
||
|
" \"\"\"\n",
|
||
|
" shape = np.shape(thresh)\n",
|
||
|
" cen = np.zeros((shape[0], shape[1], 2))\n",
|
||
|
" for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" cen[i,j] = calc_cen(thresh[i,j])\n",
|
||
|
" return cen\n",
|
||
|
"\n",
|
||
|
"def guess_BEC_width(thresh, center):\n",
|
||
|
" \"\"\"\n",
|
||
|
" returns width of thresholded area along both axis through the center with shape of thresh and [X_width, Y_width] for each image\n",
|
||
|
" \"\"\"\n",
|
||
|
" shape = np.shape(thresh)\n",
|
||
|
" BEC_width_guess = np.zeros((shape[0], shape[1], 2))\n",
|
||
|
"\n",
|
||
|
" for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" BEC_width_guess[i, j, 0] = np.sum(thresh[i, j, round(center[i,j,1]), :])\n",
|
||
|
" BEC_width_guess[i, j, 1] = np.sum(thresh[i, j, :, round(center[i,j,0])])\n",
|
||
|
"\n",
|
||
|
" return BEC_width_guess\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def gaussian(x, x0, sigma, A):\n",
|
||
|
" return A * np.exp(-0.5 * (x-x0)**2 / sigma**2)\n",
|
||
|
"\n",
|
||
|
"# def polylog(power, numerator, order = 15):\n",
|
||
|
"#\n",
|
||
|
"# dataShape = numerator.shape\n",
|
||
|
"# numerator = np.tile(numerator, (order, 1))\n",
|
||
|
"# numerator = np.power(numerator.T, np.arange(1, order+1)).T\n",
|
||
|
"#\n",
|
||
|
"# denominator = np.arange(1, order+1)\n",
|
||
|
"# denominator = np.tile(denominator, (dataShape[0], 1))\n",
|
||
|
"# denominator = denominator.T\n",
|
||
|
"#\n",
|
||
|
"# data = numerator/ np.power(denominator, power)\n",
|
||
|
"#\n",
|
||
|
"# return np.sum(data, axis=0)\n",
|
||
|
"\n",
|
||
|
"def polylog_tab(pow, x):\n",
|
||
|
" order = 100\n",
|
||
|
" sum = 0\n",
|
||
|
" for k in range(1,order):\n",
|
||
|
" sum += x ** k /k **pow\n",
|
||
|
" return sum\n",
|
||
|
"\n",
|
||
|
"x_int = np.linspace(0, 1.00001, 100000)\n",
|
||
|
"\n",
|
||
|
"poly_tab = polylog_tab(2,x_int)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"polylog_int = CubicSpline(x_int, poly_tab)\n",
|
||
|
"\n",
|
||
|
"def thermal(x, x0, amp, sigma):\n",
|
||
|
" res = np.exp(-0.5 * (x-x0)**2 / sigma**2)\n",
|
||
|
" return amp/1.643 * polylog_int(res)\n",
|
||
|
"\n",
|
||
|
"def Thomas_Fermi_1d(x, x0, amp, sigma):\n",
|
||
|
" res = (1- ((x-x0)/sigma)**2)\n",
|
||
|
" res = np.where(res > 0, res, 0)\n",
|
||
|
" res = res**(3/2)\n",
|
||
|
" return amp * res\n",
|
||
|
"\n",
|
||
|
"def density_1d(x, x0_bec, x0_th, amp_bec, amp_th, sigma_bec, sigma_th):\n",
|
||
|
" return thermal(x, x0_th, amp_th, sigma_th) + Thomas_Fermi_1d(x, x0_bec, amp_bec, sigma_bec)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def polylog(pow, x):\n",
|
||
|
" order = 15\n",
|
||
|
" sum = 0\n",
|
||
|
" for k in range(1,order):\n",
|
||
|
" sum += x ** k /k **pow\n",
|
||
|
" return sum\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def ThomasFermi_2d(x, y=0.0, centerx=0.0, centery=0.0, amplitude=1.0, sigmax=1.0, sigmay=1.0):\n",
|
||
|
"\n",
|
||
|
" res = (1- ((x-centerx)/(sigmax))**2 - ((y-centery)/(sigmay))**2)\n",
|
||
|
" res = np.where(res > 0, res, 0)\n",
|
||
|
" res = res**(3/2)\n",
|
||
|
" return amplitude * res\n",
|
||
|
" # return amplitude * 5 / 2 / np.pi / max(tiny, sigmax * sigmay) * np.where(res > 0, res, 0)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" # return amplitude / 2 / np.pi / 1.20206 / max(tiny, sigmax * sigmay) * polylog(2, np.exp( -((x-centerx)**2/(2 * (sigmax)**2))-((y-centery)**2/( 2 * (sigmay)**2)) ))\n",
|
||
|
"# Set up table for polylog\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def polylog2_2d(x, y=0.0, centerx=0.0, centery=0.0, amplitude=1.0, sigmax=1.0, sigmay=1.0):\n",
|
||
|
" ## Approximation of the polylog function with 2D gaussian as argument. -> discribes the thermal part of the cloud\n",
|
||
|
" return amplitude/1.643 * polylog_int(np.exp( -((x-centerx)**2/(2 * sigmax**2))-((y-centery)**2/( 2 * sigmay**2)) ))\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def density_profile_BEC_2d(x, y=0.0, amp_bec=1.0, amp_th=1.0, x0_bec=0.0, y0_bec=0.0, x0_th=0.0, y0_th=0.0,\n",
|
||
|
" sigmax_bec=1.0, sigmay_bec=1.0, sigma_th=1.0):\n",
|
||
|
" return ThomasFermi_2d(x=x, y=y, centerx=x0_bec, centery=y0_bec,\n",
|
||
|
" amplitude=amp_bec, sigmax=sigmax_bec, sigmay=sigmay_bec\n",
|
||
|
" ) + polylog2_2d(x=x, y=y, centerx=x0_th, centery=y0_th,\n",
|
||
|
" amplitude=amp_th, sigmax=sigma_th,sigmay=sigma_th)\n",
|
||
|
"\n",
|
||
|
"def cond_frac(results):\n",
|
||
|
" bval = results.best_values\n",
|
||
|
" tf_fit = ThomasFermi_2d(X,Y,centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'], sigmax=bval['sigmax_bec'], sigmay=bval['sigmay_bec'])\n",
|
||
|
" N_bec = np.sum(tf_fit)\n",
|
||
|
" fit = density_profile_BEC_2d(X,Y, **bval)\n",
|
||
|
" N_ges = np.sum(fit)\n",
|
||
|
" return N_bec/N_ges\n",
|
||
|
"\n",
|
||
|
"def print_bval(res_s):\n",
|
||
|
" keys = res_s.best_values.keys()\n",
|
||
|
" bval = res_s.best_values\n",
|
||
|
" init = res_s.init_params\n",
|
||
|
"\n",
|
||
|
" for item in keys:\n",
|
||
|
" print(f'{item}: {bval[item]:.3f}, (init = {init[item].value:.3f}), bounds = [{init[item].min:.2f} : {init[item].max :.2f}] ')\n",
|
||
|
" print('')\n",
|
||
|
"\n",
|
||
|
"def print_bval_bulk(res_):\n",
|
||
|
" shape = np.shape(res_)\n",
|
||
|
" if len(shape) == 2:\n",
|
||
|
" for i in range(shape[0]):\n",
|
||
|
" for j in range(shape[1]):\n",
|
||
|
" print(f'image: {i}, {j}')\n",
|
||
|
" print_bval(res_[i][j])\n",
|
||
|
"\n",
|
||
|
" if len(shape) == 1:\n",
|
||
|
" for i in range(shape[0]):\n",
|
||
|
" print(f'image: {i}')\n",
|
||
|
" print_bval(res_[i])\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:18:42.474015Z",
|
||
|
"start_time": "2023-08-01T14:18:42.094488100Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"img_dir = '//DyLabNAS/Data/'\n",
|
||
|
"SequenceName = \"Evaporative_Cooling\" + \"/\"\n",
|
||
|
"folderPath = img_dir + SequenceName + '2023/04/17'# get_date()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"shotNum = \"import\"\n",
|
||
|
"filePath = folderPath + \"/\" + shotNum + \"/*.h5\""
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T13:58:51.807115400Z",
|
||
|
"start_time": "2023-08-01T13:58:51.742005700Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"dataSet = read_hdf5_file(filePath, \"images/MOT_3D_Camera/in_situ_absorption\")\n",
|
||
|
"# flip the x and y axis\n",
|
||
|
"dataSet = swap_xy(dataSet)\n",
|
||
|
"\n",
|
||
|
"# get the scan axis name of the shot\n",
|
||
|
"scanAxis = get_scanAxis(dataSet)\n",
|
||
|
"\n",
|
||
|
"# calculate the absorption imaging\n",
|
||
|
"dataSet = imageAnalyser.get_absorption_images(dataSet)\n",
|
||
|
"\n",
|
||
|
"OD = dataSet[\"OD\"]\n",
|
||
|
"\n",
|
||
|
"OD_np = OD.to_numpy()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T13:59:04.135949400Z",
|
||
|
"start_time": "2023-08-01T13:58:54.705356600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1600x600 with 11 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABXcAAAI2CAYAAAAb9bsoAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIH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enzgwcPTp+vqKhIvv3tb+f2WU/xjW98IwHj1dXV1ZV735w5cxIgmTJlive7VhYGDBiQTny6nt/85jczyzzYE9/PfvazVMmSPhQBDySHH354ctttt+WW3xfoKd9+4hOf8Pglj2/lTyaZnvKtXsxu2bIlk281/+wP32qaiHz71hD5NvJtX/JtdXV1nG8j3/Z7vk2SnvGuLPLe97735fKuztV3//3390pXlr8bbrghvZbFu1l/ebwrz2u+i7py5N3unk+S/sG7b4c594Mf/GAJ72bxbZbeK3ybZdyNa9zIt719Pkn6B9/2FMK373vf+3LvWbt2rTfn9hQ7d+7MnHNDLFy4MB3nzs7OzPcuW7Ys9/lZs2alvBfxzsbbNi2DEOrgwYOTE088MXnggQfSncHf/OY3vSqvJ8bdIUOGJEcffXSyZMmS5LXXXkuSJEm2bduWKtGHHXZY8tvf/rbk+X/5l39J63r22Wd7u4Gvvvpq8tOf/jQ577zzSkJGP/WpTyVLlizxduDeeOONZOXKlcnEiRMTIGlqaspsT09DVvImvq6urnTCOvroo5Pvfve7yRtvvJEkSZL87ne/S/7iL/4inRR+/OMf575/yJAhyciRI5P77rsv+eMf/5gkSZJs2rQpOe2009Kxe+mll8rWsTs8++yzaShC3k7pa6+9lip
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"imageAnalyser.center = (960, 890)\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",
|
||
|
"cropOD = dataSet_cropOD.to_numpy()\n",
|
||
|
"dataSet_cropOD.plot.pcolormesh(cmap='jet', vmin=0, col=scanAxis[0], row=scanAxis[1])\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T11:21:31.909385100Z",
|
||
|
"start_time": "2023-07-31T11:21:23.490780Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[875. 961.]\n",
|
||
|
"1.3862943611198906\n",
|
||
|
"0.3848458209054287\n",
|
||
|
"[875. 961.]\n",
|
||
|
"1.0986122886681098\n",
|
||
|
"0.5059356384717989\n",
|
||
|
"[875. 961.]\n",
|
||
|
"0.916290731874155\n",
|
||
|
"0.46357273891544515\n",
|
||
|
"[876. 962.]\n",
|
||
|
"0.706570200892086\n",
|
||
|
"0.37729423114146804\n",
|
||
|
"[876. 962.]\n",
|
||
|
"0.9019019944220554\n",
|
||
|
"0.750305594399894\n",
|
||
|
"[875. 961.]\n",
|
||
|
"0.6931471805599453\n",
|
||
|
"0.3483066942682157\n",
|
||
|
"[875. 961.]\n",
|
||
|
"1.3862943611198906\n",
|
||
|
"0.5520685823000397\n",
|
||
|
"[875. 961.]\n",
|
||
|
"0.842678914530909\n",
|
||
|
"0.5671064596645803\n",
|
||
|
"[876. 962.]\n",
|
||
|
"0.706570200892086\n",
|
||
|
"0.5768873744440833\n",
|
||
|
"[876. 962.]\n",
|
||
|
"0.916290731874155\n",
|
||
|
"0.5596157879354228\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"data = OD_np\n",
|
||
|
"cut_width = 250\n",
|
||
|
"thresh = calc_thresh(data)\n",
|
||
|
"center = calc_cen_bulk(thresh)\n",
|
||
|
"\n",
|
||
|
"shape = np.shape(data)\n",
|
||
|
"cropOD = np.zeros((shape[0], shape[1], cut_width, cut_width))\n",
|
||
|
"blurred = gaussian_filter(data, sigma=1.7)\n",
|
||
|
"\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" amax = np.argmax(blurred[i,j])\n",
|
||
|
"\n",
|
||
|
" center[i,j] = np.unravel_index(amax, (shape[2], shape[3]))\n",
|
||
|
" print(center[i,j])\n",
|
||
|
" print(np.max(data[i,j]))\n",
|
||
|
" print(data[i,j, round(center[i,j,0]), round(center[i,j,1]) ])\n",
|
||
|
" cropOD[i,j] = data[i,j, round(center[i,j,0]-cut_width/2):round(center[i,j,0]+cut_width/2), round(center[i,j,1]-cut_width/2):round(center[i,j,1]+cut_width/2)]\n",
|
||
|
"\n",
|
||
|
"thresh = calc_thresh(cropOD)\n",
|
||
|
"center = calc_cen_bulk(thresh)\n",
|
||
|
"# print(center)\n",
|
||
|
"BEC_width_guess = guess_BEC_width(thresh, center)\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:03:22.189914500Z",
|
||
|
"start_time": "2023-08-01T14:03:19.142721600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 226,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[[[19. 15.]\n",
|
||
|
" [19. 18.]\n",
|
||
|
" [24. 20.]\n",
|
||
|
" [26. 23.]\n",
|
||
|
" [26. 19.]\n",
|
||
|
" [28. 23.]\n",
|
||
|
" [26. 22.]\n",
|
||
|
" [26. 25.]\n",
|
||
|
" [25. 22.]\n",
|
||
|
" [25. 20.]\n",
|
||
|
" [30. 25.]]\n",
|
||
|
"\n",
|
||
|
" [[ 5. 3.]\n",
|
||
|
" [ 9. 5.]\n",
|
||
|
" [ 7. 9.]\n",
|
||
|
" [10. 4.]\n",
|
||
|
" [15. 13.]\n",
|
||
|
" [22. 17.]\n",
|
||
|
" [15. 15.]\n",
|
||
|
" [ 7. 4.]\n",
|
||
|
" [13. 12.]\n",
|
||
|
" [19. 15.]\n",
|
||
|
" [14. 12.]]]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(BEC_width_guess)\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-27T15:03:47.737360600Z",
|
||
|
"start_time": "2023-07-27T15:03:47.628926100Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 2000x500 with 10 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABksAAAGsCAYAAAB9zZAnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9e1xV1fbwj79BhAjcIHBQFBGECBQNFQWVDBMNr0dR00zNTM3MzDz28XLMrMz0aGamZqXmLdO85PF+TTK8kKikeCMQFBQ1QEAIQXR9/xhj70Wf53m9fs/5PefyeWqP12u/Nuy11lxzjjnmmGOOq4NhGAZ2sIMd7GAHO9jBDnawgx3sYAc72MEOdrCDHexgBzvYwQ5/UHD8T3fADnawgx3sYAc72MEOdrCDHexgBzvYwQ52sIMd7GAHO9jhPwl2Y4kd7GAHO9jBDnawgx3sYAc72MEOdrCDHexgBzvYwQ52+EOD3VhiBzvYwQ52sIMd7GAHO9jBDnawgx3sYAc72MEOdrCDHf7QYDeW2MEOdrCDHexgBzvYwQ52sIMd7GAHO9jBDnawgx3sYIc/NNiNJXawgx3sYAc72MEOdrCDHexgBzvYwQ52sIMd7GAHO9jhDw12Y4kd7GAHO9jBDnawgx3sYAc72MEOdrCDHexgBzvYwQ52+EOD3VhiBzvYwQ52sIMd7GAHO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DcVgaSH0SWPBgSVV/nfrVkj5cW95diXwAvA3hAe+Y8BpB6EhN2RvOw7EV8NXToKDl5SGQPZrT8XZN4Kb0KifyJj4BDTSMeXrGAqBsSJ3A2SNjoBnpBlLL+1rqbb
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 2000x500 with 10 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABksAAAGsCAYAAAB9zZAnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAABcfklEQVR4nO3dbYxc5X03/t+6SxbRsotqZDBhjUONkSq7LFBXCN39O0RFomlUqAiNVCXgisj0RYVyp5Viv4K+wURFINRUIi8qS40lizROo0pIVUmj4hspah0RikQVYqeg3VDAxJTdFhUXh/N/Qdgsw3mcOTNzHj6f1Wh35zxd1+zM19e5fj4zM0mSJAEAAAAAANBTm6bdAAAAAAAAgGlSLAEAAAAAAHpNsQQAAAAAAOg1xRIAAAAAAKDXFEsAAAAAAIBeUywBAAAAAAB6TbEEAAAAAADoNcUSAAAAAACg1xRLAAAAAACAXqtULHn77bfjtttui507d8Y111wTN998c5w6dSoiIj7+8Y/Hxz72sVhaWoqlpaV45JFH1rc7ffp03HLLLXHVVVfFrl274vjx4/X2AmACZCDQV/IP6DMZCPSZDAT6ZLbqBvv374/f/u3fjpmZmfjKV74Sn//85+Of/umfIiLikUceidtuu+1D2xw4cCBuuOGG+Pu///s4ceJE/N7v/V68+OKLcd55543afoCJkoFAX8k/oM9kINBnMhDoi0rFkvPPPz8++clPrv9+ww03xEMPPVS43de//vX1qvOePXvisssui6eeeip+67d+60Prnj17Ns6ePbv++7vvvhtvvPFGbN68OWZmZqo0F+iRJEniv/7rv+Kyyy6LTZvG8w6DMhBo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": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, ax = plt.subplots(shape[0],shape[1], figsize=(20,5))\n",
|
||
|
"\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" ax[i,j].pcolormesh(cropOD[i,j], cmap='jet',shading='auto')\n",
|
||
|
" #ax[i,j].plot(center[i,j,0], center[i,j,1], markersize=12, marker='x')\n",
|
||
|
"plt.show()\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(shape[0],shape[1], figsize=(20,5))\n",
|
||
|
"\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" ax[i,j].pcolormesh(thresh[i,j], cmap='jet')\n",
|
||
|
"plt.show()\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:03:30.344887500Z",
|
||
|
"start_time": "2023-08-01T14:03:26.884235300Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 43,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\ipykernel_15584\\2817508691.py:91: RuntimeWarning: invalid value encountered in power\n",
|
||
|
" res = (1-(( x - x0 ) / sigma) **2) **(3/2)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 94\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.02547745\n",
|
||
|
" reduced chi-square = 1.3133e-04\n",
|
||
|
" Akaike info crit = -1781.65579\n",
|
||
|
" Bayesian info crit = -1761.86588\n",
|
||
|
" R-squared = 0.98666724\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 101.124647 +/- 0.79071563 (0.78%) (init = 101.8194)\n",
|
||
|
" x0_th: 102.711004 +/- 0.24982699 (0.24%) (init = 101.8194)\n",
|
||
|
" amp_bec: 0.03110320 +/- 0.00530709 (17.06%) (init = 0.2253557)\n",
|
||
|
" amp_th: 0.28871096 +/- 0.00350675 (1.21%) (init = 0.09658102)\n",
|
||
|
" deltax: 50.4263791 +/- 1.73159941 (3.43%) (init = 70)\n",
|
||
|
" sigma_bec: 10.3009445 +/- 1.47976427 (14.37%) (init = 23.77049)\n",
|
||
|
" sigma_th: 32.6310613 +/- 0.37432681 (1.15%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(deltax, sigma_bec) = -0.9174\n",
|
||
|
" C(amp_bec, amp_th) = -0.5988\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4403\n",
|
||
|
" C(amp_bec, deltax) = +0.2670\n",
|
||
|
" C(x0_bec, x0_th) = -0.2479\n",
|
||
|
" C(amp_th, deltax) = +0.1433\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 51\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03558549\n",
|
||
|
" reduced chi-square = 1.8343e-04\n",
|
||
|
" Akaike info crit = -1714.82692\n",
|
||
|
" Bayesian info crit = -1695.03701\n",
|
||
|
" R-squared = 0.98531277\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 100.212258 +/- 0.14784820 (0.15%) (init = 100.0973)\n",
|
||
|
" x0_th: 100.613249 +/- 0.27928393 (0.28%) (init = 100.0973)\n",
|
||
|
" amp_bec: 0.17198861 +/- 0.00693686 (4.03%) (init = 0.3243154)\n",
|
||
|
" amp_th: 0.27605495 +/- 0.00443533 (1.61%) (init = 0.1389923)\n",
|
||
|
" deltax: 42.6770155 +/- 0.77365507 (1.81%) (init = 70)\n",
|
||
|
" sigma_bec: 7.98709626 +/- 0.27695082 (3.47%) (init = 12.29508)\n",
|
||
|
" sigma_th: 27.1545389 +/- 0.41769075 (1.54%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.5892\n",
|
||
|
" C(amp_bec, amp_th) = -0.5722\n",
|
||
|
" C(amp_bec, deltax) = +0.4909\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4443\n",
|
||
|
" C(x0_bec, x0_th) = -0.2350\n",
|
||
|
" C(deltax, sigma_bec) = -0.1196\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03263910\n",
|
||
|
" reduced chi-square = 1.6824e-04\n",
|
||
|
" Akaike info crit = -1732.11231\n",
|
||
|
" Bayesian info crit = -1712.32240\n",
|
||
|
" R-squared = 0.98442486\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.1918618 +/- 0.10311539 (0.10%) (init = 98.72093)\n",
|
||
|
" x0_th: 99.4469147 +/- 0.30510339 (0.31%) (init = 98.72093)\n",
|
||
|
" amp_bec: 0.23128532 +/- 0.00695683 (3.01%) (init = 0.3316982)\n",
|
||
|
" amp_th: 0.23031989 +/- 0.00457604 (1.99%) (init = 0.1421564)\n",
|
||
|
" deltax: 37.9768886 +/- 0.84525100 (2.23%) (init = 70)\n",
|
||
|
" sigma_bec: 7.56164208 +/- 0.19393023 (2.56%) (init = 7.377049)\n",
|
||
|
" sigma_th: 24.4509861 +/- 0.45968176 (1.88%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6697\n",
|
||
|
" C(amp_bec, amp_th) = -0.5913\n",
|
||
|
" C(amp_bec, deltax) = +0.4948\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4477\n",
|
||
|
" C(x0_bec, x0_th) = -0.2481\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 43\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03426857\n",
|
||
|
" reduced chi-square = 1.7664e-04\n",
|
||
|
" Akaike info crit = -1722.36882\n",
|
||
|
" Bayesian info crit = -1702.57892\n",
|
||
|
" R-squared = 0.98184582\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 98.1322103 +/- 0.11092152 (0.11%) (init = 97.92982)\n",
|
||
|
" x0_th: 99.4774933 +/- 0.34268907 (0.34%) (init = 97.92982)\n",
|
||
|
" amp_bec: 0.23569270 +/- 0.00749401 (3.18%) (init = 0.3080213)\n",
|
||
|
" amp_th: 0.20433844 +/- 0.00557015 (2.73%) (init = 0.1320091)\n",
|
||
|
" deltax: 31.8076800 +/- 0.96163189 (3.02%) (init = 70)\n",
|
||
|
" sigma_bec: 8.28907651 +/- 0.20848009 (2.52%) (init = 7.377049)\n",
|
||
|
" sigma_th: 21.7150746 +/- 0.52551865 (2.42%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6978\n",
|
||
|
" C(amp_bec, amp_th) = -0.6787\n",
|
||
|
" C(amp_bec, deltax) = +0.5549\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4786\n",
|
||
|
" C(x0_bec, x0_th) = -0.3105\n",
|
||
|
" C(x0_th, amp_bec) = +0.1248\n",
|
||
|
" C(x0_th, amp_th) = -0.1135\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 78\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.06101663\n",
|
||
|
" reduced chi-square = 3.1452e-04\n",
|
||
|
" Akaike info crit = -1606.98525\n",
|
||
|
" Bayesian info crit = -1587.19534\n",
|
||
|
" R-squared = 0.98228418\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 100.367517 +/- 0.08259950 (0.08%) (init = 99.8617)\n",
|
||
|
" x0_th: 102.252499 +/- 0.39681117 (0.39%) (init = 99.8617)\n",
|
||
|
" amp_bec: 0.45283805 +/- 0.01437236 (3.17%) (init = 0.4733184)\n",
|
||
|
" amp_th: 0.21226194 +/- 0.01322887 (6.23%) (init = 0.2028507)\n",
|
||
|
" deltax: 16.6747948 +/- 1.14121471 (6.84%) (init = 70)\n",
|
||
|
" sigma_bec: 7.79102040 +/- 0.15115365 (1.94%) (init = 8.196721)\n",
|
||
|
" sigma_th: 13.5614686 +/- 0.62177649 (4.58%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.8435\n",
|
||
|
" C(amp_th, deltax) = -0.7880\n",
|
||
|
" C(amp_bec, deltax) = +0.6885\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5636\n",
|
||
|
" C(x0_bec, x0_th) = -0.4165\n",
|
||
|
" C(x0_th, amp_bec) = +0.3364\n",
|
||
|
" C(x0_th, amp_th) = -0.2753\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.2751\n",
|
||
|
" C(deltax, sigma_bec) = +0.2481\n",
|
||
|
" C(x0_bec, deltax) = +0.2081\n",
|
||
|
" C(x0_th, deltax) = +0.1708\n",
|
||
|
" C(x0_bec, amp_th) = -0.1648\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1635\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 113\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.02600358\n",
|
||
|
" reduced chi-square = 1.3404e-04\n",
|
||
|
" Akaike info crit = -1777.56765\n",
|
||
|
" Bayesian info crit = -1757.77775\n",
|
||
|
" R-squared = 0.98775463\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 117.605583 +/- 1.84230729 (1.57%) (init = 101.4468)\n",
|
||
|
" x0_th: 100.760389 +/- 0.39898453 (0.40%) (init = 101.4468)\n",
|
||
|
" amp_bec: 0.02307738 +/- 0.00557250 (24.15%) (init = 0.2281153)\n",
|
||
|
" amp_th: 0.30582941 +/- 0.00462296 (1.51%) (init = 0.0977637)\n",
|
||
|
" deltax: 36.3480965 +/- 4.00611948 (11.02%) (init = 70)\n",
|
||
|
" sigma_bec: 21.2886122 +/- 3.35779527 (15.77%) (init = 29.5082)\n",
|
||
|
" sigma_th: 32.2827169 +/- 0.35246280 (1.09%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(deltax, sigma_bec) = -0.9861\n",
|
||
|
" C(x0_th, amp_bec) = -0.7647\n",
|
||
|
" C(amp_bec, amp_th) = -0.7386\n",
|
||
|
" C(x0_th, amp_th) = +0.6257\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5995\n",
|
||
|
" C(amp_th, deltax) = +0.5101\n",
|
||
|
" C(x0_th, sigma_bec) = -0.4952\n",
|
||
|
" C(x0_th, deltax) = +0.4810\n",
|
||
|
" C(x0_bec, amp_th) = +0.4187\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.3259\n",
|
||
|
" C(amp_bec, deltax) = -0.2933\n",
|
||
|
" C(x0_bec, sigma_bec) = -0.1676\n",
|
||
|
" C(x0_bec, amp_bec) = -0.1513\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 65\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03796787\n",
|
||
|
" reduced chi-square = 1.9571e-04\n",
|
||
|
" Akaike info crit = -1701.86650\n",
|
||
|
" Bayesian info crit = -1682.07659\n",
|
||
|
" R-squared = 0.98342267\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.6392368 +/- 0.18357929 (0.18%) (init = 99.63265)\n",
|
||
|
" x0_th: 100.417176 +/- 0.27776134 (0.28%) (init = 99.63265)\n",
|
||
|
" amp_bec: 0.13767284 +/- 0.00733007 (5.32%) (init = 0.3014446)\n",
|
||
|
" amp_th: 0.28131017 +/- 0.00459721 (1.63%) (init = 0.1291905)\n",
|
||
|
" deltax: 41.4699041 +/- 0.78035414 (1.88%) (init = 70)\n",
|
||
|
" sigma_bec: 7.45495653 +/- 0.34274281 (4.60%) (init = 10.65574)\n",
|
||
|
" sigma_th: 26.1929428 +/- 0.41287001 (1.58%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.5594\n",
|
||
|
" C(amp_th, deltax) = -0.5267\n",
|
||
|
" C(amp_bec, deltax) = +0.4832\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4416\n",
|
||
|
" C(deltax, sigma_bec) = -0.2276\n",
|
||
|
" C(x0_bec, x0_th) = -0.2253\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 64\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04751327\n",
|
||
|
" reduced chi-square = 2.4491e-04\n",
|
||
|
" Akaike info crit = -1657.01274\n",
|
||
|
" Bayesian info crit = -1637.22283\n",
|
||
|
" R-squared = 0.98002766\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.5850923 +/- 0.10908572 (0.11%) (init = 99.13918)\n",
|
||
|
" x0_th: 100.444273 +/- 0.36500118 (0.36%) (init = 99.13918)\n",
|
||
|
" amp_bec: 0.26299997 +/- 0.00825821 (3.14%) (init = 0.352122)\n",
|
||
|
" amp_th: 0.23693805 +/- 0.00531433 (2.24%) (init = 0.1509094)\n",
|
||
|
" deltax: 39.8361886 +/- 1.00607476 (2.53%) (init = 70)\n",
|
||
|
" sigma_bec: 7.62911099 +/- 0.20319081 (2.66%) (init = 9.016393)\n",
|
||
|
" sigma_th: 25.4567439 +/- 0.54512266 (2.14%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6783\n",
|
||
|
" C(amp_bec, amp_th) = -0.5805\n",
|
||
|
" C(amp_bec, deltax) = +0.4805\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4397\n",
|
||
|
" C(x0_bec, x0_th) = -0.2370\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04531517\n",
|
||
|
" reduced chi-square = 2.3358e-04\n",
|
||
|
" Akaike info crit = -1666.48617\n",
|
||
|
" Bayesian info crit = -1646.69626\n",
|
||
|
" R-squared = 0.97443891\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.6356695 +/- 0.12340247 (0.12%) (init = 98.87047)\n",
|
||
|
" x0_th: 99.7343179 +/- 0.38022916 (0.38%) (init = 98.87047)\n",
|
||
|
" amp_bec: 0.22842555 +/- 0.00866289 (3.79%) (init = 0.3240541)\n",
|
||
|
" amp_th: 0.20700460 +/- 0.00620962 (3.00%) (init = 0.1388803)\n",
|
||
|
" deltax: 32.3995231 +/- 1.06874338 (3.30%) (init = 70)\n",
|
||
|
" sigma_bec: 7.48523838 +/- 0.23274658 (3.11%) (init = 6.557377)\n",
|
||
|
" sigma_th: 21.5136236 +/- 0.58585189 (2.72%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6911\n",
|
||
|
" C(amp_bec, amp_th) = -0.6447\n",
|
||
|
" C(amp_bec, deltax) = +0.5326\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4885\n",
|
||
|
" C(x0_bec, x0_th) = -0.2939\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 50\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.05567171\n",
|
||
|
" reduced chi-square = 2.8697e-04\n",
|
||
|
" Akaike info crit = -1625.32009\n",
|
||
|
" Bayesian info crit = -1605.53019\n",
|
||
|
" R-squared = 0.97892132\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 100.548635 +/- 0.09308962 (0.09%) (init = 100.0176)\n",
|
||
|
" x0_th: 102.267967 +/- 0.39603164 (0.39%) (init = 100.0176)\n",
|
||
|
" amp_bec: 0.35611272 +/- 0.01122725 (3.15%) (init = 0.3972421)\n",
|
||
|
" amp_th: 0.20822200 +/- 0.00932906 (4.48%) (init = 0.1702466)\n",
|
||
|
" deltax: 22.8802225 +/- 1.12445938 (4.91%) (init = 70)\n",
|
||
|
" sigma_bec: 7.69352924 +/- 0.17453799 (2.27%) (init = 9.016393)\n",
|
||
|
" sigma_th: 16.7142657 +/- 0.61358538 (3.67%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.7591\n",
|
||
|
" C(amp_th, deltax) = -0.7491\n",
|
||
|
" C(amp_bec, deltax) = +0.6139\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5303\n",
|
||
|
" C(x0_bec, x0_th) = -0.3668\n",
|
||
|
" C(x0_th, amp_bec) = +0.2320\n",
|
||
|
" C(x0_th, amp_th) = -0.1995\n",
|
||
|
" C(deltax, sigma_bec) = +0.1949\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.1502\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1339\n",
|
||
|
" C(x0_th, deltax) = +0.1174\n",
|
||
|
" C(x0_bec, deltax) = +0.1151\n",
|
||
|
"\n",
|
||
|
"total time: 317.14844703674316 ms\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# from opencv import moments\n",
|
||
|
"start = time.time()\n",
|
||
|
"shape = np.shape(cropOD)\n",
|
||
|
"sigma = 0.4\n",
|
||
|
"blurred = gaussian_filter(cropOD, sigma=sigma)\n",
|
||
|
"\n",
|
||
|
"thresh = np.zeros(shape)\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" thresh[i,j] = np.where(blurred[i,j] < np.max(blurred[i,j])*0.5,0,1)\n",
|
||
|
"\n",
|
||
|
"center = calc_cen_bulk(thresh)\n",
|
||
|
"\n",
|
||
|
"BEC_width_guess = guess_BEC_width(thresh, center)\n",
|
||
|
"\n",
|
||
|
"X_guess_og = np.zeros((shape[0], shape[1], shape[3]))\n",
|
||
|
"# Y_guess_og = np.zeros((shape[0], shape[1], shape[2]))\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" X_guess_og[i,j] = np.sum(cropOD[i,j,round(center[i,j,1] - BEC_width_guess[i,j,1]/2) : round(center[i,j,1] + BEC_width_guess[i,j,1]/2) , :], 0) / len(cropOD[i,j,round(center[i,j,1] - BEC_width_guess[i,j,1]/2) : round(center[i,j,1] + BEC_width_guess[i,j,1]/2),0])\n",
|
||
|
"\n",
|
||
|
" # Y_guess_og[i,j] = np.sum(cropOD[i,j, :, round(center[i,j,0] - BEC_width_guess[i,j,0]/2) : round(center[i,j,0] + BEC_width_guess[i,j,0]/2)], 1) / len(cropOD[i,j,0,round(center[i,j,0] - BEC_width_guess[i,j,0]/2) : round(center[i,j,0] + BEC_width_guess[i,j,0]/2)])\n",
|
||
|
"\n",
|
||
|
"#[nr images x, nr images y, X / Y, center / sigma]\n",
|
||
|
"x = np.linspace(0,shape[3],shape[3])\n",
|
||
|
"y = np.linspace(0,shape[2], shape[2])\n",
|
||
|
"\n",
|
||
|
"popt = np.zeros((shape[0], shape[1], 6))\n",
|
||
|
"\n",
|
||
|
"p0 = np.ones((shape[0], shape[1], 6))\n",
|
||
|
"\n",
|
||
|
"max = np.zeros((shape[0], shape[1]))\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" max[i] = np.ndarray.max(X_guess_og[i],axis=1)\n",
|
||
|
"\n",
|
||
|
"# Fitting x without math constr\n",
|
||
|
"fitmodel = lmfit.Model(density_1d,independent_vars=['x'])\n",
|
||
|
"\n",
|
||
|
"result_x = []\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" temp_res = []\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" t1 = time.time()\n",
|
||
|
" params = lmfit.Parameters()\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('x0_bec', center[i,j,0], True,0, 200),\n",
|
||
|
" ('x0_th',center[i,j,0], True,0, 200),\n",
|
||
|
" ('amp_bec', 0.7 * max[i,j], True, 0, 1.3 * np.max(X_guess_og[i,j])),\n",
|
||
|
" ('amp_th', 0.3 * max[i,j], True, 0, 1.3 * np.max(X_guess_og[i,j])),\n",
|
||
|
" ('deltax', 70, True, 0,150),\n",
|
||
|
" ('sigma_bec',BEC_width_guess[i,j,0]/1.22, True, 0, 50)\n",
|
||
|
" )\n",
|
||
|
" params.add('sigma_th', 3*BEC_width_guess[i,j,0], min=0, expr=f'0.632*sigma_bec + 0.518*deltax')\n",
|
||
|
"\n",
|
||
|
" # params.add('sigma_th', 3*BEC_width_guess[i,j,0], True, min=0,max=150)\n",
|
||
|
" t2 = time.time()\n",
|
||
|
" res = fitmodel.fit(X_guess_og[i,j], x=x, params=params)\n",
|
||
|
" t3 = time.time()\n",
|
||
|
" temp_res.append(res)\n",
|
||
|
" t4 = time.time()\n",
|
||
|
" # print(t2 - t1)\n",
|
||
|
" # print(t3 - t2)\n",
|
||
|
" # print(t4 - t3)\n",
|
||
|
" # print(\"\")\n",
|
||
|
" lmfit.report_fit(res)\n",
|
||
|
"\n",
|
||
|
" print()\n",
|
||
|
" result_x.append(temp_res)\n",
|
||
|
"stop = time.time()\n",
|
||
|
"\n",
|
||
|
"print(f'total time: {(stop-start)*1e3} ms')"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T11:40:34.358010300Z",
|
||
|
"start_time": "2023-07-31T11:40:33.866807300Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\ipykernel_30284\\141522514.py:91: RuntimeWarning: invalid value encountered in power\n",
|
||
|
" res = (1-(( x - x0 ) / sigma) **2) **(3/2)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 143\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.02046362\n",
|
||
|
" reduced chi-square = 8.3867e-05\n",
|
||
|
" Akaike info crit = -2340.64189\n",
|
||
|
" Bayesian info crit = -2319.51313\n",
|
||
|
" R-squared = 0.98804264\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 118.969515 +/- 1.9798e+10 (16640885617.16%) (init = 125.2444)\n",
|
||
|
" x0_th: 126.291765 +/- 0.46890175 (0.37%) (init = 125.2444)\n",
|
||
|
" amp_bec: 5.0309e-13 +/- 0.00535605 (1064634965786.03%) (init = 0.1857203)\n",
|
||
|
" amp_th: 0.25828629 +/- 0.01294854 (5.01%) (init = 0.0795944)\n",
|
||
|
" deltax: 1.67647827 +/- 152948.188 (9123183.47%) (init = 183)\n",
|
||
|
" sigma_bec: 49.9995295 +/- 8259069.00 (16518293.43%) (init = 50)\n",
|
||
|
" sigma_th: 32.4681184 +/- 5298958.79 (16320498.53%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(deltax, sigma_bec) = +1.0000\n",
|
||
|
" C(amp_bec, amp_th) = +0.9874\n",
|
||
|
" C(x0_th, amp_bec) = -0.8663\n",
|
||
|
" C(x0_th, amp_th) = -0.8518\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.4070\n",
|
||
|
" C(amp_bec, deltax) = +0.4070\n",
|
||
|
" C(x0_th, sigma_bec) = -0.3466\n",
|
||
|
" C(x0_th, deltax) = -0.3466\n",
|
||
|
" C(amp_th, sigma_bec) = +0.3335\n",
|
||
|
" C(amp_th, deltax) = +0.3335\n",
|
||
|
" C(x0_bec, x0_th) = -0.2184\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 107\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.02379560\n",
|
||
|
" reduced chi-square = 9.7523e-05\n",
|
||
|
" Akaike info crit = -2302.92888\n",
|
||
|
" Bayesian info crit = -2281.80012\n",
|
||
|
" R-squared = 0.98746106\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 124.102991 +/- 0.17630481 (0.14%) (init = 124.3687)\n",
|
||
|
" x0_th: 124.635809 +/- 0.22674888 (0.18%) (init = 124.3687)\n",
|
||
|
" amp_bec: 0.10230528 +/- 0.00511417 (5.00%) (init = 0.2449757)\n",
|
||
|
" amp_th: 0.24670886 +/- 0.00310912 (1.26%) (init = 0.1049896)\n",
|
||
|
" deltax: 43.3496466 +/- 0.65892469 (1.52%) (init = 114)\n",
|
||
|
" sigma_bec: 7.53889215 +/- 0.33126562 (4.39%) (init = 31.14754)\n",
|
||
|
" sigma_th: 27.2196968 +/- 0.33523134 (1.23%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.5451\n",
|
||
|
" C(amp_bec, deltax) = +0.4833\n",
|
||
|
" C(amp_th, deltax) = -0.4735\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4155\n",
|
||
|
" C(deltax, sigma_bec) = -0.3355\n",
|
||
|
" C(x0_bec, x0_th) = -0.2113\n",
|
||
|
" C(amp_bec, sigma_bec) = -0.1365\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 78\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.02855995\n",
|
||
|
" reduced chi-square = 1.1705e-04\n",
|
||
|
" Akaike info crit = -2257.30273\n",
|
||
|
" Bayesian info crit = -2236.17397\n",
|
||
|
" R-squared = 0.98458722\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 125.183186 +/- 0.10809287 (0.09%) (init = 125.0292)\n",
|
||
|
" x0_th: 125.593427 +/- 0.26291811 (0.21%) (init = 125.0292)\n",
|
||
|
" amp_bec: 0.18259048 +/- 0.00586579 (3.21%) (init = 0.2788634)\n",
|
||
|
" amp_th: 0.22031642 +/- 0.00387218 (1.76%) (init = 0.1195129)\n",
|
||
|
" deltax: 37.0211023 +/- 0.72778295 (1.97%) (init = 84)\n",
|
||
|
" sigma_bec: 7.42225741 +/- 0.20409097 (2.75%) (init = 22.95082)\n",
|
||
|
" sigma_th: 23.8677977 +/- 0.39626497 (1.66%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6428\n",
|
||
|
" C(amp_bec, amp_th) = -0.5921\n",
|
||
|
" C(amp_bec, deltax) = +0.5008\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4495\n",
|
||
|
" C(x0_bec, x0_th) = -0.2494\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 3\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 85\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03198083\n",
|
||
|
" reduced chi-square = 1.3107e-04\n",
|
||
|
" Akaike info crit = -2229.01991\n",
|
||
|
" Bayesian info crit = -2207.89114\n",
|
||
|
" R-squared = 0.98037328\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 123.136221 +/- 0.11814214 (0.10%) (init = 123.438)\n",
|
||
|
" x0_th: 124.617766 +/- 0.30979342 (0.25%) (init = 123.438)\n",
|
||
|
" amp_bec: 0.18750833 +/- 0.00636413 (3.39%) (init = 0.2690883)\n",
|
||
|
" amp_th: 0.19630744 +/- 0.00464469 (2.37%) (init = 0.1153236)\n",
|
||
|
" deltax: 32.9999725 +/- 0.86043579 (2.61%) (init = 63)\n",
|
||
|
" sigma_bec: 8.14335191 +/- 0.22218028 (2.73%) (init = 17.21311)\n",
|
||
|
" sigma_th: 22.2405842 +/- 0.47201439 (2.12%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6705\n",
|
||
|
" C(amp_bec, amp_th) = -0.6617\n",
|
||
|
" C(amp_bec, deltax) = +0.5411\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4828\n",
|
||
|
" C(x0_bec, x0_th) = -0.2977\n",
|
||
|
" C(x0_th, amp_bec) = +0.1288\n",
|
||
|
" C(x0_th, amp_th) = -0.1174\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 4\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 64\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.05487637\n",
|
||
|
" reduced chi-square = 2.2490e-04\n",
|
||
|
" Akaike info crit = -2094.03332\n",
|
||
|
" Bayesian info crit = -2072.90455\n",
|
||
|
" R-squared = 0.97990259\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 125.437069 +/- 0.07853394 (0.06%) (init = 125.3496)\n",
|
||
|
" x0_th: 127.166144 +/- 0.39753185 (0.31%) (init = 125.3496)\n",
|
||
|
" amp_bec: 0.39898058 +/- 0.01165945 (2.92%) (init = 0.4155771)\n",
|
||
|
" amp_th: 0.17879507 +/- 0.01053873 (5.89%) (init = 0.1781045)\n",
|
||
|
" deltax: 17.6761229 +/- 1.15472056 (6.53%) (init = 45)\n",
|
||
|
" sigma_bec: 7.86397815 +/- 0.14425228 (1.83%) (init = 12.29508)\n",
|
||
|
" sigma_th: 14.1262658 +/- 0.62636465 (4.43%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.8321\n",
|
||
|
" C(amp_th, deltax) = -0.7877\n",
|
||
|
" C(amp_bec, deltax) = +0.6817\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5456\n",
|
||
|
" C(x0_bec, x0_th) = -0.4202\n",
|
||
|
" C(x0_th, amp_bec) = +0.2985\n",
|
||
|
" C(x0_th, amp_th) = -0.2469\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.2413\n",
|
||
|
" C(deltax, sigma_bec) = +0.2406\n",
|
||
|
" C(x0_bec, deltax) = +0.1730\n",
|
||
|
" C(x0_th, deltax) = +0.1542\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1471\n",
|
||
|
" C(x0_bec, amp_th) = -0.1332\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 145\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.01357162\n",
|
||
|
" reduced chi-square = 5.5621e-05\n",
|
||
|
" Akaike info crit = -2443.30890\n",
|
||
|
" Bayesian info crit = -2422.18014\n",
|
||
|
" R-squared = 0.99213486\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 141.980857 +/- 2.43599848 (1.72%) (init = 124.94)\n",
|
||
|
" x0_th: 125.812254 +/- 0.34610895 (0.28%) (init = 124.94)\n",
|
||
|
" amp_bec: 0.01340870 +/- 0.00410283 (30.60%) (init = 0.1823071)\n",
|
||
|
" amp_th: 0.25139708 +/- 0.00370473 (1.47%) (init = 0.07813161)\n",
|
||
|
" deltax: 33.1360950 +/- 4.95259194 (14.95%) (init = 210)\n",
|
||
|
" sigma_bec: 24.7716948 +/- 4.17307378 (16.85%) (init = 50)\n",
|
||
|
" sigma_th: 32.8202083 +/- 0.30767404 (0.94%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(deltax, sigma_bec) = -0.9934\n",
|
||
|
" C(amp_bec, amp_th) = -0.8258\n",
|
||
|
" C(x0_th, amp_bec) = -0.8111\n",
|
||
|
" C(x0_th, amp_th) = +0.6701\n",
|
||
|
" C(amp_th, sigma_bec) = -0.6408\n",
|
||
|
" C(amp_th, deltax) = +0.5789\n",
|
||
|
" C(x0_th, sigma_bec) = -0.5011\n",
|
||
|
" C(x0_th, deltax) = +0.4893\n",
|
||
|
" C(x0_bec, amp_th) = +0.4668\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.4307\n",
|
||
|
" C(amp_bec, deltax) = -0.3984\n",
|
||
|
" C(x0_bec, sigma_bec) = -0.2154\n",
|
||
|
" C(x0_bec, amp_bec) = -0.2125\n",
|
||
|
" C(x0_bec, deltax) = +0.1484\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 80\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03407079\n",
|
||
|
" reduced chi-square = 1.3963e-04\n",
|
||
|
" Akaike info crit = -2213.19391\n",
|
||
|
" Bayesian info crit = -2192.06515\n",
|
||
|
" R-squared = 0.98320626\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 124.539710 +/- 0.23579865 (0.19%) (init = 124.5766)\n",
|
||
|
" x0_th: 125.101779 +/- 0.25466467 (0.20%) (init = 124.5766)\n",
|
||
|
" amp_bec: 0.09094370 +/- 0.00619316 (6.81%) (init = 0.2455857)\n",
|
||
|
" amp_th: 0.25828614 +/- 0.00391761 (1.52%) (init = 0.105251)\n",
|
||
|
" deltax: 41.0719061 +/- 0.76640562 (1.87%) (init = 108)\n",
|
||
|
" sigma_bec: 7.53580971 +/- 0.43882438 (5.82%) (init = 29.5082)\n",
|
||
|
" sigma_th: 26.0378791 +/- 0.37974263 (1.46%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.5675\n",
|
||
|
" C(amp_bec, deltax) = +0.4752\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4406\n",
|
||
|
" C(deltax, sigma_bec) = -0.4102\n",
|
||
|
" C(amp_th, deltax) = -0.4089\n",
|
||
|
" C(x0_bec, x0_th) = -0.2296\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03992012\n",
|
||
|
" reduced chi-square = 1.6361e-04\n",
|
||
|
" Akaike info crit = -2173.58391\n",
|
||
|
" Bayesian info crit = -2152.45515\n",
|
||
|
" R-squared = 0.98170832\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 125.671131 +/- 0.10728573 (0.09%) (init = 125.4114)\n",
|
||
|
" x0_th: 126.551089 +/- 0.30855469 (0.24%) (init = 125.4114)\n",
|
||
|
" amp_bec: 0.21804959 +/- 0.00677440 (3.11%) (init = 0.316436)\n",
|
||
|
" amp_th: 0.22801736 +/- 0.00437620 (1.92%) (init = 0.1356154)\n",
|
||
|
" deltax: 39.4015337 +/- 0.84855618 (2.15%) (init = 63)\n",
|
||
|
" sigma_bec: 7.58235403 +/- 0.20031392 (2.64%) (init = 17.21311)\n",
|
||
|
" sigma_th: 25.2020422 +/- 0.46096462 (1.83%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6618\n",
|
||
|
" C(amp_bec, amp_th) = -0.5814\n",
|
||
|
" C(amp_bec, deltax) = +0.4857\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4429\n",
|
||
|
" C(x0_bec, x0_th) = -0.2390\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 3\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 92\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04259267\n",
|
||
|
" reduced chi-square = 1.7456e-04\n",
|
||
|
" Akaike info crit = -2157.38350\n",
|
||
|
" Bayesian info crit = -2136.25473\n",
|
||
|
" R-squared = 0.97345327\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 124.548630 +/- 0.12302562 (0.10%) (init = 124.4211)\n",
|
||
|
" x0_th: 124.867634 +/- 0.34241704 (0.27%) (init = 124.4211)\n",
|
||
|
" amp_bec: 0.19465845 +/- 0.00744247 (3.82%) (init = 0.2883304)\n",
|
||
|
" amp_th: 0.19908971 +/- 0.00522647 (2.63%) (init = 0.1235702)\n",
|
||
|
" deltax: 33.2106499 +/- 0.95386489 (2.87%) (init = 72)\n",
|
||
|
" sigma_bec: 7.24444398 +/- 0.23450025 (3.24%) (init = 19.67213)\n",
|
||
|
" sigma_th: 21.7816053 +/- 0.52460231 (2.41%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.6711\n",
|
||
|
" C(amp_bec, amp_th) = -0.6225\n",
|
||
|
" C(amp_bec, deltax) = +0.5184\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4918\n",
|
||
|
" C(x0_bec, x0_th) = -0.2805\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 4\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 50\n",
|
||
|
" # data points = 250\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.05280479\n",
|
||
|
" reduced chi-square = 2.1641e-04\n",
|
||
|
" Akaike info crit = -2103.65357\n",
|
||
|
" Bayesian info crit = -2082.52480\n",
|
||
|
" R-squared = 0.97611358\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 125.550350 +/- 0.09146206 (0.07%) (init = 125.3887)\n",
|
||
|
" x0_th: 127.196908 +/- 0.37774559 (0.30%) (init = 125.3887)\n",
|
||
|
" amp_bec: 0.31158831 +/- 0.00960934 (3.08%) (init = 0.3444)\n",
|
||
|
" amp_th: 0.18968669 +/- 0.00790889 (4.17%) (init = 0.1476)\n",
|
||
|
" deltax: 23.5195069 +/- 1.07252976 (4.56%) (init = 51)\n",
|
||
|
" sigma_bec: 7.63218924 +/- 0.17190803 (2.25%) (init = 13.93443)\n",
|
||
|
" sigma_th: 17.0066482 +/- 0.58611511 (3.45%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.7499\n",
|
||
|
" C(amp_th, deltax) = -0.7447\n",
|
||
|
" C(amp_bec, deltax) = +0.6070\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5314\n",
|
||
|
" C(x0_bec, x0_th) = -0.3625\n",
|
||
|
" C(x0_th, amp_bec) = +0.2159\n",
|
||
|
" C(deltax, sigma_bec) = +0.1911\n",
|
||
|
" C(x0_th, amp_th) = -0.1864\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.1423\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1273\n",
|
||
|
" C(x0_th, deltax) = +0.1089\n",
|
||
|
" C(x0_bec, deltax) = +0.1061\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"total time: 419.1107749938965 ms\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# from opencv import moments\n",
|
||
|
"start = time.time()\n",
|
||
|
"\n",
|
||
|
"shape = np.shape(cropOD)\n",
|
||
|
"thresh = calc_thresh(cropOD)\n",
|
||
|
"center = calc_cen_bulk(thresh)\n",
|
||
|
"# print(center)\n",
|
||
|
"BEC_width_guess = guess_BEC_width(thresh, center)\n",
|
||
|
"\n",
|
||
|
"X_guess_og = np.zeros((shape[0], shape[1], shape[3]))\n",
|
||
|
"# Y_guess_og = np.zeros((shape[0], shape[1], shape[2]))\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" X_guess_og[i,j] = np.sum(cropOD[i,j,round(center[i,j,1] - BEC_width_guess[i,j,1]/2) : round(center[i,j,1] + BEC_width_guess[i,j,1]/2) , :], 0) / len(cropOD[i,j,round(center[i,j,1] - BEC_width_guess[i,j,1]/2) : round(center[i,j,1] + BEC_width_guess[i,j,1]/2),0])\n",
|
||
|
"\n",
|
||
|
" # Y_guess_og[i,j] = np.sum(cropOD[i,j, :, round(center[i,j,0] - BEC_width_guess[i,j,0]/2) : round(center[i,j,0] + BEC_width_guess[i,j,0]/2)], 1) / len(cropOD[i,j,0,round(center[i,j,0] - BEC_width_guess[i,j,0]/2) : round(center[i,j,0] + BEC_width_guess[i,j,0]/2)])\n",
|
||
|
"\n",
|
||
|
"#[nr images x, nr images y, X / Y, center / sigma]\n",
|
||
|
"x = np.linspace(0,shape[3],shape[3])\n",
|
||
|
"y = np.linspace(0,shape[2], shape[2])\n",
|
||
|
"\n",
|
||
|
"popt = np.zeros((shape[0], shape[1], 6))\n",
|
||
|
"\n",
|
||
|
"p0 = np.ones((shape[0], shape[1], 6))\n",
|
||
|
"\n",
|
||
|
"max_val = np.zeros((shape[0], shape[1]))\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" max_val[i] = np.ndarray.max(X_guess_og[i], axis=1)\n",
|
||
|
"\n",
|
||
|
"# Fitting x without math constr\n",
|
||
|
"fitmodel = lmfit.Model(density_1d,independent_vars=['x'])\n",
|
||
|
"\n",
|
||
|
"result_x = []\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" temp_res = []\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" t1 = time.time()\n",
|
||
|
" params = lmfit.Parameters()\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('x0_bec', center[i,j,0], True,0, 200),\n",
|
||
|
" ('x0_th',center[i,j,0], True,0, 200),\n",
|
||
|
" ('amp_bec', 0.7 * max_val[i,j], True, 0, 1.3 * np.max(X_guess_og[i,j])),\n",
|
||
|
" ('amp_th', 0.3 * max_val[i,j], True, 0, 1.3 * np.max(X_guess_og[i,j])),\n",
|
||
|
" ('deltax', 3*BEC_width_guess[i,j,0], True, 0,cut_width),\n",
|
||
|
" # ('sigma_bec',BEC_width_guess[i,j,0]/1.22, True, 0, 50)\n",
|
||
|
" ('sigma_bec',BEC_width_guess[i,j,0]/1.22, True, 0, 50)\n",
|
||
|
" )\n",
|
||
|
" params.add('sigma_th', 3*BEC_width_guess[i,j,0], min=0, expr=f'0.632*sigma_bec + 0.518*deltax')\n",
|
||
|
"\n",
|
||
|
" # params.add('sigma_th', 3*BEC_width_guess[i,j,0], True, min=0,max=150)\n",
|
||
|
" t2 = time.time()\n",
|
||
|
" res = fitmodel.fit(X_guess_og[i,j], x=x, params=params)\n",
|
||
|
" t3 = time.time()\n",
|
||
|
" temp_res.append(res)\n",
|
||
|
" t4 = time.time()\n",
|
||
|
" # print(t2 - t1)\n",
|
||
|
" # print(t3 - t2)\n",
|
||
|
" # print(t4 - t3)\n",
|
||
|
" # print(\"\")\n",
|
||
|
" print(f'image {i}, {j}')\n",
|
||
|
" lmfit.report_fit(res)\n",
|
||
|
" print()\n",
|
||
|
"\n",
|
||
|
" print()\n",
|
||
|
" result_x.append(temp_res)\n",
|
||
|
"stop = time.time()\n",
|
||
|
"\n",
|
||
|
"print(f'total time: {(stop-start)*1e3} ms')"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:05:13.963843900Z",
|
||
|
"start_time": "2023-08-01T14:05:13.506865400Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "NameError",
|
||
|
"evalue": "name 'shape' is not defined",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
|
||
|
"\u001B[1;31mNameError\u001B[0m Traceback (most recent call last)",
|
||
|
"Cell \u001B[1;32mIn[1], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m i \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mrange\u001B[39m(\u001B[38;5;241m0\u001B[39m, \u001B[43mshape\u001B[49m[\u001B[38;5;241m0\u001B[39m]):\n\u001B[0;32m 2\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m j \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mrange\u001B[39m(\u001B[38;5;241m0\u001B[39m, shape[\u001B[38;5;241m1\u001B[39m]):\n\u001B[0;32m 3\u001B[0m \u001B[38;5;28mprint\u001B[39m(result_x[i][j]\u001B[38;5;241m.\u001B[39mbest_values)\n",
|
||
|
"\u001B[1;31mNameError\u001B[0m: name 'shape' is not defined"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" print(result_x[i][j].best_values)"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T13:02:43.356422900Z",
|
||
|
"start_time": "2023-08-01T13:02:43.051468800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1000x500 with 10 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAz0AAAGqCAYAAAAhlCqnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tY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z3LzAkE4sXZydMy+tj5GCjoTVvW21tZWrrrqKu677z4WLFgAQHZ2NsePH2fr1q188sknrF+/nv/93//t8fOiR0VX7G4fTTYttD4n5QzuWjIJk14mzZ4BgMFWzNOfl/R1CIFgSHjsWiqHX5UoUzO1jc7m6BkkiDlcjhZkSYtoH1dTAfA7mqJpkiCG8DmaAWhSNbF+v0Ossgsij9HfIVlt9gunZ6AMyunJy8ujurq63wZ8AG1tbSxdupSrr76ae++9N7TdZDKRkaFN0lNSUvj3f//3Lr0rOiM68XbF56rmmFF72N96yfeRJIlkq5E2x3QA6iytJFoM0TRRMMbxtWmpHC3YQg994fQIIklLs1Y47lF1uA1JAPhc9ihaJIgllECkp0bV1FL9rthOuxdEB4vS4fRYhdMzYAbl9GRkZDB//nxefPFFgF4b8NntdpYuXcrSpUt58MEHu+yrq6vD69X6erjdbtasWcO8efOG8h1ihmT1S1RJIs8PaekzAEiyGihpPxtJVak2ymQZRaM+QfjwBVbUW1UbLYG2pH6nWGUXRI62Zs3xbpdseHRWAPyu9r4+IhAMG5Jbc3KqAlFGe2tzFK0RxCpdnB5FLPoMlEGnt61cubLfBnxPPfUUW7ZsYc2aNSFZ6kcffRSADRs2MG/ePAoLC5k/fz5ZWVk88MADw/iVxi4
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fsize= (10,5)\n",
|
||
|
"fig, ax = plt.subplots(shape[0],shape[1],figsize=fsize)\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" #lab = f\"A$_{{BEC}}$ = {popt[i,j,0]:.1f} \\n A$_{{th}}$ = {popt[i,j,1]:.1f} \"\n",
|
||
|
" bval = result_x[i][j].best_values\n",
|
||
|
" ax[i,j].plot(x, X_guess_og[i,j])\n",
|
||
|
" ax[i,j].plot(x, density_1d(x, **result_x[i][j].best_values))\n",
|
||
|
" ax[i,j].plot(x, thermal(x, bval['x0_th'], bval['amp_th'], bval['sigma_th']))\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T15:03:41.983964700Z",
|
||
|
"start_time": "2023-08-01T15:03:41.172805200Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"## 2D Fit without mathematical constraint"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 64,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0,0\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\ipykernel_15584\\686923892.py:107: RuntimeWarning: invalid value encountered in power\n",
|
||
|
" res = (1- ((x-centerx)/(sigmax))**2 - ((y-centery)/(sigmay))**2)**(3 / 2)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"2.446171998977661\n",
|
||
|
"image 0,1\n",
|
||
|
"0.42479395866394043\n",
|
||
|
"image 0,2\n",
|
||
|
"0.3388192653656006\n",
|
||
|
"image 0,3\n",
|
||
|
"1.0576553344726562\n",
|
||
|
"image 0,4\n",
|
||
|
"0.4093611240386963\n",
|
||
|
"image 1,0\n",
|
||
|
"1.2626025676727295\n",
|
||
|
"image 1,1\n",
|
||
|
"0.5342316627502441\n",
|
||
|
"image 1,2\n",
|
||
|
"0.40906715393066406\n",
|
||
|
"image 1,3\n",
|
||
|
"0.4411289691925049\n",
|
||
|
"image 1,4\n",
|
||
|
"0.33938121795654297\n",
|
||
|
"fitting time = 0.7710072994232178 +- 0.670787745643047\n",
|
||
|
"[2.45115781 0.42978144 0.34380507 1.06264186 0.41334987 1.26659203\n",
|
||
|
" 0.53821802 0.41405177 0.44610786 0.34436727]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"result = []\n",
|
||
|
"times = []\n",
|
||
|
"x = np.linspace(0,shape[3],cut_width)\n",
|
||
|
"y = np.linspace(0,shape[2], cut_width)\n",
|
||
|
"\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" temp_res_arr = []\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" print(f'image {i},{j}')\n",
|
||
|
" data = cropOD[i,j]\n",
|
||
|
" fitModel = lmfit.Model(density_profile_BEC_2d, independent_vars=['x','y'])\n",
|
||
|
" #fitModel.set_param_hint('deltax', value=5)\n",
|
||
|
"\n",
|
||
|
" bval_1d = result_x[i][j].best_values\n",
|
||
|
" S = np.max(blurred[i,j])/(bval_1d['amp_bec'] + bval_1d['amp_th'])\n",
|
||
|
"\n",
|
||
|
" params = lmfit.Parameters()\n",
|
||
|
" #print(bval['sigma_th'])\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('amp_bec', S * bval_1d['amp_bec'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('amp_th',S * bval_1d['amp_th'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('x0_bec',center[i,j,0], True, 0, 150),\n",
|
||
|
" ('y0_bec',center[i,j,1], True, 0, 150),\n",
|
||
|
" ('x0_th',center[i,j,0], True, 0, 150),\n",
|
||
|
" ('y0_th',center[i,j,1], True, 0, 150),\n",
|
||
|
" ('sigmax_bec',bval_1d['sigma_bec'], True, 0, 100),\n",
|
||
|
" ('sigmay_bec',BEC_width_guess[i,j,1], True, 0, 100),\n",
|
||
|
" ('sigma_th',bval_1d['sigma_th'], True, 0, 50)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" X,Y = np.meshgrid(x, y)\n",
|
||
|
" X_1d = X.flatten()\n",
|
||
|
" Y_1d = Y.flatten()\n",
|
||
|
"\n",
|
||
|
" data1d = data.flatten()\n",
|
||
|
" start = time.time()\n",
|
||
|
" res = fitModel.fit(data1d, x=X_1d, y=Y_1d, params=params)\n",
|
||
|
" stop = time.time()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" # Check if there is an thermal part\n",
|
||
|
" bval = res.best_values\n",
|
||
|
" sigma_cut = max(bval['sigmay_bec'],bval['sigmax_bec'])\n",
|
||
|
" tf_fit = ThomasFermi_2d(X,Y,centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'], sigmax=bval['sigmax_bec'], sigmay=bval['sigmay_bec'])\n",
|
||
|
" tf_fit_2 = ThomasFermi_2d(X,Y,centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'], sigmax=1.5 * sigma_cut, sigmay=1.5*sigma_cut)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" mask = np.where(tf_fit > 0, np.nan, data)\n",
|
||
|
" #mask[i,j] = gaussian_filter(mask[i,j], sigma = 0.4)\n",
|
||
|
" mask = np.where(tf_fit_2 > 0, mask, np.nan)\n",
|
||
|
"\n",
|
||
|
" check_value = np.nansum(mask)\n",
|
||
|
"\n",
|
||
|
" print(stop-start)\n",
|
||
|
"\n",
|
||
|
" # if (check_value < 45) or ((check_value > 200) and (bval['sigma_th'] < min(bval['sigmax_bec'], bval['sigmay_bec']))):\n",
|
||
|
" # print('No thermal part detected, performing fit without thermal function')\n",
|
||
|
" # if check_value > 200:\n",
|
||
|
" # print('Sigma Thermal smaller than BEC, but still strong part around masked region --> BEC guessed wrong')\n",
|
||
|
" #\n",
|
||
|
" # params = lmfit.Parameters()\n",
|
||
|
" # #print(bval['sigma_th'])\n",
|
||
|
" # params.add_many(\n",
|
||
|
" # ('amp_bec', S * bval_1d['amp_bec'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" # ('amp_th',0, False, 0, 1.3 * np.max(data)),\n",
|
||
|
" # ('x0_bec',center[i,j,0], True, 0, 150),\n",
|
||
|
" # ('y0_bec',center[i,j,1], True, 0, 150),\n",
|
||
|
" # ('x0_th', 1, False, 0, 150),\n",
|
||
|
" # ('y0_th', 1, False, 0, 150),\n",
|
||
|
" # ('sigmax_bec',bval_1d['sigma_bec'], True, 0, 50),\n",
|
||
|
" # ('sigmay_bec',BEC_width_guess[i,j,1], True, 0, 50),\n",
|
||
|
" # ('sigma_th',1, False, 0, 50)\n",
|
||
|
" # )\n",
|
||
|
" #\n",
|
||
|
" # start2 = time.time()\n",
|
||
|
" # res = fitModel.fit(data1d, x=X_1d, y=Y_1d, params=params)\n",
|
||
|
" # stop2 = time.time()\n",
|
||
|
" #\n",
|
||
|
" # print(stop2-start2)\n",
|
||
|
" # print('')\n",
|
||
|
" stop2 = time.time()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" times.append(stop2-start)\n",
|
||
|
" temp_res_arr.append(res)\n",
|
||
|
" result.append(temp_res_arr)\n",
|
||
|
"times = np.array(times)\n",
|
||
|
"print(f\"fitting time = {np.mean(times)} +- {np.std(times, ddof=1)}\")\n",
|
||
|
"print(times)\n",
|
||
|
"\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T16:18:46.439989800Z",
|
||
|
"start_time": "2023-07-31T16:18:38.694610600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
"image 0,0\n",
|
||
|
"Image seems to be purely thermal (guessed from 1d fit amplitude)\n",
|
||
|
"time 1st fit: 0.229 s\n",
|
||
|
"\n",
|
||
|
"image 0,1\n",
|
||
|
"time 1st fit: 0.487 s\n",
|
||
|
"\n",
|
||
|
"image 0,2\n",
|
||
|
"time 1st fit: 0.422 s\n",
|
||
|
"\n",
|
||
|
"image 0,3\n",
|
||
|
"time 1st fit: 0.969 s\n",
|
||
|
"\n",
|
||
|
"image 0,4\n",
|
||
|
"time 1st fit: 0.334 s\n",
|
||
|
"\n",
|
||
|
"image 1,0\n",
|
||
|
"Image seems to be purely thermal (guessed from 1d fit amplitude)\n",
|
||
|
"time 1st fit: 0.136 s\n",
|
||
|
"\n",
|
||
|
"image 1,1\n",
|
||
|
"time 1st fit: 1.682 s\n",
|
||
|
"\n",
|
||
|
"image 1,2\n",
|
||
|
"time 1st fit: 0.440 s\n",
|
||
|
"\n",
|
||
|
"image 1,3\n",
|
||
|
"time 1st fit: 0.252 s\n",
|
||
|
"\n",
|
||
|
"image 1,4\n",
|
||
|
"time 1st fit: 0.359 s\n",
|
||
|
"fitting time = 0.534 +- 0.463\n",
|
||
|
"max fitting time = 1.685s\n",
|
||
|
"[0.23147106 0.49030185 0.42403865 0.97199774 0.33587432 0.13781762\n",
|
||
|
" 1.68479657 0.44243336 0.25544643 0.36216903]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"result = []\n",
|
||
|
"result_1 = []\n",
|
||
|
"times = []\n",
|
||
|
"x = np.linspace(0,shape[3],cut_width)\n",
|
||
|
"y = np.linspace(0,shape[2], cut_width)\n",
|
||
|
"\n",
|
||
|
"fitModel = lmfit.Model(density_profile_BEC_2d, independent_vars=['x','y'])\n",
|
||
|
"\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" temp_res_arr = []\n",
|
||
|
" temp_res_arr_1 = []\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" print()\n",
|
||
|
" print(f'image {i},{j}')\n",
|
||
|
" data = cropOD[i,j]\n",
|
||
|
"\n",
|
||
|
" #fitModel.set_param_hint('deltax', value=5)\n",
|
||
|
"\n",
|
||
|
" bval_1d = result_x[i][j].best_values\n",
|
||
|
" S = np.max(gaussian_filter(data, sigma=1))/(bval_1d['amp_bec'] + bval_1d['amp_th'])\n",
|
||
|
" params = lmfit.Parameters()\n",
|
||
|
" #print(bval['sigma_th'])\n",
|
||
|
" do_fit_2 = True\n",
|
||
|
" if bval_1d['amp_th']/bval_1d['amp_bec'] > 4:\n",
|
||
|
" print('Image seems to be purely thermal (guessed from 1d fit amplitude)')\n",
|
||
|
" do_fit_2 = False\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('amp_bec', 0, False, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('amp_th',S * bval_1d['amp_th'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('x0_bec',1, False),\n",
|
||
|
" ('y0_bec',1, False),\n",
|
||
|
" ('x0_th',center[i,j,0], True, center[i,j,0] -10, center[i,j,0] + 10),\n",
|
||
|
" ('y0_th',center[i,j,1], True, center[i,j,1] -10, center[i,j,1] + 10),\n",
|
||
|
" ('sigmax_bec', 1, False),\n",
|
||
|
" ('sigmay_bec', 1, False),\n",
|
||
|
" ('sigma_th',bval_1d['sigma_th'], True, 0, cut_width)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" elif bval_1d['amp_bec']/bval_1d['amp_th'] > 10:\n",
|
||
|
" print('Image seems to be pure BEC (guessed from 1d fit amplitude)')\n",
|
||
|
" do_fit_2 = False\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('amp_bec', S * bval_1d['amp_bec'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('amp_th',0, False),\n",
|
||
|
" ('x0_bec',center[i,j,0], True, center[i,j,0] -10, center[i,j,0] + 10),\n",
|
||
|
" ('y0_bec',center[i,j,1], True, center[i,j,1] - 10, center[i,j,1] + 10),\n",
|
||
|
" ('x0_th', 1, False),\n",
|
||
|
" ('y0_th', 1, False),\n",
|
||
|
" ('sigmax_bec',bval_1d['sigma_bec'], True, 0, 2/1.22 * BEC_width_guess[i,j,0]),\n",
|
||
|
" ('sigmay_bec',BEC_width_guess[i,j,1]/1.22, True, 0, 2/1.22 * BEC_width_guess[i,j,0]),\n",
|
||
|
" ('sigma_th',bval_1d['sigma_th'], False, 0, 50)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" else:\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('amp_bec', S * bval_1d['amp_bec'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('amp_th',S * bval_1d['amp_th'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('x0_bec',center[i,j,0], True, center[i,j,0] -10, center[i,j,0] + 10),\n",
|
||
|
" ('y0_bec',center[i,j,1], True, center[i,j,1] -10, center[i,j,1] + 10),\n",
|
||
|
" ('x0_th',center[i,j,0], True, center[i,j,0] -10, center[i,j,0] + 10),\n",
|
||
|
" ('y0_th',center[i,j,1], True, center[i,j,1] -10, center[i,j,1] + 10),\n",
|
||
|
" ('sigmax_bec',bval_1d['sigma_bec'], True, 0, 2/1.22 * BEC_width_guess[i,j,0]),\n",
|
||
|
" ('sigmay_bec',BEC_width_guess[i,j,1]/1.22, True, 0, 2/1.22 * BEC_width_guess[i,j,1]),\n",
|
||
|
" ('sigma_th',bval_1d['sigma_th'], True, 0, cut_width)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" X,Y = np.meshgrid(x, y)\n",
|
||
|
" X_1d = X.flatten()\n",
|
||
|
" Y_1d = Y.flatten()\n",
|
||
|
"\n",
|
||
|
" data1d = data.flatten()\n",
|
||
|
" start = time.time()\n",
|
||
|
" res = fitModel.fit(data1d, x=X_1d, y=Y_1d, params=params)\n",
|
||
|
" stop = time.time()\n",
|
||
|
" temp_res_arr_1.append(res)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" # Check if there is an thermal part\n",
|
||
|
" bval = res.best_values\n",
|
||
|
" sigma_cut = max(bval['sigmay_bec'], bval['sigmax_bec'])\n",
|
||
|
" tf_fit = ThomasFermi_2d(X,Y,centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'], sigmax=bval['sigmax_bec'], sigmay=bval['sigmay_bec'])\n",
|
||
|
" tf_fit_2 = ThomasFermi_2d(X,Y,centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'], sigmax=1.5 * sigma_cut, sigmay=1.5*sigma_cut)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" mask = np.where(tf_fit > 0, np.nan, data)\n",
|
||
|
" #mask[i,j] = gaussian_filter(mask[i,j], sigma = 0.4)\n",
|
||
|
" mask = np.where(tf_fit_2 > 0, mask, np.nan)\n",
|
||
|
"\n",
|
||
|
" check_value = np.nansum(mask)\n",
|
||
|
"\n",
|
||
|
" print(f'time 1st fit: {stop-start :.3f} s')\n",
|
||
|
"\n",
|
||
|
" # if (check_value < 45) or ((check_value > 10000) and (bval['sigma_th'] < min(bval['sigmax_bec'], bval['sigmay_bec']))):\n",
|
||
|
" #check_value = 200\n",
|
||
|
" if check_value < 45 and do_fit_2:\n",
|
||
|
" print('No thermal part detected, performing fit without thermal function')\n",
|
||
|
" # if check_value > 200:\n",
|
||
|
" # print('Sigma Thermal smaller than BEC, but still strong part around masked region --> BEC guessed wrong')\n",
|
||
|
"\n",
|
||
|
" params = lmfit.Parameters()\n",
|
||
|
" #print(bval['sigma_th'])\n",
|
||
|
" params.add_many(\n",
|
||
|
" ('amp_bec', S * bval_1d['amp_bec'], True, 0, 1.3 * np.max(data)),\n",
|
||
|
" ('amp_th',0, False),\n",
|
||
|
" ('x0_bec',center[i,j,0], True, center[i,j,0] -10, center[i,j,0] + 10),\n",
|
||
|
" ('y0_bec',center[i,j,1], True, center[i,j,1] - 10, center[i,j,1] + 10),\n",
|
||
|
" ('x0_th', 1, False),\n",
|
||
|
" ('y0_th', 1, False),\n",
|
||
|
" ('sigmax_bec',bval_1d['sigma_bec'], True, 0, 2/1.22 * BEC_width_guess[i,j,0]),\n",
|
||
|
" ('sigmay_bec',BEC_width_guess[i,j,1]/1.22, True, 0, 2/1.22 * BEC_width_guess[i,j,0]),\n",
|
||
|
" ('sigma_th',bval_1d['sigma_th'], False, 0, 50)\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" start2 = time.time()\n",
|
||
|
" res = fitModel.fit(data1d, x=X_1d, y=Y_1d, params=params)\n",
|
||
|
" stop2 = time.time()\n",
|
||
|
"\n",
|
||
|
" print(f'time pure bec fit: {stop2-start2 :.3f} s')\n",
|
||
|
" print('')\n",
|
||
|
" stop2 = time.time()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" times.append(stop2-start)\n",
|
||
|
" temp_res_arr.append(res)\n",
|
||
|
" result_1.append(temp_res_arr_1)\n",
|
||
|
" result.append(temp_res_arr)\n",
|
||
|
"times = np.array(times)\n",
|
||
|
"print(f\"fitting time = {np.mean(times):.3f} +- {np.std(times, ddof=1):.3f}\")\n",
|
||
|
"print(f\"max fitting time = {np.max(times) :.3f}s\")\n",
|
||
|
"print(times)\n",
|
||
|
"\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:07:36.161088100Z",
|
||
|
"start_time": "2023-08-01T14:07:30.769703500Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"## Plotting"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 26,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1400x4000 with 50 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNQAAAySCAYAAABKpv2fAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90b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0m/isccecy3kdu/efU3tJRcR1AQhFtfzEl6iRAl3359//vma2l+4cKFbx4QJE+ItcyNuDlu3bnXrHDBgQIrVKwi3Cu9Yvtpf7BdZEdSEW4Xcg26/e5BXFEvKn/eaIILazcUrbCTkunw1bveX+aTSvn17BaigoCB18eLFeMsk1v9Dhw6p9OnTK0BlyZJF7d+/P8G23n//fbeutm3bxtke+2V+6dKlCdbVtm3bRMs1aNDA3T5lypQE64nd5vUKaleuXFF16tRx6/vwww+VUkrNmDHDXVemTJmruqTd6cgY9CNjMOXGoNe9ND4hUCml/vnnH7dMgwYNrrmt5CJJCQQhBcmWLZu7fPTo0Wuq45FHHnGXnYCON4P77ruP3Llz3/R2BUEQhJRB7kHC3czly5fdhByZM2emT58+t7hHtxZnLEdHR7N+/fpk7z937lwuXLgAQFhYmDs+4+Oll14ic+bMAMyePdt19YuPChUq8Oijjya4/fHHH3eXN2/eHLDt/PnzzJ8/H4C8efPy7LPPJlhPzZo1KVeuXILbk4thGHz99deEhIQA0KdPH+bOncuLL74IaLe3yZMnkyFDhhRr87+GjMFAZAym3Bjs0qWLu/zll1/GW8a7vlOnTinSblKQGGqCkIJcuXLFXTYMI94yhw4d4uuvv2b+/Pls3ryZ48ePc+7cuXjL7tmzJ8X
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plt.subplots(shape[0] * shape[1], 5, figsize=(14, 4 * shape[0] * shape[1]))\n",
|
||
|
"\n",
|
||
|
"ii = 0\n",
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
"\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" axs[ii,0].set_title(f'image {i}, {j}, cond. frac = {cond_frac(result[i][j]) :.2f}')\n",
|
||
|
" lmfit.fit_report(result[i][j])\n",
|
||
|
" bval = result[i][j].best_values\n",
|
||
|
" fit = density_profile_BEC_2d(X,Y, **bval)\n",
|
||
|
" vmax = np.max(fit)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ax = axs[ii,0]\n",
|
||
|
" ax.pcolormesh(X, Y, cropOD[i,j], vmin=0, vmax=vmax, cmap='jet', shading='auto')\n",
|
||
|
" #plt.colorbar(art, ax=ax, label='z')\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" # Plot gaussian 2d Fit + legend including Width parameters\n",
|
||
|
" ax = axs[ii,1]\n",
|
||
|
"\n",
|
||
|
" ax.pcolormesh(X, Y, fit, vmin=0, vmax=vmax, cmap='jet', shading='auto')\n",
|
||
|
" #plt.colorbar(art, ax=ax, label='z')\n",
|
||
|
"\n",
|
||
|
" ax = axs[ii,2]\n",
|
||
|
"\n",
|
||
|
" ax.pcolormesh(X, Y, fit-cropOD[i,j], vmin=0, vmax=0.2, cmap='jet', shading='auto')\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ax = axs[ii,3]\n",
|
||
|
"\n",
|
||
|
" ax.plot(x, cropOD[i,j, round(center[i,j,1]), :])\n",
|
||
|
" ax.plot(x, fit[round(center[i,j,1]), :])\n",
|
||
|
" ax.plot(x, thermal(x, bval['x0_th'], bval['amp_th'], bval['sigma_th']))\n",
|
||
|
"\n",
|
||
|
" ax = axs[ii,4]\n",
|
||
|
"\n",
|
||
|
" ax.plot(y, cropOD[i,j, :, round(center[i,j,0])])\n",
|
||
|
" ax.plot(y, fit[:, round(center[i,j,0])])\n",
|
||
|
" ax.plot(x, thermal(y, bval['y0_th'], bval['amp_th'], bval['sigma_th']))\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ii += 1\n",
|
||
|
"\n",
|
||
|
"axs[0,0].set_title(f'Data \\n \\n image {0}, {0}, cond. frac = {cond_frac(result[0][0]) :.2f}')\n",
|
||
|
"axs[0,1].set_title('Fit \\n \\n')\n",
|
||
|
"axs[0,2].set_title('Data - Fit \\n \\n')\n",
|
||
|
"axs[0,3].set_title('cut along x \\n \\n')\n",
|
||
|
"axs[0,4].set_title('cut along y \\n \\n')\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T15:06:33.159195600Z",
|
||
|
"start_time": "2023-08-01T15:06:25.850200700Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 51,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "type",
|
||
|
"evalue": "'sigma_th'",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
|
||
|
"\u001B[1;31mKeyError\u001B[0m Traceback (most recent call last)",
|
||
|
"Cell \u001B[1;32mIn[51], line 5\u001B[0m\n\u001B[0;32m 3\u001B[0m sx \u001B[38;5;241m=\u001B[39m result[i][j]\u001B[38;5;241m.\u001B[39mbest_values[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124msigmax_bec\u001B[39m\u001B[38;5;124m'\u001B[39m]\n\u001B[0;32m 4\u001B[0m sy \u001B[38;5;241m=\u001B[39m result[i][j]\u001B[38;5;241m.\u001B[39mbest_values[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124msigmay_bec\u001B[39m\u001B[38;5;124m'\u001B[39m]\n\u001B[1;32m----> 5\u001B[0m s_th \u001B[38;5;241m=\u001B[39m \u001B[43mresult\u001B[49m\u001B[43m[\u001B[49m\u001B[43mi\u001B[49m\u001B[43m]\u001B[49m\u001B[43m[\u001B[49m\u001B[43mj\u001B[49m\u001B[43m]\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mbest_values\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43msigma_th\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m]\u001B[49m\n\u001B[0;32m 7\u001B[0m \u001B[38;5;28mprint\u001B[39m(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mimage \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mi\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m, \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mj\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m'\u001B[39m)\n\u001B[0;32m 8\u001B[0m \u001B[38;5;28mprint\u001B[39m(\u001B[38;5;28mmin\u001B[39m(sx\u001B[38;5;241m*\u001B[39m\u001B[38;5;241m1.22\u001B[39m, sy\u001B[38;5;241m*\u001B[39m\u001B[38;5;241m1.22\u001B[39m))\n",
|
||
|
"\u001B[1;31mKeyError\u001B[0m: 'sigma_th'"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for i in range(0,shape[0]):\n",
|
||
|
" for j in range(0,shape[1]):\n",
|
||
|
" sx = result[i][j].best_values['sigmax_bec']\n",
|
||
|
" sy = result[i][j].best_values['sigmay_bec']\n",
|
||
|
" s_th = result[i][j].best_values['sigma_th']\n",
|
||
|
"\n",
|
||
|
" print(f'image {i}, {j}')\n",
|
||
|
" print(min(sx*1.22, sy*1.22))\n",
|
||
|
" print(f'FWHM_x BEC: { sx*1.22:.2f}, FWHM_x thermal: { s_th*1.93:.2f}')\n",
|
||
|
" print(f'FWHM_y BEC: { sy*1.22:.2f}')\n",
|
||
|
" print(f'Ratio fwhm_th/fwhm_bec: { 1/min(sx,sy)/1.22 * s_th *1.93 :.2f}')\n",
|
||
|
" print('')"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T14:31:51.354781600Z",
|
||
|
"start_time": "2023-07-31T14:31:51.116754900Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 68,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"check val, 996.1322515049512\n",
|
||
|
"image 0, 1\n",
|
||
|
"check val, 503.70403248392944\n",
|
||
|
"image 0, 2\n",
|
||
|
"check val, 404.5014209391836\n",
|
||
|
"image 0, 3\n",
|
||
|
"check val, 204.52155001627648\n",
|
||
|
"image 0, 4\n",
|
||
|
"check val, 117.05256423462238\n",
|
||
|
"image 1, 0\n",
|
||
|
"check val, 607.2031498159346\n",
|
||
|
"image 1, 1\n",
|
||
|
"check val, 569.9239240506499\n",
|
||
|
"image 1, 2\n",
|
||
|
"check val, 423.4129240784928\n",
|
||
|
"image 1, 3\n",
|
||
|
"check val, 251.18077589127904\n",
|
||
|
"image 1, 4\n",
|
||
|
"check val, 151.64045224955777\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\ipykernel_15584\\686923892.py:107: RuntimeWarning: invalid value encountered in power\n",
|
||
|
" res = (1- ((x-centerx)/(sigmax))**2 - ((y-centery)/(sigmay))**2)**(3 / 2)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1000x1000 with 10 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0QAAAMtCAYAAAC/4rG8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyde5zVZbX/35tGbYpLCKGTIBCXmo4oJGEEKARZczqcIOZYYhQkB4MOJ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hA5juM4juM4jlNncYfIcRzHcRzHcZw6iztEjuM4juM4juPUWdwhchzHcRzHcRynzuIOkeM4juM4juM4dRZ3iBzHcRzHcRzHqbO4Q+Q4juM4juM4Tp3FHSLHcRzHcRzHceos7hA5juM4juM4jlNnqZRD9J3vfIdWrVoRi8VYvXp18vFWrVrxsY99jI4dO9KxY0d+9atfJZ/buHEjn/nMZ2jfvj2f+tSnWLNmTcYO3ql7fOc736FDhw4AvPrqq8nH3Qad6iAaAxs1anTC425/TnXg9ufUNG6DzgWLKkFJSYnKysrUsmVLvfLKK8nH3/t/Or169dK0adMkSb/5zW/UuXPnyuxS5eXlAlReXl6p910oMEEiS8rRFtFYooPEGInREiyo6cOrdkpKSrR27VoBev7555OPV5UN1nX7c04kGgOvvPLKE+zCx0CnOnD7c2qa6rZBtz/nZFSFXVRKIbr++utp3rx5hV//17/+lZdeeomvfe1rAAwYMICysjI2bdp0yvc
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"mask = np.zeros(shape)\n",
|
||
|
"mask2 = np.zeros(shape)\n",
|
||
|
"mask3 = []\n",
|
||
|
"fig, ax = plt.subplots(shape[0], shape[1], figsize=(10, 10))\n",
|
||
|
"\n",
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" temp_arr = []\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" print(f'image {i}, {j}')\n",
|
||
|
" arr = []\n",
|
||
|
" bval = result[i][j].best_values\n",
|
||
|
" sigma_cut = max(bval['sigmay_bec'], bval['sigmax_bec'])\n",
|
||
|
" tf_fit = ThomasFermi_2d(X, Y, centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'],\n",
|
||
|
" sigmax=bval['sigmax_bec'], sigmay=bval['sigmay_bec'])\n",
|
||
|
" tf_fit_2 = ThomasFermi_2d(X, Y, centerx=bval['x0_bec'], centery=bval['y0_bec'], amplitude=bval['amp_bec'],\n",
|
||
|
" sigmax=1.5 * sigma_cut, sigmay=1.5 * sigma_cut)\n",
|
||
|
"\n",
|
||
|
" mask[i, j] = np.where(tf_fit > 0, np.nan, cropOD[i, j])\n",
|
||
|
" #mask[i,j] = gaussian_filter(mask[i,j], sigma = 0.4)\n",
|
||
|
" #mask[i,j] = np.where(tf_fit_2 > 0, mask[i,j], np.nan)\n",
|
||
|
" mask2[i, j] = np.where(tf_fit_2 > 0, mask[i, j], np.nan)\n",
|
||
|
" # print(f'max = {np.nanmax(mask[i,j])}, {np.nanmax(mask[i,j]) / np.nanmin(mask[i,j])}')\n",
|
||
|
"\n",
|
||
|
" check_value = np.nanmean(mask2[i, j]) / (bval[\"amp_bec\"] + bval[\"amp_th\"])\n",
|
||
|
"\n",
|
||
|
" print(f'check val, {np.nansum(mask2[i, j])}')\n",
|
||
|
"\n",
|
||
|
" ax[i, j].pcolormesh(mask2[i, j], cmap='jet', vmin=0, vmax=0.5)\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T16:24:30.214087200Z",
|
||
|
"start_time": "2023-07-31T16:24:27.819111500Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 66,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<lmfit.model.ModelResult at 0x26135f2cd90>",
|
||
|
"text/html": "<h2> Model</h2> Model(density_profile_BEC_2d) <h2>Fit Statistics</h2><table><tr><td>fitting method</td><td>leastsq</td><td></td></tr><tr><td># function evals</td><td>187</td><td></td></tr><tr><td># data points</td><td>40000</td><td></td></tr><tr><td># variables</td><td>9</td><td></td></tr><tr><td>chi-square</td><td> 169.276560</td><td></td></tr><tr><td>reduced chi-square</td><td> 0.00423287</td><td></td></tr><tr><td>Akaike info crit.</td><td>-218586.036</td><td></td></tr><tr><td>Bayesian info crit.</td><td>-218508.667</td><td></td></tr><tr><td>R-squared</td><td> 0.52992868</td><td></td></tr></table><h2>Variables</h2><table><tr><th> name </th><th> value </th><th> standard error </th><th> relative error </th><th> initial value </th><th> min </th><th> max </th><th> vary </th></tr><tr><td> amp_bec </td><td> 0.02336412 </td><td> 0.00390198 </td><td> (16.70%) </td><td> 0.034266049998156745 </td><td> 0.00000000 </td><td> 0.66407331 </td><td> True </td></tr><tr><td> amp_th </td><td> 0.34124925 </td><td> 0.00616591 </td><td> (1.81%) </td><td> 0.4541054784032772 </td><td> 0.00000000 </td><td> 0.66407331 </td><td> True </td></tr><tr><td> x0_bec </td><td> 105.141495 </td><td> 1.75047827 </td><td> (1.66%) </td><td> 101.44676258992803 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> y0_bec </td><td> 127.593699 </td><td> 5.28013452 </td><td> (4.14%) </td><td> 99.38848920863309 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> x0_th </td><td> 101.488658 </td><td> 0.21913615 </td><td> (0.22%) </td><td> 101.44676258992803 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> y0_th </td><td> 98.1618593 </td><td> 0.31096970 </td><td> (0.32%) </td><td> 99.38848920863309 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> sigmax_bec </td><td> 37.0890339 </td><td> 3.20093427 </td><td> (8.63%) </td><td> 21.28861216515048 </td><td> 0.00000000 </td><td> 100.000000 </td><td> True </td></tr><tr><td> sigmay_bec </td><td> 61.3773595 </td><td> 6.14919207 </td><td> (10.02%) </td><td> 44.0 </td><td> 0.00000000 </td><td> 100.000000 </td><td> True </td></tr><tr><td> sigma_th </td><td> 32.4009422 </td><td> 0.24468440 </td><td> (0.76%) </td><td> 32.282716889121275 </td><td> 0.00000000 </td><td> 50.0000000 </td><td> True </td></tr></table><h2>Correlations (unreported correlations are < 0.100)</h2><table><tr><td>amp_th</td><td>y0_bec</td><td>+0.8618</td></tr><tr><td>amp_th</td><td>sigma_th</td><td>-0.8152</td></tr><tr><td>y0_bec</td><td>sigma_th</td><td>-0.7673</td></tr><tr><td>amp_bec</td><td>amp_th</td><td>-0.6667</td></tr><tr><td>amp_bec</td><td>y0_th</td><td>-0.6569</td></tr><tr><td>x0_bec</td><td>x0_th</td><td>-0.5454</td></tr><tr><td>y0_bec</td><td>sigmay_bec</td><td>-0.5361</td></tr><tr><td>sigmay_bec</td><td>sigma_th</td><td>+0.4854</td></tr><tr><td>amp_th</td><td>sigmay_bec</td><td>-0.4785</td></tr><tr><td>y0_th</td><td>sigmax_bec</td><td>-0.4698</td></tr><tr><td>amp_bec</td><td>y0_bec</td><td>-0.4444</td></tr><tr><td>y0_th</td><td>sigmay_bec</td><td>+0.4099</td></tr><tr><td>amp_bec</td><td>sigma_th</td><td>+0.3226</td></tr><tr><td>y0_bec</td><td>x0_th</td><td>+0.2463</td></tr><tr><td>amp_th</td><td>x0_th</td><td>+0.2452</td></tr><tr><td>amp_bec</td><td>sigmax_bec</td><td>+0.2383</td></tr><tr><td>amp_bec</td><td>x0_th</td><td>-0.2263</td></tr><tr><td>sigmax_bec</td><td>sigmay_bec</td><td>-0.2073</td></tr><tr><td>amp_th</td><td>y0_th</td><td>+0.1766</td></tr><tr><td>amp_th</td><td>sigmax_bec</td><td>-0.1624</td></tr><tr><td>x0_th</td><td>sigma_th</td><td>-0.1609</td></tr><tr><td>x0_th</td><td>sigmay_bec</td><td>-0.1543</td></tr><tr><td>sigmax_bec</td><td>sigma_th</td><td>-0.1412</td></tr><tr><td>y0_th</td><td>sigma_th</td><td>+0.1321</td></tr></table>"
|
||
|
},
|
||
|
"execution_count": 66,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"result[1][0]"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T16:19:06.602394400Z",
|
||
|
"start_time": "2023-07-31T16:19:06.568485700Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "[<matplotlib.lines.Line2D at 0x24d4ab0e4c0>]"
|
||
|
},
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 640x480 with 1 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGZCAYAAACjc8rIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADGO0lEQVR4nOydd5wcdf3/X1O2X7/cpd6lJ4QAKfQE6UiRoiKIihq/lNh++hW/gojliw3Er6igQBBFEUFEQBHpRCCBQBJCekJ67i65y/Xbu+1Tfn/MfGY+Mzt7t3s9yfv5eORxm73Z2dm93c+85vVugq7rOgiCIAiCIEYR4kgfAEEQBEEQhBsSKARBEARBjDpIoBAEQRAEMeoggUIQBEEQxKiDBApBEARBEKMOEigEQRAEQYw6SKAQBEEQBDHqIIFCEARBEMSoQx7pA+gvmqbh4MGDKC4uhiAII304BEEQBEHkga7r6O7uxoQJEyCKuX2Sw1agHDx4EDU1NSN9GARBEARB9IP6+npMmjQp5+8PW4FSXFwMwHiBJSUlI3w0BEEQBEHkQzQaRU1NjXUez8VhK1BYWKekpIQECkEQBEEcZvSVnkFJsgRBEARBjDqGRKDs3LkTixYtwqxZs3DyySdjy5Ytnttt2rQJZ599NubMmYM5c+bg6aefHorDIQiCIAjiMGNIQjxLly7FjTfeiCVLluDvf/87lixZgjVr1ji2icfjuOKKK/DII4/gjDP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PCRSCIEaG/rS5Z1AOCkEc8ZBAIQhiZEj1o809gxwUgjjiIYFCEMTIMBg5KNQHhSCOWEigEAQxMlAOCkE
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"i = 0\n",
|
||
|
"j = 0\n",
|
||
|
"bval = result[i][j].best_values\n",
|
||
|
"plt.plot(x, cropOD[i,j, round(center[i,j,1]), :])\n",
|
||
|
"plt.plot(x, fit[round(center[i,j,1]), :])\n",
|
||
|
"plt.plot(x, thermal(x, bval['x0_th'], bval['amp_th'], bval['sigma_th']))"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:15:06.902035Z",
|
||
|
"start_time": "2023-08-01T14:15:06.632129700Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"outputs": [],
|
||
|
"source": [],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 2
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython2",
|
||
|
"version": "2.7.6"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 0
|
||
|
}
|