2476 lines
3.1 MiB
Plaintext
2476 lines
3.1 MiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"# Import supporting package"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"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
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"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 = 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-01T15:20:39.551818900Z",
|
||
|
"start_time": "2023-08-01T15:20:38.914407Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# import data\n",
|
||
|
"img_dir = '//DyLabNAS/Data/'\n",
|
||
|
"SequenceName = \"Evaporative_Cooling\" + \"/\"\n",
|
||
|
"folderPath = img_dir + SequenceName + '2023/04/24'# get_date()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"shotNum = \"0009\"\n",
|
||
|
"filePath = folderPath + \"/\" + shotNum + \"/2023-04-24_0009_Evaporative_Cooling_*0.h5\"\n",
|
||
|
"\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:11:06.245181900Z",
|
||
|
"start_time": "2023-08-01T14:11:06.232420200Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"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-01T14:11:12.242618400Z",
|
||
|
"start_time": "2023-08-01T14:11:06.248172600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 37,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"C:\\Users\\Jianshun Gao\\PycharmProjects\\analyseScript\\venv\\lib\\site-packages\\dask\\core.py:121: RuntimeWarning: divide by zero encountered in log\n",
|
||
|
" return func(*(_execute_task(a, cache) for a in args))\n",
|
||
|
"C:\\Users\\Jianshun Gao\\PycharmProjects\\analyseScript\\venv\\lib\\site-packages\\dask\\core.py:121: RuntimeWarning: divide by zero encountered in divide\n",
|
||
|
" return func(*(_execute_task(a, cache) for a in args))\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1000x900 with 10 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA2kAAANiCAYAAAD7T4FlAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eZjbd3Xv/7IlS5YysjWRImWUTDLGjg0OLglLk0IoS+GmpZd9LTs0JOFCWdrbBejvQh76QLnkQlNogUvLclsK4SlLKbSUBsJSSCGBBEJN7Nh4kklmPMrII0cTyZKlfH9/fL7nfM5HM+MlsZ1x8j3P48fS6Lt8tvNZznmf91kVRVFEIokkkkgiiSSSSCKJJJJIIitCVj/QBUgkkUQSSSSRRBJJJJFEEknES3JISySRRBJJJJFEEkkkkUQSWUGSHNISSSSRRBJJJJFEEkkkkURWkCSHtEQSSSSRRBJJJJFEEkkkkRUkySEtkUQSSSSRRBJJJJFEEklkBUlySEskkUQSSSSRRBJJJJFEEllBkhzSEkkkkUQSSSSRRBJJJJFEVpAkh7REEkkkkUQSSSSRRBJJJJEVJMkhLZFEEkkkkUQSSSSRRBJJZAXJSXtI+9SnPsWqVauYmJh4UL9TZHJyklWrVrFq1SomJydP+P33VeSd3/72t0/YOxM5PpLo3Im9/75KonOJHKkkOn1i77+vkuh0Iok8NOWkPaQdSr785S/zrne9iy9/+csPdFEetPIXf/EXvOtd7+Kmm256oIuy4uXyyy/XRfaB2JgcC9m9ezef+tSnALjttts47bTTuPjii/nCF74A3H+d+8lPfsLLX/5yzjzzTLLZLGNjYzz3uc9l+/btR3T/tddey3Of+1zGxsbIZrOceeaZvPzlL+cnP/nJYd/7kY98hNe97nU8+tGPJpvNrth+SnTuyOXBonOXXXYZGzZsYO3atYt07v7KT37yEz72sY8BTqdF5771rW8BS+v0wYMH+fjHP85ll13GBRdcwPj4OLlcjnw+z8aNG3npS1/KNddcc0Tvb7fbXHzxxVQqFdauXcuGDRu47LLL2LVr11HX5Qc/+AGpVOqwh5lut6ufn/nMZ1IsFlmzZg2nnXYaT3nKU/jQhz5Eu90+6vffV0l0+sgl0elDS7fb5UMf+hAXXXQRo6OjrF27lomJCS655JJDrqNRFHHdddfxp3/6pzz5yU+mWq2yZs0a1q9fz2Me8xje9ra3ceeddx7y3RMTE9o3y/276KKLli33P//zP/PGN76Rxz72sQ+4Tq44iU5S+eQnPxkB0dlnn73ot1e96lUREL3qVa86Ye883rJnz54IiIBoz549J/z+YTn77LMjIPrkJz95yOu2bNkSbdmyJfrhD394v995Msq3vvWtaNWqVdr2D8TYub/yta99Lcrn81qHVatWRatXr9bvr3nNa+6Xzn384x+P0um0Pm/9+vVBmx2u3d75zncGZVu/fr1+T6fT0cc//vFl75VxPPzv7LPPTnTuJJUHo86tW7dukc7de++99/n5wzq3atWqoM3e+c53LqnTd911V6Anq1atikZHR6NUKhX8/VWvelV08ODBJd/9iU98Irh29erV0bp16/R7Pp+Pvva1rx1xXTqdTvTwhz88eOa111675LVPeMITguvS6XQwXwDRpk2boltvvXXJ+xOdfmAk0elDy8zMTHT++efrs9asWRONjo7q92w2G33mM59Z8t4/+7M/W6TTxWIxaO9169ZF//RP/7Ts+2Ucr1u3LqpWq0v+e9aznrXkvU972tPul04+2OVB6UlLZOXILbfcwi233MKv/uqvPtBFOeHSbrd53eteRzqd5rGPfewDXZz7JHv27OFFL3oR7XabTZs2AXDWWWexf/9+/tf/+l8AfPKTn+TnP//5fXr+ddddx+WXX06/3+c5z3kOU1NTNJtN7rrrLi677DK9bjlL2uc//3muuOIKAC677DLuuusums0mU1NTPOc5z6Hf73P55Zdz3XXXLXl/JpPhvPPO47WvfS0f/vCHecUrXnGf6rGSJNG5B4/OPeEJT2DHjh3s379/kc69//3vv0/Ptzp3/vnnA06nrc5dccUVS8L5stksv/d7v8fVV1/N5OQk3W6Xffv20ev1uPnmm3nJS14CwKc//WmuvPLKJd//r//6r/r5ne98p9btlltu4fGPfzztdpsXvehF7Nmz54jqc8UVV+i9h5N+v6+fv/rVr9Ltdmk2m+zbt4/3ve995PN5du3axW/91m9x4MCBI3r/iZBEpxOdXk6iKOL5z38+N954I7lcjo9//OPcfffd7Nu3j+npaV75ylfS7XZ59atfzY9//ONF9x88eJB169Zx+eWX861vfYt77rmH+fl57rnnHr7whS9w1llncffdd/PCF76QX/ziF4csy1VXXcXevXuX/PdP//RPS95z8OBBzj77bN71rnfxk5/85KTRyRMmD/Qp8b5K4kk7sfcPy5FaAB/K8pa3vCUCone84x06Jk82C+DLX/7yCIhOP/306K/+6q8W1eHSSy9Vy9190bmLLrooAqJt27ZFvV5v0e+PfOQjIyBKpVJRv98Pfuv3+zoOf/M3f3PRvd1uV++/6KKLlnz/8DPFK3cye9IeyvJg07n5+flFv4vOrVu3Ltq3b99RP9/q3N/8zd8saqOLL744AqJTTjnlqHX63nvvjR7/+Mer9XtY9u3bF61duzYCopGRkSV/P/300yMgevnLX37Y9/34xz+O0ul0tGnTpuhf//VfD+tJ+/znP39InfzsZz+rv//d3/3dot8TnT7xkuj0oeWf//mfdUz+xV/8xZLXXHjhhREQPfWpT13024033njId/7yl7+McrlcBES/+7u/u+Q192ccf+9731vW6x5Fh9fJB7sc90PatddeG73gBS+IarValMlkolKpFD31qU+NPvGJTyzaIA3LddddFz372c+OSqVStHbt2mjz5s3R29/+9qjVai15YLr22muXhC7Zf8tN3kciw++84YYbohe+8IXR6aefHmUymWjDhg3RW9/61sMq2a5du6LLL7882rRpU7R27dqoUChE559/fnTFFVdE+/fvX/KeI1kc7rjjjujSSy+NzjzzzCiTyURnnHFG9OpXvzq69dZbj9niYqFly/2zsly7D5dncnIyuuSSS6Lx8fEom81GD3vYw6J3vOMd0cLCgt5z8803Ry972cuiM888M8pms9GmTZuid7/73Utu7off9eY3vznaunVrdMopp0S5XC7asmVL9KY3vSm67bbb7nNbHEquu+66aPXq1dHmzZujTqdzQheXY6lzAnl4+9vfvqTO2Qn0aHVu9+7des2nP/3pJa/54z/+Y73mW9/6VqBzcjAEoq9+9atL3v+pT31Kr3npS196WJ072kNaonNLy0NN546VLCws6Iboiiuu0L8P67T042te85qj0ulsNqv3fuxjH1tSpz/4wQ/er3X0rW99awREa9euXfTb3/7t3+ozzjjjjCiKFq+jxWJR77djcVh+8YtfRKeeemoERJlMJoCSLTcfHE4nB4OBHk5HRkYSnR56V6LTRy/L6bQV24+f+MQnjur5l19+eQTOqLJcH37hC1/Q59+XvnrGM54RAdGv/MqvLPn78TQ2DAaDqFAoRED0pje96Zg/f6XLcT2kyWQNHudqsetPfepTo7vvvnvJe//2b/82wOuuX79eF6eHP/zh0Qc+8IFFyvr9738/qlaraqlbu3btIlzs97///ftcH7ugfeYzn9FN4vr164OynnvuuVGr1VryGVdffXWwUBYKheD7+Ph4tH379kX3HW5x+PGPfxxgkHO5XDQyMhKBs85cffXVx2Rxef/73x9Vq1Wt71IYZCtHsrh84Qtf0IV53bp1wRh54hOfGPV6veirX/2qLsLDMUsvfvGLly3v3//93wftm81mdcKU9v+3f/u3+9weS8mBAweiRzziEdGqVauib3/721EURSdscTmWOiebFSCamJhYVufs849G5z760Y/qfbOzs8uWSa555jOfGeicHQPL6dzs7Oyizc+hdO5oDmmJzi0tDzWdO5by9a9/XdvpRz/
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"imageAnalyser.center = (960, 890)\n",
|
||
|
"imageAnalyser.span = (150, 150)\n",
|
||
|
"imageAnalyser.fraction = (0.1, 0.1)\n",
|
||
|
"\n",
|
||
|
"plot_data = np.log((dataSet[\"atoms\"] - dataSet[\"dark\"])/(dataSet[\"background\"] - dataSet[\"dark\"]))\n",
|
||
|
"dataSet_cropOD = imageAnalyser.crop_image(plot_data)\n",
|
||
|
"dataSet_cropOD = imageAnalyser.substract_offset(dataSet_cropOD).load()\n",
|
||
|
"#cropOD = dataSet_cropOD.to_numpy()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"dataSet_cropOD.plot.pcolormesh(cmap='jet', col=scanAxis[0], row=scanAxis[1])\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T13:13:56.385247600Z",
|
||
|
"start_time": "2023-07-31T13:13:48.343533800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"outputs": [],
|
||
|
"source": [],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[879. 961.]\n",
|
||
|
"2.8134107167600364\n",
|
||
|
"2.8134107167600364\n",
|
||
|
"[878. 961.]\n",
|
||
|
"2.4849066497880004\n",
|
||
|
"1.890850371872286\n",
|
||
|
"[876. 961.]\n",
|
||
|
"2.583997552432231\n",
|
||
|
"1.6863989535702288\n",
|
||
|
"[878. 961.]\n",
|
||
|
"2.8526314299133175\n",
|
||
|
"1.9859154836690123\n",
|
||
|
"[877. 961.]\n",
|
||
|
"2.691243082785829\n",
|
||
|
"2.0794415416798357\n",
|
||
|
"[876. 961.]\n",
|
||
|
"2.2192034840549946\n",
|
||
|
"1.5723966407537513\n",
|
||
|
"[877. 961.]\n",
|
||
|
"0.916290731874155\n",
|
||
|
"0.7817005779013904\n",
|
||
|
"[876. 961.]\n",
|
||
|
"1.3862943611198906\n",
|
||
|
"0.6539264674066639\n",
|
||
|
"[876. 961.]\n",
|
||
|
"0.916290731874155\n",
|
||
|
"0.6131044728864089\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"data = OD_np\n",
|
||
|
"cut_width = 200\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)\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:11:13.860521400Z",
|
||
|
"start_time": "2023-08-01T14:11:12.246587Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"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 750x750 with 9 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoIAAAJtCAYAAACi4hFCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9f3Tld3nnCb7KXGHLcGVbZUvYKlsXuGWkBlUbAVUJolPFUp4up7u6YyBAExLoSTYkezbZJnO20/TMbjZntpPubA/ZkJwZZjeZdHqANPQG93Y1TXVcnLholKQqRHhL0FW4BL5llzAStmxLYGEk0P7x+bzreX8+96qMcZlSDXrO0bm63/v98fn1/Ho/z/P57t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ehy/2PPc6Kh/77dzNpvLWljvJzH7SnVNtyF4OahUakIs1klroUUS7EIaJHhHCYF8hm5BV8+RBDeUBpuT1kYvY8gdIndwZLzJGXK+k3LZSzJsj+U+LeXj6oMrpwnSunWDVmt9iFAgEIavPvtJc79MWnf32D18TUgByxCG3orHyZ3RXsaA7ql5mCTJkHVC2cpwdsUylX9bytc8RRgfGr9+wpGR4+v9fxsRwoduHtfzNQ7uPDr1ckZrJ/w24L/eQjzzL0jjUctDydHR/F1r3w0eXweTpL6Lh2SgD9LbgBC5AdlhcydW/OFjqWvFb60ez1J7NddyeBco59j5CjY3pnRPyROdpzXjxmtNjfycXk69r7k2aewb1h7JM+nPRdLadwfqIKX+9HvXuljP0Xj5Gq/b5LJPdBA4T+kU6T6
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 750x750 with 9 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoIAAAJtCAYAAACi4hFCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA8f0lEQVR4nO3dX2zT973/8ZepO1e02GigrGkSJ2ImmSYiTNpUPZkoQvqh9mrlKFTtRQqukJI7tPZcUK6Am6TSdlpV7UVzFZ0qUhpt2dkNN6PbtMBSrUGQgxSpI6la2aWBIGjsCYELzed3ATH5Yzv+Jl/b328+zweyNPsb2+86ee378sdf2wFjjBEAAACss6naAwAAAKA6KIIAAACWoggCAABYiiIIAABgKYogAACApSiCAAAAlqIIAgAAWIoiCAAAYCmKIAAAgKUcFcG7d+/q4MGDam5u1u7du3XgwAFNT09LkmZnZ/Xyyy9r586d2rVrl0ZHR3PXK7YN2MjIDOAMmQEqzDhw584dc+bMGTM/P2+MMebDDz80+/btM8YY8+abb5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15J7VQ/iiDQPFja6WVZZBjbGGjUhYceNXJ2zz3OYJwSSCQO+bPyUtVC58Sr0CgfLMBPlDK5wQufjdxqd+3CmwUTl91cvrdxKgMVgQ3qPQ/vnP084vLIs/WYLtSjq1dwGoHbLT4Vac/jf1C8RKu89ZYj95XP686eQwrghZYbUWQg9uBR5weVnFKp1jtgH3W8KrTKZ3iVScPYkXQAsU+zoISCCz
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fsize = (shape[0]*2.5, shape[1]*2.5)\n",
|
||
|
"fig, ax = plt.subplots(shape[0],shape[1], figsize=fsize)\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',vmin=0,vmax=np.max(cropOD[i,j]),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=fsize)\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",
|
||
|
" ax[i,j].plot(center[i,j,0], center[i,j,1], markersize=12, marker='x')\n",
|
||
|
"plt.show()\n"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T14:35:26.496442600Z",
|
||
|
"start_time": "2023-08-01T14:35:24.512814900Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 20,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 36\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.12293367\n",
|
||
|
" reduced chi-square = 6.3368e-04\n",
|
||
|
" Akaike info crit = -1466.88554\n",
|
||
|
" Bayesian info crit = -1447.09564\n",
|
||
|
" R-squared = 0.99462760\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.8647761 +/- 0.03787568 (0.04%) (init = 99.66897)\n",
|
||
|
" x0_th: 101.694894 +/- 0.22678895 (0.22%) (init = 99.66897)\n",
|
||
|
" amp_bec: 1.20335718 +/- 0.01500965 (1.25%) (init = 1.275821)\n",
|
||
|
" amp_th: 0.55422943 +/- 0.01054007 (1.90%) (init = 0.5467806)\n",
|
||
|
" deltax: 30.2589309 +/- 0.64613907 (2.14%) (init = 70)\n",
|
||
|
" sigma_bec: 6.96569008 +/- 0.06993060 (1.00%) (init = 5.737705)\n",
|
||
|
" sigma_th: 20.0764423 +/- 0.34664172 (1.73%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7374\n",
|
||
|
" C(amp_bec, amp_th) = -0.6500\n",
|
||
|
" C(amp_bec, deltax) = +0.5160\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4846\n",
|
||
|
" C(x0_bec, x0_th) = -0.3205\n",
|
||
|
" C(deltax, sigma_bec) = +0.2090\n",
|
||
|
" C(x0_th, amp_bec) = +0.1994\n",
|
||
|
" C(x0_th, amp_th) = -0.1502\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.12764746\n",
|
||
|
" reduced chi-square = 6.5798e-04\n",
|
||
|
" Akaike info crit = -1459.36008\n",
|
||
|
" Bayesian info crit = -1439.57018\n",
|
||
|
" R-squared = 0.99452795\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 102.356089 +/- 0.04135959 (0.04%) (init = 101.9209)\n",
|
||
|
" x0_th: 105.458651 +/- 0.23946363 (0.23%) (init = 101.9209)\n",
|
||
|
" amp_bec: 1.17207540 +/- 0.01489834 (1.27%) (init = 1.260841)\n",
|
||
|
" amp_th: 0.56243131 +/- 0.01049327 (1.87%) (init = 0.5403604)\n",
|
||
|
" deltax: 31.3526498 +/- 0.65821221 (2.10%) (init = 70)\n",
|
||
|
" sigma_bec: 7.59365153 +/- 0.07658659 (1.01%) (init = 7.377049)\n",
|
||
|
" sigma_th: 21.0398603 +/- 0.35342133 (1.68%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7275\n",
|
||
|
" C(amp_bec, amp_th) = -0.6525\n",
|
||
|
" C(amp_bec, deltax) = +0.5024\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4801\n",
|
||
|
" C(x0_th, amp_bec) = +0.3075\n",
|
||
|
" C(x0_bec, x0_th) = -0.2792\n",
|
||
|
" C(x0_th, amp_th) = -0.2381\n",
|
||
|
" C(deltax, sigma_bec) = +0.1913\n",
|
||
|
" C(x0_th, deltax) = +0.1427\n",
|
||
|
" C(x0_bec, deltax) = +0.1389\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1313\n",
|
||
|
" C(x0_bec, amp_th) = -0.1088\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.16930834\n",
|
||
|
" reduced chi-square = 8.7272e-04\n",
|
||
|
" Akaike info crit = -1402.87023\n",
|
||
|
" Bayesian info crit = -1383.08032\n",
|
||
|
" R-squared = 0.99162674\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 98.3564127 +/- 0.05108989 (0.05%) (init = 98.19883)\n",
|
||
|
" x0_th: 100.508601 +/- 0.31013725 (0.31%) (init = 98.19883)\n",
|
||
|
" amp_bec: 1.13511700 +/- 0.01833571 (1.62%) (init = 1.23363)\n",
|
||
|
" amp_th: 0.47714699 +/- 0.01395573 (2.92%) (init = 0.5286985)\n",
|
||
|
" deltax: 26.9929240 +/- 0.88809307 (3.29%) (init = 70)\n",
|
||
|
" sigma_bec: 7.75878559 +/- 0.09369241 (1.21%) (init = 7.377049)\n",
|
||
|
" sigma_th: 18.8858871 +/- 0.47628155 (2.52%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7554\n",
|
||
|
" C(amp_bec, amp_th) = -0.7153\n",
|
||
|
" C(amp_bec, deltax) = +0.5685\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4900\n",
|
||
|
" C(x0_bec, x0_th) = -0.3539\n",
|
||
|
" C(x0_th, amp_bec) = +0.2626\n",
|
||
|
" C(deltax, sigma_bec) = +0.2149\n",
|
||
|
" C(x0_th, amp_th) = -0.1978\n",
|
||
|
" C(x0_th, deltax) = +0.1249\n",
|
||
|
" C(x0_bec, deltax) = +0.1234\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.22344237\n",
|
||
|
" reduced chi-square = 0.00115176\n",
|
||
|
" Akaike info crit = -1347.38383\n",
|
||
|
" Bayesian info crit = -1327.59392\n",
|
||
|
" R-squared = 0.98968853\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 101.544067 +/- 0.04388786 (0.04%) (init = 101.3475)\n",
|
||
|
" x0_th: 105.454531 +/- 0.37376745 (0.35%) (init = 101.3475)\n",
|
||
|
" amp_bec: 1.36515588 +/- 0.02167693 (1.59%) (init = 1.336058)\n",
|
||
|
" amp_th: 0.45815745 +/- 0.01541971 (3.37%) (init = 0.5725962)\n",
|
||
|
" deltax: 24.9151869 +/- 0.95336627 (3.83%) (init = 70)\n",
|
||
|
" sigma_bec: 6.64440808 +/- 0.08162252 (1.23%) (init = 5.737705)\n",
|
||
|
" sigma_th: 17.1053327 +/- 0.50733914 (2.97%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7202\n",
|
||
|
" C(amp_bec, amp_th) = -0.6580\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4864\n",
|
||
|
" C(amp_bec, deltax) = +0.4650\n",
|
||
|
" C(x0_th, amp_bec) = +0.4384\n",
|
||
|
" C(x0_th, amp_th) = -0.3592\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2291\n",
|
||
|
" C(deltax, sigma_bec) = +0.2130\n",
|
||
|
" C(x0_bec, x0_th) = -0.2085\n",
|
||
|
" C(x0_bec, deltax) = +0.2051\n",
|
||
|
" C(x0_th, deltax) = +0.2022\n",
|
||
|
" C(x0_bec, amp_th) = -0.1552\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 64\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.37802500\n",
|
||
|
" reduced chi-square = 0.00194858\n",
|
||
|
" Akaike info crit = -1242.22246\n",
|
||
|
" Bayesian info crit = -1222.43256\n",
|
||
|
" R-squared = 0.98113369\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.0310549 +/- 0.06126464 (0.06%) (init = 98.95161)\n",
|
||
|
" x0_th: 102.787830 +/- 0.56784414 (0.55%) (init = 98.95161)\n",
|
||
|
" amp_bec: 1.31924788 +/- 0.02757694 (2.09%) (init = 1.377661)\n",
|
||
|
" amp_th: 0.39933374 +/- 0.01999155 (5.01%) (init = 0.590426)\n",
|
||
|
" deltax: 26.2390002 +/- 1.48754976 (5.67%) (init = 70)\n",
|
||
|
" sigma_bec: 7.07747078 +/- 0.11388618 (1.61%) (init = 5.737705)\n",
|
||
|
" sigma_th: 18.0647636 +/- 0.79075620 (4.38%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7341\n",
|
||
|
" C(amp_bec, amp_th) = -0.6708\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4979\n",
|
||
|
" C(amp_bec, deltax) = +0.4875\n",
|
||
|
" C(x0_th, amp_bec) = +0.4178\n",
|
||
|
" C(x0_th, amp_th) = -0.3396\n",
|
||
|
" C(x0_bec, x0_th) = -0.2393\n",
|
||
|
" C(deltax, sigma_bec) = +0.2377\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2119\n",
|
||
|
" C(x0_th, deltax) = +0.1987\n",
|
||
|
" C(x0_bec, deltax) = +0.1936\n",
|
||
|
" C(x0_bec, amp_th) = -0.1447\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 64\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.24892854\n",
|
||
|
" reduced chi-square = 0.00128314\n",
|
||
|
" Akaike info crit = -1325.78135\n",
|
||
|
" Bayesian info crit = -1305.99145\n",
|
||
|
" R-squared = 0.98358338\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 102.953957 +/- 0.06159581 (0.06%) (init = 102.3486)\n",
|
||
|
" x0_th: 106.714498 +/- 0.50421083 (0.47%) (init = 102.3486)\n",
|
||
|
" amp_bec: 1.11507024 +/- 0.02461020 (2.21%) (init = 1.111452)\n",
|
||
|
" amp_th: 0.36016260 +/- 0.01928361 (5.35%) (init = 0.4763364)\n",
|
||
|
" deltax: 21.2695858 +/- 1.28326798 (6.03%) (init = 70)\n",
|
||
|
" sigma_bec: 7.23601568 +/- 0.11350257 (1.57%) (init = 6.557377)\n",
|
||
|
" sigma_th: 15.5908073 +/- 0.68521274 (4.39%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7412\n",
|
||
|
" C(amp_bec, amp_th) = -0.7307\n",
|
||
|
" C(amp_bec, deltax) = +0.5260\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5167\n",
|
||
|
" C(x0_th, amp_bec) = +0.5011\n",
|
||
|
" C(x0_th, amp_th) = -0.4025\n",
|
||
|
" C(x0_bec, deltax) = +0.2615\n",
|
||
|
" C(x0_bec, x0_th) = -0.2381\n",
|
||
|
" C(deltax, sigma_bec) = +0.2359\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2338\n",
|
||
|
" C(x0_th, deltax) = +0.2307\n",
|
||
|
" C(x0_bec, amp_th) = -0.2022\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.1309\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 183\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04954672\n",
|
||
|
" reduced chi-square = 2.5540e-04\n",
|
||
|
" Akaike info crit = -1648.63134\n",
|
||
|
" Bayesian info crit = -1628.84143\n",
|
||
|
" R-squared = 0.98254713\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.8674401 +/- 0.17581245 (0.18%) (init = 99.98658)\n",
|
||
|
" x0_th: 101.059727 +/- 0.26235413 (0.26%) (init = 99.98658)\n",
|
||
|
" amp_bec: 0.34014506 +/- 0.04523951 (13.30%) (init = 0.4765046)\n",
|
||
|
" amp_th: 0.33934596 +/- 0.04954377 (14.60%) (init = 0.2042163)\n",
|
||
|
" deltax: 2.94951159 +/- 0.68138533 (23.10%) (init = 70)\n",
|
||
|
" sigma_bec: 6.79000309 +/- 0.18420618 (2.71%) (init = 7.377049)\n",
|
||
|
" sigma_th: 5.81912896 +/- 0.35305456 (6.07%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9815\n",
|
||
|
" C(amp_th, deltax) = -0.7382\n",
|
||
|
" C(amp_bec, deltax) = +0.7222\n",
|
||
|
" C(x0_bec, x0_th) = -0.5601\n",
|
||
|
" C(x0_th, amp_bec) = +0.4759\n",
|
||
|
" C(x0_bec, deltax) = +0.4423\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4303\n",
|
||
|
" C(x0_bec, amp_th) = -0.4185\n",
|
||
|
" C(x0_th, amp_th) = -0.3887\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.3633\n",
|
||
|
" C(x0_bec, amp_bec) = +0.3285\n",
|
||
|
" C(x0_bec, sigma_bec) = +0.2297\n",
|
||
|
" C(x0_th, deltax) = +0.1883\n",
|
||
|
" C(deltax, sigma_bec) = -0.1641\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 136\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.05821286\n",
|
||
|
" reduced chi-square = 3.0007e-04\n",
|
||
|
" Akaike info crit = -1616.39328\n",
|
||
|
" Bayesian info crit = -1596.60337\n",
|
||
|
" R-squared = 0.98102125\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 100.802064 +/- 0.30433492 (0.30%) (init = 100.3357)\n",
|
||
|
" x0_th: 101.266474 +/- 0.21019532 (0.21%) (init = 100.3357)\n",
|
||
|
" amp_bec: 0.23410332 +/- 0.05632517 (24.06%) (init = 0.4777521)\n",
|
||
|
" amp_th: 0.45074613 +/- 0.06318336 (14.02%) (init = 0.2047509)\n",
|
||
|
" deltax: 0.70643211 +/- 0.78889990 (111.67%) (init = 70)\n",
|
||
|
" sigma_bec: 7.55525824 +/- 0.33180859 (4.39%) (init = 7.377049)\n",
|
||
|
" sigma_th: 5.14085504 +/- 0.25287762 (4.92%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9900\n",
|
||
|
" C(deltax, sigma_bec) = -0.8578\n",
|
||
|
" C(x0_bec, x0_th) = -0.8449\n",
|
||
|
" C(amp_th, deltax) = -0.5731\n",
|
||
|
" C(amp_bec, deltax) = +0.5678\n",
|
||
|
" C(x0_th, amp_bec) = +0.2477\n",
|
||
|
" C(x0_th, amp_th) = -0.2111\n",
|
||
|
" C(amp_bec, sigma_bec) = -0.1869\n",
|
||
|
" C(x0_bec, deltax) = +0.1764\n",
|
||
|
" C(amp_th, sigma_bec) = +0.1639\n",
|
||
|
" C(x0_bec, amp_th) = -0.1263\n",
|
||
|
"\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 127\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.05971142\n",
|
||
|
" reduced chi-square = 3.0779e-04\n",
|
||
|
" Akaike info crit = -1611.30987\n",
|
||
|
" Bayesian info crit = -1591.51996\n",
|
||
|
" R-squared = 0.97488760\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.3456020 +/- 0.39943861 (0.40%) (init = 99.00787)\n",
|
||
|
" x0_th: 99.2114469 +/- 0.20679698 (0.21%) (init = 99.00787)\n",
|
||
|
" amp_bec: 0.17102413 +/- 0.06043136 (35.33%) (init = 0.4369897)\n",
|
||
|
" amp_th: 0.44276526 +/- 0.06732444 (15.21%) (init = 0.1872813)\n",
|
||
|
" deltax: 1.33029446 +/- 0.90993995 (68.40%) (init = 70)\n",
|
||
|
" sigma_bec: 7.19721323 +/- 0.42925312 (5.96%) (init = 6.557377)\n",
|
||
|
" sigma_th: 5.23773129 +/- 0.29097338 (5.56%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9915\n",
|
||
|
" C(x0_bec, x0_th) = -0.8861\n",
|
||
|
" C(deltax, sigma_bec) = -0.8254\n",
|
||
|
" C(amp_bec, deltax) = +0.5805\n",
|
||
|
" C(amp_th, deltax) = -0.5707\n",
|
||
|
" C(x0_bec, amp_th) = +0.1264\n",
|
||
|
" C(x0_bec, amp_bec) = -0.1174\n",
|
||
|
" C(amp_bec, sigma_bec) = -0.1008\n",
|
||
|
"\n",
|
||
|
"total time: 441.3619041442871 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_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', 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-08-02T12:38:47.328300100Z",
|
||
|
"start_time": "2023-08-02T12:38:45.984715600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.09272930\n",
|
||
|
" reduced chi-square = 4.7799e-04\n",
|
||
|
" Akaike info crit = -1523.27764\n",
|
||
|
" Bayesian info crit = -1503.48773\n",
|
||
|
" R-squared = 0.99495034\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.8354426 +/- 0.03769284 (0.04%) (init = 99.387)\n",
|
||
|
" x0_th: 101.629651 +/- 0.21352060 (0.21%) (init = 99.387)\n",
|
||
|
" amp_bec: 1.05090465 +/- 0.01302118 (1.24%) (init = 1.130844)\n",
|
||
|
" amp_th: 0.51118368 +/- 0.00913050 (1.79%) (init = 0.4846473)\n",
|
||
|
" deltax: 30.3446150 +/- 0.60807796 (2.00%) (init = 39)\n",
|
||
|
" sigma_bec: 6.96828716 +/- 0.06963029 (1.00%) (init = 10.65574)\n",
|
||
|
" sigma_th: 20.1224681 +/- 0.32667975 (1.62%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7350\n",
|
||
|
" C(amp_bec, amp_th) = -0.6490\n",
|
||
|
" C(amp_bec, deltax) = +0.5165\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4831\n",
|
||
|
" C(x0_bec, x0_th) = -0.3205\n",
|
||
|
" C(deltax, sigma_bec) = +0.2008\n",
|
||
|
" C(x0_th, amp_bec) = +0.1948\n",
|
||
|
" C(x0_th, amp_th) = -0.1455\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.08734452\n",
|
||
|
" reduced chi-square = 4.5023e-04\n",
|
||
|
" Akaike info crit = -1535.24246\n",
|
||
|
" Bayesian info crit = -1515.45256\n",
|
||
|
" R-squared = 0.99494009\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 102.335437 +/- 0.04067286 (0.04%) (init = 101.8287)\n",
|
||
|
" x0_th: 105.279805 +/- 0.22091269 (0.21%) (init = 101.8287)\n",
|
||
|
" amp_bec: 0.97859628 +/- 0.01223333 (1.25%) (init = 1.062013)\n",
|
||
|
" amp_th: 0.50421908 +/- 0.00853284 (1.69%) (init = 0.4551486)\n",
|
||
|
" deltax: 32.0927670 +/- 0.60939664 (1.90%) (init = 48)\n",
|
||
|
" sigma_bec: 7.51181131 +/- 0.07545758 (1.00%) (init = 13.11475)\n",
|
||
|
" sigma_th: 21.3715181 +/- 0.32784578 (1.53%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7238\n",
|
||
|
" C(amp_bec, amp_th) = -0.6438\n",
|
||
|
" C(amp_bec, deltax) = +0.4993\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4812\n",
|
||
|
" C(x0_th, amp_bec) = +0.2872\n",
|
||
|
" C(x0_bec, x0_th) = -0.2818\n",
|
||
|
" C(x0_th, amp_th) = -0.2218\n",
|
||
|
" C(deltax, sigma_bec) = +0.1848\n",
|
||
|
" C(x0_th, deltax) = +0.1327\n",
|
||
|
" C(x0_bec, deltax) = +0.1282\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1227\n",
|
||
|
" C(x0_bec, amp_th) = -0.1015\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 0, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.13611721\n",
|
||
|
" reduced chi-square = 7.0164e-04\n",
|
||
|
" Akaike info crit = -1446.51125\n",
|
||
|
" Bayesian info crit = -1426.72135\n",
|
||
|
" R-squared = 0.99157359\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 98.3613008 +/- 0.05156042 (0.05%) (init = 98.33604)\n",
|
||
|
" x0_th: 100.543319 +/- 0.30557874 (0.30%) (init = 98.33604)\n",
|
||
|
" amp_bec: 1.00201340 +/- 0.01630441 (1.63%) (init = 1.097393)\n",
|
||
|
" amp_th: 0.43579104 +/- 0.01231201 (2.83%) (init = 0.4703113)\n",
|
||
|
" deltax: 27.4989065 +/- 0.87247471 (3.17%) (init = 45)\n",
|
||
|
" sigma_bec: 7.71882860 +/- 0.09464359 (1.23%) (init = 12.29508)\n",
|
||
|
" sigma_th: 19.1227333 +/- 0.46831090 (2.45%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7521\n",
|
||
|
" C(amp_bec, amp_th) = -0.7084\n",
|
||
|
" C(amp_bec, deltax) = +0.5622\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4911\n",
|
||
|
" C(x0_bec, x0_th) = -0.3487\n",
|
||
|
" C(x0_th, amp_bec) = +0.2613\n",
|
||
|
" C(deltax, sigma_bec) = +0.2124\n",
|
||
|
" C(x0_th, amp_th) = -0.1973\n",
|
||
|
" C(x0_th, deltax) = +0.1240\n",
|
||
|
" C(x0_bec, deltax) = +0.1216\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 57\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.12371991\n",
|
||
|
" reduced chi-square = 6.3773e-04\n",
|
||
|
" Akaike info crit = -1465.61049\n",
|
||
|
" Bayesian info crit = -1445.82058\n",
|
||
|
" R-squared = 0.99181700\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 101.502799 +/- 0.03909143 (0.04%) (init = 100.9618)\n",
|
||
|
" x0_th: 105.562671 +/- 0.33543462 (0.32%) (init = 100.9618)\n",
|
||
|
" amp_bec: 1.13665535 +/- 0.01583379 (1.39%) (init = 1.110352)\n",
|
||
|
" amp_th: 0.38320597 +/- 0.01104649 (2.88%) (init = 0.4758649)\n",
|
||
|
" deltax: 26.0030327 +/- 0.85522362 (3.29%) (init = 33)\n",
|
||
|
" sigma_bec: 6.66424412 +/- 0.07273994 (1.09%) (init = 9.016393)\n",
|
||
|
" sigma_th: 17.6813732 +/- 0.45476072 (2.57%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7163\n",
|
||
|
" C(amp_bec, amp_th) = -0.6435\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4778\n",
|
||
|
" C(amp_bec, deltax) = +0.4521\n",
|
||
|
" C(x0_th, amp_bec) = +0.4297\n",
|
||
|
" C(x0_th, amp_th) = -0.3514\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2249\n",
|
||
|
" C(deltax, sigma_bec) = +0.2072\n",
|
||
|
" C(x0_bec, deltax) = +0.2008\n",
|
||
|
" C(x0_th, deltax) = +0.1973\n",
|
||
|
" C(x0_bec, x0_th) = -0.1968\n",
|
||
|
" C(x0_bec, amp_th) = -0.1542\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 113\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.22444824\n",
|
||
|
" reduced chi-square = 0.00115695\n",
|
||
|
" Akaike info crit = -1346.48551\n",
|
||
|
" Bayesian info crit = -1326.69560\n",
|
||
|
" R-squared = 0.98416147\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 98.9549320 +/- 0.05592196 (0.06%) (init = 99.07213)\n",
|
||
|
" x0_th: 102.949210 +/- 0.52038274 (0.51%) (init = 99.07213)\n",
|
||
|
" amp_bec: 1.10892477 +/- 0.02103755 (1.90%) (init = 1.137554)\n",
|
||
|
" amp_th: 0.33853991 +/- 0.01508513 (4.46%) (init = 0.4875232)\n",
|
||
|
" deltax: 26.7426768 +/- 1.35056100 (5.05%) (init = 36)\n",
|
||
|
" sigma_bec: 7.06568844 +/- 0.10418604 (1.47%) (init = 9.836066)\n",
|
||
|
" sigma_th: 18.3182217 +/- 0.71793829 (3.92%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7291\n",
|
||
|
" C(amp_bec, amp_th) = -0.6597\n",
|
||
|
" C(amp_th, sigma_bec) = -0.4969\n",
|
||
|
" C(amp_bec, deltax) = +0.4731\n",
|
||
|
" C(x0_th, amp_bec) = +0.4253\n",
|
||
|
" C(x0_th, amp_th) = -0.3454\n",
|
||
|
" C(deltax, sigma_bec) = +0.2352\n",
|
||
|
" C(x0_bec, x0_th) = -0.2195\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2182\n",
|
||
|
" C(x0_bec, deltax) = +0.2020\n",
|
||
|
" C(x0_th, deltax) = +0.2000\n",
|
||
|
" C(x0_bec, amp_th) = -0.1554\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 1, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.20657854\n",
|
||
|
" reduced chi-square = 0.00106484\n",
|
||
|
" Akaike info crit = -1363.07839\n",
|
||
|
" Bayesian info crit = -1343.28849\n",
|
||
|
" R-squared = 0.98284163\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 102.946218 +/- 0.06361855 (0.06%) (init = 102.5758)\n",
|
||
|
" x0_th: 106.536748 +/- 0.48540900 (0.46%) (init = 102.5758)\n",
|
||
|
" amp_bec: 0.98014733 +/- 0.02294517 (2.34%) (init = 0.989391)\n",
|
||
|
" amp_th: 0.33753875 +/- 0.01830965 (5.42%) (init = 0.4240247)\n",
|
||
|
" deltax: 20.5158379 +/- 1.24039521 (6.05%) (init = 36)\n",
|
||
|
" sigma_bec: 7.11629099 +/- 0.11728942 (1.65%) (init = 9.836066)\n",
|
||
|
" sigma_th: 15.1247000 +/- 0.66465471 (4.39%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, deltax) = -0.7441\n",
|
||
|
" C(amp_bec, amp_th) = -0.7413\n",
|
||
|
" C(amp_bec, deltax) = +0.5387\n",
|
||
|
" C(amp_th, sigma_bec) = -0.5356\n",
|
||
|
" C(x0_th, amp_bec) = +0.5029\n",
|
||
|
" C(x0_th, amp_th) = -0.4036\n",
|
||
|
" C(x0_bec, deltax) = +0.2660\n",
|
||
|
" C(x0_bec, x0_th) = -0.2502\n",
|
||
|
" C(deltax, sigma_bec) = +0.2460\n",
|
||
|
" C(x0_th, sigma_bec) = +0.2390\n",
|
||
|
" C(x0_th, deltax) = +0.2319\n",
|
||
|
" C(x0_bec, amp_th) = -0.2061\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.1594\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 141\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.03949380\n",
|
||
|
" reduced chi-square = 2.0358e-04\n",
|
||
|
" Akaike info crit = -1693.98581\n",
|
||
|
" Bayesian info crit = -1674.19591\n",
|
||
|
" R-squared = 0.98176227\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.7678438 +/- 0.19190980 (0.19%) (init = 100)\n",
|
||
|
" x0_th: 101.067180 +/- 0.23971515 (0.24%) (init = 100)\n",
|
||
|
" amp_bec: 0.26736557 +/- 0.03960782 (14.81%) (init = 0.41556)\n",
|
||
|
" amp_th: 0.33634523 +/- 0.04286025 (12.74%) (init = 0.1780971)\n",
|
||
|
" deltax: 2.62760069 +/- 0.60332302 (22.96%) (init = 36)\n",
|
||
|
" sigma_bec: 6.55950771 +/- 0.19375915 (2.95%) (init = 9.836066)\n",
|
||
|
" sigma_th: 5.50670603 +/- 0.29445822 (5.35%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9786\n",
|
||
|
" C(amp_th, deltax) = -0.6733\n",
|
||
|
" C(amp_bec, deltax) = +0.6483\n",
|
||
|
" C(x0_th, amp_bec) = +0.5717\n",
|
||
|
" C(x0_bec, x0_th) = -0.5159\n",
|
||
|
" C(x0_th, amp_th) = -0.4780\n",
|
||
|
" C(x0_bec, deltax) = +0.4633\n",
|
||
|
" C(x0_bec, amp_th) = -0.3809\n",
|
||
|
" C(deltax, sigma_bec) = -0.3392\n",
|
||
|
" C(amp_th, sigma_bec) = -0.3376\n",
|
||
|
" C(x0_bec, amp_bec) = +0.2760\n",
|
||
|
" C(amp_bec, sigma_bec) = +0.2735\n",
|
||
|
" C(x0_th, deltax) = +0.1683\n",
|
||
|
" C(x0_bec, sigma_bec) = +0.1179\n",
|
||
|
" C(x0_th, sigma_bec) = +0.1167\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 106\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04505117\n",
|
||
|
" reduced chi-square = 2.3222e-04\n",
|
||
|
" Akaike info crit = -1667.65476\n",
|
||
|
" Bayesian info crit = -1647.86485\n",
|
||
|
" R-squared = 0.97873064\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 100.433270 +/- 0.32709061 (0.33%) (init = 100.2648)\n",
|
||
|
" x0_th: 101.485639 +/- 0.24429147 (0.24%) (init = 100.2648)\n",
|
||
|
" amp_bec: 0.20334361 +/- 0.04628834 (22.76%) (init = 0.4027935)\n",
|
||
|
" amp_th: 0.36829466 +/- 0.05189107 (14.09%) (init = 0.1726258)\n",
|
||
|
" deltax: 0.56779880 +/- 0.74353282 (130.95%) (init = 36)\n",
|
||
|
" sigma_bec: 7.56299019 +/- 0.32538983 (4.30%) (init = 9.836066)\n",
|
||
|
" sigma_th: 5.07392958 +/- 0.24251374 (4.78%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9843\n",
|
||
|
" C(deltax, sigma_bec) = -0.8321\n",
|
||
|
" C(x0_bec, x0_th) = -0.6861\n",
|
||
|
" C(amp_th, deltax) = -0.4855\n",
|
||
|
" C(amp_bec, deltax) = +0.4749\n",
|
||
|
" C(x0_th, amp_bec) = +0.4308\n",
|
||
|
" C(x0_th, amp_th) = -0.3427\n",
|
||
|
" C(x0_bec, amp_th) = -0.3288\n",
|
||
|
" C(x0_bec, amp_bec) = +0.2369\n",
|
||
|
" C(x0_bec, deltax) = +0.2205\n",
|
||
|
" C(x0_th, sigma_bec) = -0.1766\n",
|
||
|
" C(x0_th, deltax) = +0.1572\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 78\n",
|
||
|
" # data points = 200\n",
|
||
|
" # variables = 6\n",
|
||
|
" chi-square = 0.04056022\n",
|
||
|
" reduced chi-square = 2.0907e-04\n",
|
||
|
" Akaike info crit = -1688.65699\n",
|
||
|
" Bayesian info crit = -1668.86708\n",
|
||
|
" R-squared = 0.97575205\n",
|
||
|
"[[Variables]]\n",
|
||
|
" x0_bec: 99.1543315 +/- 0.26513871 (0.27%) (init = 99.02344)\n",
|
||
|
" x0_th: 99.2158312 +/- 0.23712213 (0.24%) (init = 99.02344)\n",
|
||
|
" amp_bec: 0.20008691 +/- 0.04974921 (24.86%) (init = 0.3681548)\n",
|
||
|
" amp_th: 0.31299257 +/- 0.05502405 (17.58%) (init = 0.1577806)\n",
|
||
|
" deltax: 1.84967609 +/- 0.83746809 (45.28%) (init = 42)\n",
|
||
|
" sigma_bec: 7.05810142 +/- 0.28144016 (3.99%) (init = 11.47541)\n",
|
||
|
" sigma_th: 5.41885231 +/- 0.35836119 (6.61%) == '0.632*sigma_bec + 0.518*deltax'\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.9915\n",
|
||
|
" C(x0_bec, x0_th) = -0.8835\n",
|
||
|
" C(amp_bec, deltax) = +0.6991\n",
|
||
|
" C(amp_th, deltax) = -0.6952\n",
|
||
|
" C(deltax, sigma_bec) = -0.5923\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"total time: 228.96742820739746 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-02T12:39:00.350149500Z",
|
||
|
"start_time": "2023-08-02T12:39:00.116179400Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 241,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"{'x0_bec': 119.96802214244894, 'x0_th': 127.63326165397993, 'amp_bec': 0.010428258179001615, 'amp_th': 0.09970108267412295, 'sigma_bec': 11.583362968593697, 'sigma_th': 38.31090265345486}\n",
|
||
|
"{'x0_bec': 125.05526628410517, 'x0_th': 125.00471649795092, 'amp_bec': 0.17310779365126494, 'amp_th': 0.1720820730247045, 'sigma_bec': 15.656355803721866, 'sigma_th': 27.064591004484093}\n",
|
||
|
"{'x0_bec': 124.87559149065213, 'x0_th': 124.75161622610302, 'amp_bec': 0.29524310149188965, 'amp_th': 0.1743190061268859, 'sigma_bec': 18.491463993335323, 'sigma_th': 26.355871715002863}\n",
|
||
|
"{'x0_bec': 125.0087031646933, 'x0_th': 124.76274722033101, 'amp_bec': 0.33449244741806405, 'amp_th': 0.2075912078840139, 'sigma_bec': 20.02281507393876, 'sigma_th': 21.82533112738463}\n",
|
||
|
"{'x0_bec': 125.14911780036935, 'x0_th': 125.19236477144689, 'amp_bec': 0.43441287165926823, 'amp_th': 0.2269965135606747, 'sigma_bec': 21.735511537553013, 'sigma_th': 19.6332649156627}\n",
|
||
|
"{'x0_bec': 125.19706330180884, 'x0_th': 124.78639501711406, 'amp_bec': 0.41997227368166506, 'amp_th': 0.2875793931907351, 'sigma_bec': 22.38958121135836, 'sigma_th': 16.379048372237175}\n",
|
||
|
"{'x0_bec': 124.84715594771765, 'x0_th': 125.61381776814122, 'amp_bec': 0.5381930903566368, 'amp_th': 0.23325582001073494, 'sigma_bec': 23.585032789989025, 'sigma_th': 15.836761671872054}\n",
|
||
|
"{'x0_bec': 124.92218555160048, 'x0_th': 125.40393566277446, 'amp_bec': 0.641575630362674, 'amp_th': 0.15701297282487195, 'sigma_bec': 23.659196275753484, 'sigma_th': 14.952612046886976}\n",
|
||
|
"{'x0_bec': 125.05529485018604, 'x0_th': 124.61056684483238, 'amp_bec': 0.7041662974914188, 'amp_th': 0.15945931433992006, 'sigma_bec': 24.018516510869162, 'sigma_th': 15.179702435851434}\n",
|
||
|
"{'x0_bec': 125.00552915642254, 'x0_th': 124.83273433653457, 'amp_bec': 0.6312436680683238, 'amp_th': 0.2899623580697538, 'sigma_bec': 23.475566272753557, 'sigma_th': 14.836557888350542}\n",
|
||
|
"{'x0_bec': 125.13250251507971, 'x0_th': 2.1113726467181237e-05, 'amp_bec': 0.751706926485835, 'amp_th': 0.0025372348286596415, 'sigma_bec': 25.996682244092227, 'sigma_th': 42.84825612366779}\n",
|
||
|
"{'x0_bec': 123.12025181484843, 'x0_th': 119.3858125662426, 'amp_bec': 0.1248750197854136, 'amp_th': 0.04921299413104236, 'sigma_bec': 2.6773130629494184, 'sigma_th': 79.38927108420667}\n",
|
||
|
"{'x0_bec': 128.7826875998066, 'x0_th': 122.98234502202587, 'amp_bec': 0.1086002056885337, 'amp_th': 0.32912446348947205, 'sigma_bec': 5.8681870249013, 'sigma_th': 17.649352183985258}\n",
|
||
|
"{'x0_bec': 133.04890815634917, 'x0_th': 124.53647132158325, 'amp_bec': 0.07768742321293798, 'amp_th': 0.5304149914793456, 'sigma_bec': 10.21318890267901, 'sigma_th': 13.983747903493494}\n",
|
||
|
"{'x0_bec': 124.08537876824151, 'x0_th': 124.37027804986349, 'amp_bec': 0.3726209763603042, 'amp_th': 0.34980114480096997, 'sigma_bec': 15.812116733639147, 'sigma_th': 22.25330430738194}\n",
|
||
|
"{'x0_bec': 124.88965546593892, 'x0_th': 126.62325311347529, 'amp_bec': 0.5849767983484745, 'amp_th': 0.13173637531252133, 'sigma_bec': 21.712982871270302, 'sigma_th': 28.28577019267791}\n",
|
||
|
"{'x0_bec': 124.26506757175797, 'x0_th': 126.66714928039417, 'amp_bec': 0.477949933992198, 'amp_th': 0.28488745372951924, 'sigma_bec': 23.492059106409442, 'sigma_th': 16.36203087738575}\n",
|
||
|
"{'x0_bec': 124.90846617585893, 'x0_th': 125.96453374987422, 'amp_bec': 0.5877433930670376, 'amp_th': 0.2515417098434881, 'sigma_bec': 24.811837249290356, 'sigma_th': 15.681082496229646}\n",
|
||
|
"{'x0_bec': 129.2659893429192, 'x0_th': 124.39329582229391, 'amp_bec': 0.25562414490977875, 'amp_th': 1.0922896289826216, 'sigma_bec': 2.9280364190712005, 'sigma_th': 13.566160988675476}\n",
|
||
|
"{'x0_bec': 125.19369316140711, 'x0_th': 125.0204779626329, 'amp_bec': 0.7739057283046865, 'amp_th': 0.20008613477678897, 'sigma_bec': 23.60825700688473, 'sigma_th': 14.920418497108367}\n",
|
||
|
"{'x0_bec': 123.55802227774144, 'x0_th': 129.1082774099857, 'amp_bec': 0.7211782283573324, 'amp_th': 0.2873091764517533, 'sigma_bec': 23.55536595046684, 'sigma_th': 14.886991286937384}\n",
|
||
|
"{'x0_bec': 124.94226465419783, 'x0_th': 124.77029703203435, 'amp_bec': 0.8489210491967903, 'amp_th': 2.0171277696889402e-09, 'sigma_bec': 26.940964686186277, 'sigma_th': 17.051565509418523}\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"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-07-27T15:11:31.398513500Z",
|
||
|
"start_time": "2023-07-27T15:11:30.422715400Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1000x500 with 9 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAzYAAAGoCAYAAACUvHBbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADwWklEQVR4nOzdeXxcZdXA8d+9s0+Smexp2qT7QveNsu9QQMCyIyBC2SzKIoIKFVFQX0BxVxAQBAFFgbIJCKKslaUtbWkppUvaNEmzrzOZzH6f9487SZumaROaZDLJ+X6MZGbuzJzbZJ7c8yzn0ZRSCiGEEEIIIYRIYXqyAxBCCCGEEEKIAyWJjRBCCCGEECLlSWIjhBBCCCGESHmS2AghhBBCCCFSniQ2QgghhBBCiJQniY0QQgghhBAi5UliI4QQQgghhEh51mQHsCfDMKisrCQjIwNN05IdjhDDmlIKv9/PyJEj0fXU6QeRdkSIwUPaESHE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Tm2iM4RWqc461EliI/qE8puNRb3ykJvu6PSYJZHYpMeaBjwuIUTqCSdKw9fTNbHRNI1mi1lpMSIjNkKIhLYmsz1oxEOBZ7fEJl0Sm+FEEhvRJ8I+cwi4EQ856fZOj1kTi39dKgiRtgGPTQiRWkJN5ma/DWTitHX9M9VqS5SQ98tFihDCFGxO7KVny8Jm2dVuZO8+YiNtxpAniY3oE4FmM7Fp1jy47dZOj6VleAmrRK9rQCqjCSH2LZbY7NdnyUbTtC6Ph+w55jdSQl4IkRDzme1B3N15L73cdAd1ZAJScGQ4kMRG9IlQYsQmaPF
|
||
|
},
|
||
|
"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-01T14:12:01.481100400Z",
|
||
|
"start_time": "2023-08-01T14:11:59.693565500Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"## 2D Fit without mathematical constraint"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 33,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
"image 0,0\n",
|
||
|
"0.43511366844177246\n",
|
||
|
"\n",
|
||
|
"image 0,1\n",
|
||
|
"0.39717936515808105\n",
|
||
|
"\n",
|
||
|
"image 0,2\n",
|
||
|
"0.4489865303039551\n",
|
||
|
"\n",
|
||
|
"image 1,0\n",
|
||
|
"0.487781286239624\n",
|
||
|
"\n",
|
||
|
"image 1,1\n",
|
||
|
"0.7651829719543457\n",
|
||
|
"\n",
|
||
|
"image 1,2\n",
|
||
|
"1.0349419116973877\n",
|
||
|
"\n",
|
||
|
"image 2,0\n",
|
||
|
"0.5242712497711182\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"0.11019134521484375\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2,1\n",
|
||
|
"0.34081077575683594\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"0.15068721771240234\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2,2\n",
|
||
|
"0.2700233459472656\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"0.1531531810760498\n",
|
||
|
"\n",
|
||
|
"fitting time = 0.5739162498050265 +- 0.2142232056665018\n",
|
||
|
"[0.43713617 0.3991735 0.4509809 0.48880529 0.79310822 1.03793383\n",
|
||
|
" 0.63744998 0.49448943 0.42616892]\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()\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, 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, 50),\n",
|
||
|
" ('sigmay_bec',bval_1d['sigma_bec'], True, 0, 50),\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",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" # Check if there is an thermal part\n",
|
||
|
" bval = res.best_values\n",
|
||
|
" sigma_cut = max_val(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 > 10000) and (bval['sigma_th'] < min(bval['sigmax_bec'], bval['sigmay_bec']))):\n",
|
||
|
" #check_value = 200\n",
|
||
|
" if check_value < 45:\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, 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, 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',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(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-08-01T09:54:00.016196900Z",
|
||
|
"start_time": "2023-08-01T09:53:54.821332800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
"image 0,0\n",
|
||
|
"time 1st fit: 0.336 s\n",
|
||
|
"\n",
|
||
|
"image 0,1\n",
|
||
|
"time 1st fit: 0.412 s\n",
|
||
|
"\n",
|
||
|
"image 0,2\n",
|
||
|
"time 1st fit: 0.275 s\n",
|
||
|
"\n",
|
||
|
"image 1,0\n",
|
||
|
"time 1st fit: 0.220 s\n",
|
||
|
"\n",
|
||
|
"image 1,1\n",
|
||
|
"time 1st fit: 0.267 s\n",
|
||
|
"\n",
|
||
|
"image 1,2\n",
|
||
|
"time 1st fit: 0.330 s\n",
|
||
|
"\n",
|
||
|
"image 2,0\n",
|
||
|
"time 1st fit: 0.496 s\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"time pure bec fit: 0.320 s\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2,1\n",
|
||
|
"time 1st fit: 0.220 s\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"time pure bec fit: 0.228 s\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"image 2,2\n",
|
||
|
"time 1st fit: 0.194 s\n",
|
||
|
"No thermal part detected, performing fit without thermal function\n",
|
||
|
"time pure bec fit: 0.173 s\n",
|
||
|
"\n",
|
||
|
"fitting time = 0.388 +- 0.177\n",
|
||
|
"max fitting time = 0.819s\n",
|
||
|
"[0.33971286 0.41459203 0.27741361 0.22098398 0.26939559 0.33163404\n",
|
||
|
" 0.81916142 0.45096374 0.3694396 ]\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",
|
||
|
"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",
|
||
|
" 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(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",
|
||
|
"\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-01T15:09:58.809334500Z",
|
||
|
"start_time": "2023-08-01T15:09:55.268128400Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [
|
||
|
"## Plotting"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1400x3600 with 45 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABNYAAAteCAYAAADt3s3jAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydd3gUVduH76GF0IIBQ2/SVTqCCFIE6YgIqMCrBFCKCIL6Iuiru6ufothQLIDSRKooCkIE6RYEqaIU6R1CDS1AAuf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yMhIlixZcsVzIQj/FpKr0hQZGYllWU5+NYASJUokWoORkZHX1mDhpkU+g25skqsKumPHDizLokSJEs6+cePGJTmfJvG2cHmcOXOGTz75hJYtW1KkSBFCQ0MJDQ3ltttu46GHHmLkyJGcOHEi0XmXU6UvubZpXSupZdeuXXz00Ue0b9+esmXLkiNHDrJkyUJERAT169fnrbfeIiYmJk19J4VSiqlTp9KuXTuKFi1K1qxZyZ07NxUrVuTZZ59l8+bNKZ6/aNGiRNe8a9cunnvuOcqVK0f27NnJnTs399xzD5988gnx8fGpsmv69Om0aNGCfPnykTVrVooXL85//vMfli1bBuj8WmbcsWPHpunan3jiCaePPn36pNj2nXfecdo2btz4pk8rIWtQ1uCVrsEffvjBOb9v376pOqdv377OOVFRUZc9ZppRgiAEATh/l8OAAQOc8xo1apRkm+LFiwf1n9zfoEGDkjy/Xr16qTrf5/MFnVe/fv1Unde5c2d17ty5y7puQbhRSeta9p5br169oP2dO3dO9VoShLQgn0E33meQz+dL9tou59yFCxc6+7dv356qOQHU9u3b0/V6bgaioqJUvnz5Ljm3kZGRic5N7v0/KZJrm9a1khoWLlyoLMu6ZN+33nqr+umnn9Jkv5cDBw6oWrVqpThW5syZ1eDBg1O02XvNUVFRKnfu3Mn2d//996uzZ88m29/58+dV+/btkz0/Y8aM6p133lFjxoxx9o0ZM+ZSU5skp06dUmXKlHH6+f7775Nst2rVKpUlSxYFqLx586p9+/alabx/C7IGZQ2mxxq8cOGCKlGihALULbfcomJjY1NsHxsbq2655RYFqKJFi6oLFy5c9phpRXKsCUI60bFjR4YMGQLAr7/+SlxcHJkzZw5qExsbS3h4OPfffz9VqlShUKFCZM6cmb1797Jq1SqmTp1KXFwcgwcPJiIign79+gWd/3//938cPnyY//3vf/z1119A0knZy5Url2jcHDly0LBhQ6pVq0bx4sXJmjUr+/fv56+//mLChAmcPn2acePGkTt3boYOHZp+EyMI/yL69u3Lgw8+yIcffsjChQsBGDFiBBEREUHtihYtej3ME25i5DPon0VERATTp08nOjqaHj16ANCgQYMkf5FP+P4ipMzUqVPp2LEjFy5cAKBixYq0bduWUqVKYVkWu3fv5tdff2XOnDlXzaMorWslNZw9exalFHfccQcNGjSgfPny5MmTh7Nnz7J7926+/fZbVq5cyaFDh2jZsiVr1qyhePHiabqOkydPUrduXf7++28AChQoQNeuXbnjjjs4c+YMP/74I1999RVxcXEMGjSIixcv8uKLL6bY55o1a3j77bdRStGjRw9q1apFSEgIK1asYPjw4Zw+fZoff/yR119/nVdffTXJPrp3785XX30FQNasWYmMjKRWrVpkzJiRFStWMGrUKJ5//nnatWuXpuv2kj17diZOnEitWrWIi4uja9eu/PHHH+TLl89pc+bMGTp06MD58+cBGDNmDAUKFLjisf+pyBqUNZheazBDhgw8+eSTvPjiixw7doyvv/6aTp06Jdt+2rRpHDt2DIBu3bqRIcM1DNC8ZhKeIPxDwKO2Xw7x8fEqe/bszrlr1qxJ1CYqKkrFxcUl28eOHTtUuXLlFKBy5sypTpw4kWQ7768wqWHevHnqzJkzyR4/fPiwqlOnjgJUhgwZ1LZt21LVryDcyKR1LXvPTe4XRK/nmniTCOmJfAbdeJ9BV8NjzeD1XBNP1ytn69atzjrIkCGDGjp0qLp48WKSbY8ePZrkPbnU+//ltL3ctZIaduzYof74448U20ycOFFlyJAhWY8gw6Xs79mzp9OmTp066vjx44nazJkzR2XNmlUBKlOmTEm+93i9ZbA9Sf7+++9E7ZYtW6YyZcrkeKck5TEzb948p5+8efOqdevWJWqzfft2VaxYsaAx0+qxZhgyZIjTV5MmTYJeV08++aRzrHfv3lc0zj8dWYMaWYPptwYPHDigMmfOnKrXRN26dR2Pud27d6dpvLQiwpogJOBKvoyXLVvWOffHH39M0/gLFixw+hg/fnySba7Gh8TWrVudPl977bV061cQrhfetXypv4RfaEVYE64X8hl0430GecWx1Px53xNEWLu2eAWO5EKaL8WN/qU+tTz++OMKUKGhoer8+fNJtknJ/ujoaBUSEqIAlStXLrV///5kx3r77bedvjp16pToeMIv9UuWLEm2r06dOqXYrkWLFs7xyZMnJ9tPwjGvVFi7ePGiatSokdPfe++9p5RS6uuvv3b23XnnnZcMVfu3I2vQRdZg+q1Bb9hpUoKgUkpt2rTJadOiRYs0j5VWpHiBIKQjt9xyi7N95MiRNPVxzz33ONsm8eO14LbbbiN//vzXfFxBEAQhfZDPIOFm5sKFC07hjpw5czJo0KDrbNH1xazl2NhY/vjjj8s+f9asWZw7dw6Azp07O+szKZ566ily5swJwIwZM5wQwKSoUqUK9957b7LH77vvPmd7/fr1QcfOnj3L3LlzAShYsCDt27dPtp/69etTsWLFZI9fLpZl8cUXX5A3b14ABg0axKxZs3jyyScBHQ43adIksmbNmm5j/tOQNRiMrMH0W4M9e/Z0tj///PMk23j3d+/ePV3GvRwkx5ogpCMXL150ti3LSrJNdHQ0X3zxBXPnzmX9+vUcO3aMM2fOJNl
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plt.subplots(shape[0] * shape[1], 5, figsize=(14, 4 * shape[0] * shape[1]),dpi = 100)\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:10:11.571581300Z",
|
||
|
"start_time": "2023-08-01T15:10:04.805510600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 79,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"8.742963672373875\n",
|
||
|
"FWHM_x BEC: 8.74, FWHM_x thermal: 34.83\n",
|
||
|
"FWHM_y BEC: 31.25\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 3.98\n",
|
||
|
"\n",
|
||
|
"image 0, 1\n",
|
||
|
"9.592979643136657\n",
|
||
|
"FWHM_x BEC: 9.59, FWHM_x thermal: 36.62\n",
|
||
|
"FWHM_y BEC: 31.81\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 3.82\n",
|
||
|
"\n",
|
||
|
"image 0, 2\n",
|
||
|
"9.908906632618283\n",
|
||
|
"FWHM_x BEC: 9.91, FWHM_x thermal: 33.38\n",
|
||
|
"FWHM_y BEC: 31.46\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 3.37\n",
|
||
|
"\n",
|
||
|
"image 1, 0\n",
|
||
|
"8.451865807002145\n",
|
||
|
"FWHM_x BEC: 8.45, FWHM_x thermal: 29.08\n",
|
||
|
"FWHM_y BEC: 31.26\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 3.44\n",
|
||
|
"\n",
|
||
|
"image 1, 1\n",
|
||
|
"8.984709061577554\n",
|
||
|
"FWHM_x BEC: 8.98, FWHM_x thermal: 30.65\n",
|
||
|
"FWHM_y BEC: 30.46\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 3.41\n",
|
||
|
"\n",
|
||
|
"image 1, 2\n",
|
||
|
"9.13705851096225\n",
|
||
|
"FWHM_x BEC: 9.14, FWHM_x thermal: 26.96\n",
|
||
|
"FWHM_y BEC: 30.05\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 2.95\n",
|
||
|
"\n",
|
||
|
"image 2, 0\n",
|
||
|
"9.424910150431879\n",
|
||
|
"FWHM_x BEC: 9.42, FWHM_x thermal: 20.56\n",
|
||
|
"FWHM_y BEC: 23.24\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 2.18\n",
|
||
|
"\n",
|
||
|
"image 2, 1\n",
|
||
|
"9.984465643230875\n",
|
||
|
"FWHM_x BEC: 9.98, FWHM_x thermal: 13.17\n",
|
||
|
"FWHM_y BEC: 25.10\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 1.32\n",
|
||
|
"\n",
|
||
|
"image 2, 2\n",
|
||
|
"9.673268801961996\n",
|
||
|
"FWHM_x BEC: 9.67, FWHM_x thermal: 16.33\n",
|
||
|
"FWHM_y BEC: 25.82\n",
|
||
|
"Ratio fwhm_th/fwhm_bec: 1.69\n",
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"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:30:35.414890800Z",
|
||
|
"start_time": "2023-07-31T14:30:35.286938800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 68,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "0.7"
|
||
|
},
|
||
|
"execution_count": 68,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"min(1,0.7)"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T14:19:56.420085200Z",
|
||
|
"start_time": "2023-07-31T14:19:56.277035400Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"source": [],
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 87,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"check val, 662.7793434743033\n",
|
||
|
"image 0, 1\n",
|
||
|
"check val, 713.610309645711\n",
|
||
|
"image 0, 2\n",
|
||
|
"check val, 497.12597829782794\n",
|
||
|
"image 1, 0\n",
|
||
|
"check val, 381.5418168254633\n",
|
||
|
"image 1, 1\n",
|
||
|
"check val, 354.93862545132276\n",
|
||
|
"image 1, 2\n",
|
||
|
"check val, 262.51288650321334\n",
|
||
|
"image 2, 0\n",
|
||
|
"check val, 35.00413081069709\n",
|
||
|
"image 2, 1\n",
|
||
|
"check val, 5.670846546163999\n",
|
||
|
"image 2, 2\n",
|
||
|
"check val, 19.63092306582446\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<Figure size 1000x1000 with 9 Axes>",
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0QAAAMtCAYAAAC/4rG8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQG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RMUQkvkXjelQcEYlvjXE9NqjKXFNQEBJpOWLxeozFcxZprWL1eozV8xZpjRrjeoxOrToREREREZEYpIRIRERERETilhIiERERERGJW0qIREREREQkbikhEhERERGRuKWESERERERE4pYSIhERERERiVtKiEREREREJG4pIRIRERERkbilhEhEREREROKWEiIREREREYlbSohERERERCRuKSESEREREZG4pYRIRERERETilhIiERERERGJW0qIREREREQkbikhEhERERGRuKWESERERERE4pYSIhERERERiVv1SojuuecedOvWDYFAABs2bAAAVFdXIzMz0z969eqFhIQE7Nu3DwBw7bXXonv37v79jzzySNTfhIjEDsUREWkIxRARibaE+jx41KhR+Pd//3cMGDDAvy0pKckPSADw8MMPo7i4GF/96lf92x555BGMGDGiwScrIrFPcUREGkIxRESirV4J0TXXXPOFj1m4cCHy8vLO+oREpHVTHBGRhlAMEZFoi+oaor/85S/4+9//ju9///t1bv/5z3+OjIwMjBkzBtu3bz/tc9TU1GD//v11DhGJHw2NI4ohIvFNbRERqa+oJkQLFy7E7bffjoSE8MDTU089hffeew9vv/02Bg4c+LkAdaK8vDwkJib6R2pqajRPUURauIbGEcUQkfimtoiI1FeAJOv7Q926dcMf/vAHZGZm+rcdOHAAKSkpeOutt3DJJZec8me//OUv48MPP0RSUtJJ76+pqUFNTY3//f79+5GamopQKIROnTrV91RFJIr279+PxMTEqFyPjRVHFENEWq5YiCGA4ohISxbNOOKp1xqi01m2bBkuu+yyOgHo6NGjqK6uxgUXXAAAKCoqwgUXXHDKAAQA7dq1Q7t27aJ1WiISQ6IRRxRDROKX2iIicjbqlRDdddddWLFiBaqqqvCd73wHHTt2xNatWwHYEPW//uu/1nl8TU0Nvve976GmpgZt2rRB586d8dxzz0Xv7EUk5iiOiEhDKIaISLSd1ZS5ptQYw2IicnZi8XqMxXMWaa1i9XqM1fMWaY0a43qMalEFERERERGRWKKESERERERE4pYSIhERERERiVtKiEREREREJG4pIRIRERERkbilhEhEREREROKWEiIREREREYlbSohERERERCRuKSESEREREZG4pYRIRERERETilhIiERERERGJW0qIREREREQkbikhEhERERGRuKWESERERERE4pYSIhERERERiVtKiEREREREJG4pIRIRERERkbilhEhEREREROKWEiIREREREYlbSohERERERCRu1Sshuueee9CtWzcEAgFs2LDBv71bt264+OKLkZmZiczMTCxbtsy/r6KiAt/61rfQq1cvXHHFFdi0aVPUTl5EYo/iiIg0hGKIiERbvRKiUaNGoaSkBGlpaZ+7b9myZdiwYQM2bNiAMWPG+LffddddmDBhArZs2YJp06Zh7NixDT5pEYldiiMi0hCKISISbfVKiK655hp06dLljB+/Z88erFu3Dj/+8Y8BADfffDMqKyuxdevWU/5MTU0N9u/fX+cQkdajseOIYohI66a2iIhEW9TWEN1+++3IyMjA+PHjsXfvXgBAZWUlUlJSkJCQAAAIBALo2rUrdu7cecrnycvLQ2Jion+kpqZG6xRFpIWLRhxRDBGJX2qLiMjZiEpC9MYbb+Dtt9/G+vXr0blzZ9xxxx1n/VzTp09HKBTyj8rKymicooi0cNGKI4ohIvFJbREROVsJ0XiSrl27AgDOOeccTJ48Gb169QIApKamYvfu3Th69CgSEhJAEjt37vQffzLt2rVDu3btonFaIhJDohVHFENE4pPaIiJytho8QnTw4EH84x//8L8vKChAnz59AADJycm4/PLLsWTJEgBAUVERunTpgp49ezb0ZUWkFVEcEZGGUAwRkYYIkOSZPviuu+7CihUrUFVVhaSkJHTs2BGrVq3CzTffjGPHjoEkLrzwQsydOxfdunUDAGzevBljx45FdXU1OnXqhEWLFiEjI+OMT3D//v1ITExEKBRCp06d6v0GRSR6onE9NnUcUQwRaTliMYZE67xFJDoa43qsV0LUHBSERFqOWLweY/GcRVqrWL0eY/W8RVqjxrgeo1ZlTkREREREJNYoIRIRERERkbilhEhEREREROKWEiIREREREYlbSohERERERCRuKSESEREREZG4pYRIGl0gkIvAP9u/IiIiIiItSUJzn4DEvkAAAHIBZAN41N06HIDb9K5zDlDuPTYXwL8DmF33SYbkAJsBVJaDTG/0cxYRERERATRCJCIiIiIicUwJkdRbIPC2TYNzB7AUwA1An6/aAzJyADwPdDzHjk8+gI0gARiZgxRWAbgEwEh3AHhlGbAEQH66Pe+3NcVORERERBqfEiI5I4EAIhKg37tbM9yxFcAfgXkAZuYA7+QC+TnAUdiBJwGMth/5A7B7WXcA77nncc+VMQYYlAt8zT3165YMBc51RyAXgcD6xn6bIiIiIhJnlBDJKQV+6Y4fwJYE+cYDU3KA7j+wY2WO3Xx1LnB/LVCYAywG8BN3AACetn/mAbgIwC05dV/snaVAnxzgtqXuhp72w5/lAp/lIpnjgITLI5IyERERERO43es8XYZAoNa+vggI/MIdASBwKdz9Xkfv+hNmvEi8CpBkc5/E6ezfvx+JiYkIhULo1KlTc59OXLCgkAN/mtuUHOCR9UDW5cBTuehw8Kc48JXVAPrY/YO7AN2AxMeqEGr3OIDRSOZXsOcHXe3+IQB+WgHg/8IvMioH+J2rtJCSDuz
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"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",
|
||
|
" 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 * bval['sigmay_bec'], sigmay=1.5* bval['sigmay_bec'])\n",
|
||
|
"\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",
|
||
|
"\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",
|
||
|
" # print(f'mean = {np.nanmean(mask[i,j])}, {np.nanmean(mask2[i,j])}, {np.nanmean(mask[i,j]) / np.nanmean(mask2[i,j])}')\n",
|
||
|
" # print(f'std = {np.nanstd(mask[i,j])}')\n",
|
||
|
" # print()\n",
|
||
|
"\n",
|
||
|
" # frac = 1\n",
|
||
|
" # temp_res = mask[i,j, round(bval['y0_bec'] - frac * bval['sigmay_bec']) : round(bval['y0_bec'] + frac * bval['sigmay_bec']),:]\n",
|
||
|
" # temp_1d = np.nansum(temp_res, axis=0)\n",
|
||
|
" #\n",
|
||
|
" # print(f'sum = {np.nansum(temp_1d) / np.max(cropOD[i,j])}')\n",
|
||
|
" # print(f'sum = {np.nanmax(temp_1d)/np.max(cropOD[i,j])}')\n",
|
||
|
" #\n",
|
||
|
" # plt.pcolormesh(temp_res, cmap='jet')\n",
|
||
|
" # plt.show()\n",
|
||
|
" # plt.plot(temp_1d)\n",
|
||
|
" # plt.show()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-31T14:50:00.463480800Z",
|
||
|
"start_time": "2023-07-31T14:49:58.256456600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 184,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "<lmfit.model.ModelResult at 0x2218584a2e0>",
|
||
|
"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>37</td><td></td></tr><tr><td># data points</td><td>22500</td><td></td></tr><tr><td># variables</td><td>10</td><td></td></tr><tr><td>chi-square</td><td> 123.640240</td><td></td></tr><tr><td>reduced chi-square</td><td> 0.00549757</td><td></td></tr><tr><td>Akaike info crit.</td><td>-117067.627</td><td></td></tr><tr><td>Bayesian info crit.</td><td>-116987.414</td><td></td></tr><tr><td>R-squared</td><td> 0.47944732</td><td></td></tr></table><h2>Variables</h2><table><tr><th> name </th><th> value </th><th> initial value </th><th> min </th><th> max </th><th> vary </th></tr><tr><td> amp_bec </td><td> 0.61193858 </td><td> 1.968151937064731e-12 </td><td> 0.00000000 </td><td> 0.65991144 </td><td> True </td></tr><tr><td> amp_th </td><td> 0.48039266 </td><td> 0.48823333543890163 </td><td> 0.00000000 </td><td> 0.65991144 </td><td> True </td></tr><tr><td> x0_bec </td><td> 55.0967026 </td><td> 77.48577844311376 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> y0_bec </td><td> 1.81368096 </td><td> 59.377245508982035 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> x0_th </td><td> 77.5002102 </td><td> 77.48577844311376 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> y0_th </td><td> 59.3734734 </td><td> 59.377245508982035 </td><td> 0.00000000 </td><td> 150.000000 </td><td> True </td></tr><tr><td> sigmax_bec </td><td> 47.2167683 </td><td> 46.06829907863238 </td><td> 0.00000000 </td><td> 50.0000000 </td><td> True </td></tr><tr><td> sigmay_bec </td><td> 0.03876382 </td><td> 43.0 </td><td> 0.00000000 </td><td> 50.0000000 </td><td> True </td></tr><tr><td> sigmax_th </td><td> 31.3309277 </td><td> 31.72784973867995 </td><td> 0.00000000 </td><td> 50.0000000 </td><td> True </td></tr><tr><td> sigmay_th </td><td> 31.3818354 </td><td> 31.72784973867995 </td><td> 0.00000000 </td><td> 50.0000000 </td><td> True </td></tr></table>"
|
||
|
},
|
||
|
"execution_count": 184,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"result[1][0]"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-07-26T12:44:48.945457900Z",
|
||
|
"start_time": "2023-07-26T12:44:48.911712800Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"image 0, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 61\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 247.046739\n",
|
||
|
" reduced chi-square = 0.00617756\n",
|
||
|
" Akaike info crit = -203464.288\n",
|
||
|
" Bayesian info crit = -203386.918\n",
|
||
|
" R-squared = 0.77102021\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.31934618 +/- 0.01009205 (0.76%) (init = 1.824597)\n",
|
||
|
" amp_th: 0.67904205 +/- 0.00727262 (1.07%) (init = 0.8330863)\n",
|
||
|
" x0_bec: 99.8592458 +/- 0.02150100 (0.02%) (init = 99.66897)\n",
|
||
|
" y0_bec: 100.303113 +/- 0.08978268 (0.09%) (init = 99.53103)\n",
|
||
|
" x0_th: 101.408228 +/- 0.10950225 (0.11%) (init = 99.66897)\n",
|
||
|
" y0_th: 99.4582944 +/- 0.12624325 (0.13%) (init = 99.53103)\n",
|
||
|
" sigmax_bec: 7.16636367 +/- 0.04330613 (0.60%) (init = 6.982416)\n",
|
||
|
" sigmay_bec: 25.6141132 +/- 0.14247207 (0.56%) (init = 25)\n",
|
||
|
" sigma_th: 18.0473888 +/- 0.11266887 (0.62%) (init = 20.03728)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8230\n",
|
||
|
" C(amp_bec, amp_th) = -0.5984\n",
|
||
|
" C(y0_bec, y0_th) = -0.5678\n",
|
||
|
" C(amp_bec, sigma_th) = +0.4863\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.4568\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.3779\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.3322\n",
|
||
|
" C(x0_bec, x0_th) = -0.2776\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.2336\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.1729\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.1444\n",
|
||
|
" C(amp_bec, x0_th) = +0.1337\n",
|
||
|
" C(amp_th, x0_th) = -0.1108\n",
|
||
|
"image 0, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 51\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 229.024540\n",
|
||
|
" reduced chi-square = 0.00572690\n",
|
||
|
" Akaike info crit = -206494.223\n",
|
||
|
" Bayesian info crit = -206416.853\n",
|
||
|
" R-squared = 0.79748219\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.32075345 +/- 0.00914587 (0.69%) (init = 1.538985)\n",
|
||
|
" amp_th: 0.69326305 +/- 0.00657972 (0.95%) (init = 0.7362974)\n",
|
||
|
" x0_bec: 102.344791 +/- 0.02145006 (0.02%) (init = 101.9209)\n",
|
||
|
" y0_bec: 94.5230493 +/- 0.08340649 (0.09%) (init = 95.42791)\n",
|
||
|
" x0_th: 105.187689 +/- 0.10524042 (0.10%) (init = 101.9209)\n",
|
||
|
" y0_th: 99.1003993 +/- 0.11899732 (0.12%) (init = 95.42791)\n",
|
||
|
" sigmax_bec: 7.86309807 +/- 0.04314916 (0.55%) (init = 7.618101)\n",
|
||
|
" sigmay_bec: 26.0773312 +/- 0.13174481 (0.51%) (init = 26)\n",
|
||
|
" sigma_th: 18.9718919 +/- 0.10495500 (0.55%) (init = 20.94591)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8173\n",
|
||
|
" C(amp_bec, amp_th) = -0.5660\n",
|
||
|
" C(y0_bec, y0_th) = -0.5023\n",
|
||
|
" C(amp_bec, sigma_th) = +0.4415\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.4264\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.3476\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.2973\n",
|
||
|
" C(x0_bec, x0_th) = -0.2497\n",
|
||
|
" C(amp_th, y0_bec) = -0.2390\n",
|
||
|
" C(y0_bec, sigma_th) = +0.2366\n",
|
||
|
" C(amp_bec, x0_th) = +0.2142\n",
|
||
|
" C(amp_th, x0_th) = -0.1863\n",
|
||
|
" C(amp_bec, y0_th) = +0.1861\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.1548\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.1527\n",
|
||
|
" C(y0_th, sigmay_bec) = -0.1469\n",
|
||
|
" C(y0_th, sigmax_bec) = +0.1334\n",
|
||
|
" C(x0_th, sigma_th) = +0.1255\n",
|
||
|
" C(x0_th, sigmax_bec) = +0.1130\n",
|
||
|
"image 0, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 232.025186\n",
|
||
|
" reduced chi-square = 0.00580194\n",
|
||
|
" Akaike info crit = -205973.552\n",
|
||
|
" Bayesian info crit = -205896.183\n",
|
||
|
" R-squared = 0.75801518\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.27824056 +/- 0.00976448 (0.76%) (init = 1.67635)\n",
|
||
|
" amp_th: 0.58603540 +/- 0.00788939 (1.35%) (init = 0.699501)\n",
|
||
|
" x0_bec: 98.3564377 +/- 0.02323775 (0.02%) (init = 98.19883)\n",
|
||
|
" y0_bec: 96.7984319 +/- 0.08878690 (0.09%) (init = 97.27485)\n",
|
||
|
" x0_th: 100.517679 +/- 0.12706988 (0.13%) (init = 98.19883)\n",
|
||
|
" y0_th: 100.627807 +/- 0.14812606 (0.15%) (init = 97.27485)\n",
|
||
|
" sigmax_bec: 8.12205462 +/- 0.04712080 (0.58%) (init = 7.768304)\n",
|
||
|
" sigmay_bec: 25.7852479 +/- 0.13613910 (0.53%) (init = 26)\n",
|
||
|
" sigma_th: 17.2967431 +/- 0.13017535 (0.75%) (init = 18.84049)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8277\n",
|
||
|
" C(amp_bec, amp_th) = -0.6398\n",
|
||
|
" C(y0_bec, y0_th) = -0.5587\n",
|
||
|
" C(amp_bec, sigma_th) = +0.5098\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.4654\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.3776\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.3257\n",
|
||
|
" C(x0_bec, x0_th) = -0.3105\n",
|
||
|
" C(amp_th, y0_bec) = -0.2353\n",
|
||
|
" C(y0_bec, sigma_th) = +0.2332\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.2301\n",
|
||
|
" C(amp_bec, x0_th) = +0.2094\n",
|
||
|
" C(amp_th, x0_th) = -0.1837\n",
|
||
|
" C(amp_bec, y0_th) = +0.1811\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.1810\n",
|
||
|
" C(y0_th, sigmay_bec) = -0.1618\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.1433\n",
|
||
|
" C(y0_th, sigmax_bec) = +0.1296\n",
|
||
|
" C(x0_th, sigma_th) = +0.1244\n",
|
||
|
" C(x0_th, sigmax_bec) = +0.1170\n",
|
||
|
"image 1, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 234.169580\n",
|
||
|
" reduced chi-square = 0.00585556\n",
|
||
|
" Akaike info crit = -205605.567\n",
|
||
|
" Bayesian info crit = -205528.198\n",
|
||
|
" R-squared = 0.73179740\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.40347540 +/- 0.01068562 (0.76%) (init = 1.904043)\n",
|
||
|
" amp_th: 0.56524406 +/- 0.00863206 (1.53%) (init = 0.6431659)\n",
|
||
|
" x0_bec: 101.519232 +/- 0.01947097 (0.02%) (init = 101.3475)\n",
|
||
|
" y0_bec: 96.5096334 +/- 0.08602950 (0.09%) (init = 96.61864)\n",
|
||
|
" x0_th: 105.062689 +/- 0.13874695 (0.13%) (init = 101.3475)\n",
|
||
|
" y0_th: 98.8821654 +/- 0.15172799 (0.15%) (init = 96.61864)\n",
|
||
|
" sigmax_bec: 6.92775886 +/- 0.03967026 (0.57%) (init = 6.659387)\n",
|
||
|
" sigmay_bec: 25.6247717 +/- 0.13703981 (0.53%) (init = 19)\n",
|
||
|
" sigma_th: 15.0673220 +/- 0.13021800 (0.86%) (init = 16.99271)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8043\n",
|
||
|
" C(amp_bec, amp_th) = -0.6340\n",
|
||
|
" C(y0_bec, y0_th) = -0.5748\n",
|
||
|
" C(amp_bec, sigma_th) = +0.4739\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.4575\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.4201\n",
|
||
|
" C(amp_bec, x0_th) = +0.3549\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.3271\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.2997\n",
|
||
|
" C(amp_th, x0_th) = -0.2990\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.2461\n",
|
||
|
" C(x0_bec, x0_th) = -0.2331\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.2136\n",
|
||
|
" C(x0_th, sigmax_bec) = +0.2051\n",
|
||
|
" C(x0_th, sigma_th) = +0.1844\n",
|
||
|
" C(amp_th, y0_bec) = -0.1564\n",
|
||
|
" C(y0_bec, sigma_th) = +0.1445\n",
|
||
|
" C(x0_bec, sigma_th) = +0.1291\n",
|
||
|
" C(y0_th, sigmay_bec) = -0.1209\n",
|
||
|
" C(amp_bec, y0_th) = +0.1170\n",
|
||
|
" C(amp_th, x0_bec) = -0.1073\n",
|
||
|
"image 1, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 91\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 232.929502\n",
|
||
|
" reduced chi-square = 0.00582455\n",
|
||
|
" Akaike info crit = -205817.956\n",
|
||
|
" Bayesian info crit = -205740.586\n",
|
||
|
" R-squared = 0.72067971\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.40719275 +/- 0.01046855 (0.74%) (init = 1.83699)\n",
|
||
|
" amp_th: 0.48616174 +/- 0.00831908 (1.71%) (init = 0.5575412)\n",
|
||
|
" x0_bec: 98.9794959 +/- 0.02027036 (0.02%) (init = 98.95161)\n",
|
||
|
" y0_bec: 97.7295544 +/- 0.08171971 (0.08%) (init = 97.95968)\n",
|
||
|
" x0_th: 102.630620 +/- 0.16089936 (0.16%) (init = 98.95161)\n",
|
||
|
" y0_th: 99.7626830 +/- 0.17552136 (0.18%) (init = 97.95968)\n",
|
||
|
" sigmax_bec: 7.36451562 +/- 0.04127307 (0.56%) (init = 7.097801)\n",
|
||
|
" sigmay_bec: 24.9681532 +/- 0.12873770 (0.52%) (init = 21)\n",
|
||
|
" sigma_th: 15.8800975 +/- 0.15276223 (0.96%) (init = 17.9694)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8122\n",
|
||
|
" C(amp_bec, amp_th) = -0.6380\n",
|
||
|
" C(y0_bec, y0_th) = -0.5792\n",
|
||
|
" C(amp_bec, sigma_th) = +0.4890\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.4706\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.3934\n",
|
||
|
" C(amp_bec, x0_th) = +0.3513\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.3201\n",
|
||
|
" C(amp_th, x0_th) = -0.2983\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.2903\n",
|
||
|
" C(x0_bec, x0_th) = -0.2397\n",
|
||
|
" C(x0_th, sigmax_bec) = +0.2019\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.2004\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.1948\n",
|
||
|
" C(x0_th, sigma_th) = +0.1902\n",
|
||
|
" C(amp_th, y0_bec) = -0.1328\n",
|
||
|
" C(x0_bec, sigma_th) = +0.1328\n",
|
||
|
" C(y0_bec, sigma_th) = +0.1271\n",
|
||
|
" C(amp_th, x0_bec) = -0.1117\n",
|
||
|
" C(amp_bec, y0_th) = +0.1000\n",
|
||
|
"image 1, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 81\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 241.484694\n",
|
||
|
" reduced chi-square = 0.00603848\n",
|
||
|
" Akaike info crit = -204375.146\n",
|
||
|
" Bayesian info crit = -204297.776\n",
|
||
|
" R-squared = 0.67305921\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 1.26455146 +/- 0.01175333 (0.93%) (init = 1.472472)\n",
|
||
|
" amp_th: 0.48409519 +/- 0.01049912 (2.17%) (init = 0.4777332)\n",
|
||
|
" x0_bec: 102.962969 +/- 0.02391738 (0.02%) (init = 102.3486)\n",
|
||
|
" y0_bec: 105.037639 +/- 0.09486704 (0.09%) (init = 104.4171)\n",
|
||
|
" x0_th: 106.295620 +/- 0.17100686 (0.16%) (init = 102.3486)\n",
|
||
|
" y0_th: 105.408774 +/- 0.18690026 (0.18%) (init = 104.4171)\n",
|
||
|
" sigmax_bec: 7.48939222 +/- 0.04887802 (0.65%) (init = 7.256146)\n",
|
||
|
" sigmay_bec: 24.6288905 +/- 0.14940579 (0.61%) (init = 26)\n",
|
||
|
" sigma_th: 13.9697416 +/- 0.16240408 (1.16%) (init = 15.48618)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8163\n",
|
||
|
" C(amp_bec, amp_th) = -0.7127\n",
|
||
|
" C(y0_bec, y0_th) = -0.6380\n",
|
||
|
" C(amp_bec, sigma_th) = +0.5452\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.5006\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.4515\n",
|
||
|
" C(amp_bec, x0_th) = +0.4070\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.4043\n",
|
||
|
" C(amp_th, x0_th) = -0.3352\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.3336\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.3230\n",
|
||
|
" C(x0_bec, x0_th) = -0.2785\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.2434\n",
|
||
|
" C(x0_th, sigmax_bec) = +0.2206\n",
|
||
|
" C(x0_th, sigma_th) = +0.2082\n",
|
||
|
" C(x0_bec, sigma_th) = +0.1599\n",
|
||
|
" C(amp_bec, sigmax_bec) = +0.1521\n",
|
||
|
" C(amp_th, x0_bec) = -0.1305\n",
|
||
|
"image 2, 0\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 151\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 207.684294\n",
|
||
|
" reduced chi-square = 0.00519328\n",
|
||
|
" Akaike info crit = -210406.625\n",
|
||
|
" Bayesian info crit = -210329.255\n",
|
||
|
" R-squared = 0.23906110\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 0.62285889 +/- 0.01649992 (2.65%) (init = 0.4089507)\n",
|
||
|
" amp_th: 0.13118466 +/- 0.01796398 (13.69%) (init = 0.4833068)\n",
|
||
|
" x0_bec: 100.277911 +/- 0.05773887 (0.06%) (init = 99.98658)\n",
|
||
|
" y0_bec: 98.2099773 +/- 0.17895453 (0.18%) (init = 96.96644)\n",
|
||
|
" x0_th: 101.069302 +/- 0.59470724 (0.59%) (init = 99.98658)\n",
|
||
|
" y0_th: 97.7801656 +/- 0.73862605 (0.76%) (init = 96.96644)\n",
|
||
|
" sigmax_bec: 7.72533619 +/- 0.11468980 (1.48%) (init = 6.678403)\n",
|
||
|
" sigmay_bec: 19.0497745 +/- 0.26152390 (1.37%) (init = 20)\n",
|
||
|
" sigma_th: 10.6505394 +/- 0.67263483 (6.32%) (init = 5.580156)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_th, sigma_th) = -0.8683\n",
|
||
|
" C(amp_bec, amp_th) = -0.8636\n",
|
||
|
" C(y0_bec, y0_th) = -0.7439\n",
|
||
|
" C(amp_bec, sigma_th) = +0.7348\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.5918\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.5373\n",
|
||
|
" C(x0_bec, x0_th) = -0.5308\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.5227\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.4443\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.4259\n",
|
||
|
" C(amp_bec, sigmax_bec) = +0.3677\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.3103\n",
|
||
|
" C(amp_bec, x0_th) = +0.1663\n",
|
||
|
" C(amp_th, x0_th) = -0.1310\n",
|
||
|
"image 2, 1\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 49\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 5\n",
|
||
|
" chi-square = 209.533419\n",
|
||
|
" reduced chi-square = 0.00523899\n",
|
||
|
" Akaike info crit = -210060.060\n",
|
||
|
" Bayesian info crit = -210017.076\n",
|
||
|
" R-squared = 0.23759500\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 0.69127745 +/- 0.00757729 (1.10%) (init = 0.2618542)\n",
|
||
|
" amp_th: 0 (fixed)\n",
|
||
|
" x0_bec: 101.046610 +/- 0.04742743 (0.05%) (init = 100.3357)\n",
|
||
|
" y0_bec: 97.7982769 +/- 0.09899886 (0.10%) (init = 97.65734)\n",
|
||
|
" x0_th: 1 (fixed)\n",
|
||
|
" y0_th: 1 (fixed)\n",
|
||
|
" sigmax_bec: 9.18236869 +/- 0.08844045 (0.96%) (init = 7.527351)\n",
|
||
|
" sigmay_bec: 19.1419473 +/- 0.18519445 (0.97%) (init = 18)\n",
|
||
|
" sigma_th: 1 (fixed)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.3788\n",
|
||
|
" C(amp_bec, sigmax_bec) = -0.3766\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.1421\n",
|
||
|
"image 2, 2\n",
|
||
|
"[[Fit Statistics]]\n",
|
||
|
" # fitting method = leastsq\n",
|
||
|
" # function evals = 71\n",
|
||
|
" # data points = 40000\n",
|
||
|
" # variables = 9\n",
|
||
|
" chi-square = 205.318706\n",
|
||
|
" reduced chi-square = 0.00513412\n",
|
||
|
" Akaike info crit = -210864.852\n",
|
||
|
" Bayesian info crit = -210787.482\n",
|
||
|
" R-squared = 0.21806770\n",
|
||
|
"[[Variables]]\n",
|
||
|
" amp_bec: 0.49993734 +/- 0.01804222 (3.61%) (init = 0.1848398)\n",
|
||
|
" amp_th: 0.18283153 +/- 0.02342192 (12.81%) (init = 0.6686606)\n",
|
||
|
" x0_bec: 99.2615822 +/- 0.07624910 (0.08%) (init = 99.00787)\n",
|
||
|
" y0_bec: 99.3942586 +/- 0.22840951 (0.23%) (init = 98.74016)\n",
|
||
|
" x0_th: 98.5713318 +/- 0.47349725 (0.48%) (init = 99.00787)\n",
|
||
|
" y0_th: 98.8255205 +/- 0.52360404 (0.53%) (init = 98.74016)\n",
|
||
|
" sigmax_bec: 7.92890885 +/- 0.13637740 (1.72%) (init = 7.168005)\n",
|
||
|
" sigmay_bec: 21.1678273 +/- 0.40278786 (1.90%) (init = 20)\n",
|
||
|
" sigma_th: 8.46160735 +/- 0.44576686 (5.27%) (init = 5.038646)\n",
|
||
|
"[[Correlations]] (unreported correlations are < 0.100)\n",
|
||
|
" C(amp_bec, amp_th) = -0.8980\n",
|
||
|
" C(amp_th, sigma_th) = -0.7918\n",
|
||
|
" C(y0_bec, y0_th) = -0.7348\n",
|
||
|
" C(amp_bec, sigmay_bec) = -0.6909\n",
|
||
|
" C(amp_th, sigmay_bec) = +0.6617\n",
|
||
|
" C(sigmay_bec, sigma_th) = -0.6609\n",
|
||
|
" C(amp_bec, sigma_th) = +0.6551\n",
|
||
|
" C(x0_bec, x0_th) = -0.6410\n",
|
||
|
" C(amp_th, sigmax_bec) = -0.5265\n",
|
||
|
" C(amp_bec, sigmax_bec) = +0.3741\n",
|
||
|
" C(sigmax_bec, sigmay_bec) = -0.3589\n",
|
||
|
" C(sigmax_bec, sigma_th) = +0.2237\n",
|
||
|
" C(amp_bec, x0_th) = -0.1989\n",
|
||
|
" C(amp_th, x0_th) = +0.1528\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"for i in range(0, shape[0]):\n",
|
||
|
" for j in range(0, shape[1]):\n",
|
||
|
" print(f'image {i}, {j}')\n",
|
||
|
" lmfit.report_fit(result[i][j])"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T09:12:50.393603600Z",
|
||
|
"start_time": "2023-08-01T09:12:50.285304600Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": "(-1.8369701987210297e-16-1j)"
|
||
|
},
|
||
|
"execution_count": 28,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a = -1\n",
|
||
|
"a**(3/2)"
|
||
|
],
|
||
|
"metadata": {
|
||
|
"collapsed": false,
|
||
|
"ExecuteTime": {
|
||
|
"end_time": "2023-08-01T09:47:18.744794500Z",
|
||
|
"start_time": "2023-08-01T09:47:18.692305300Z"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"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
|
||
|
}
|