{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Import supporting package" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import numpy as np\n", "import copy\n", "\n", "from uncertainties import ufloat\n", "from uncertainties import unumpy as unp\n", "from uncertainties import umath\n", "import random\n", "import matplotlib.pyplot as plt\n", "plt.rcParams['font.size'] = 12\n", "\n", "from DataContainer.ReadData import read_hdf5_file\n", "from Analyser.ImagingAnalyser import ImageAnalyser\n", "from Analyser.FitAnalyser import FitAnalyser\n", "from Analyser.FitAnalyser import NewFitModel, DensityProfileBEC2dModel\n", "from ToolFunction.ToolFunction import *\n", "\n", "from scipy.optimize import curve_fit\n", "\n", "from ToolFunction.HomeMadeXarrayFunction import errorbar, dataarray_plot_errorbar\n", "xr.plot.dataarray_plot.errorbar = errorbar\n", "xr.plot.accessor.DataArrayPlotAccessor.errorbar = dataarray_plot_errorbar\n", "\n", "imageAnalyser = ImageAnalyser()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Start a client for parallel computing" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", "
\n", "

Client

\n", "

Client-be5159fc-7966-11ee-8da4-80e82ce2fa8e

\n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "
Connection method: Cluster objectCluster type: distributed.LocalCluster
\n", " Dashboard: http://127.0.0.1:8787/status\n", "
\n", "\n", " \n", "\n", " \n", "
\n", "

Cluster Info

\n", "
\n", "
\n", "
\n", "
\n", "

LocalCluster

\n", "

b1b8bfb1

\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", " \n", "
\n", " Dashboard: http://127.0.0.1:8787/status\n", " \n", " Workers: 8\n", "
\n", " Total threads: 128\n", " \n", " Total memory: 149.01 GiB\n", "
Status: runningUsing processes: True
\n", "\n", "
\n", " \n", "

Scheduler Info

\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", "

Scheduler

\n", "

Scheduler-1a8ed394-5c75-449a-b545-c4822cc75da8

\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", " Comm: tcp://127.0.0.1:55431\n", " \n", " Workers: 8\n", "
\n", " Dashboard: http://127.0.0.1:8787/status\n", " \n", " Total threads: 128\n", "
\n", " Started: Just now\n", " \n", " Total memory: 149.01 GiB\n", "
\n", "
\n", "
\n", "\n", "
\n", " \n", "

Workers

\n", "
\n", "\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 0

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55487\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55488/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55434\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-5wy91m_d\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 1

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55478\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55479/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55435\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-vwtk8h1j\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 2

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55466\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55467/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55436\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-kguu_neb\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 3

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55475\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55476/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55437\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-08ars8w1\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 4

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55481\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55482/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55438\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-ojwo9s13\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 5

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55469\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55470/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55439\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-beoodyjd\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 6

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55472\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55473/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55440\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-7wqwq9j5\n", "
\n", "
\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "
\n", " \n", "

Worker: 7

\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "\n", " \n", "\n", "
\n", " Comm: tcp://127.0.0.1:55484\n", " \n", " Total threads: 16\n", "
\n", " Dashboard: http://127.0.0.1:55485/status\n", " \n", " Memory: 18.63 GiB\n", "
\n", " Nanny: tcp://127.0.0.1:55441\n", "
\n", " Local directory: C:\\Users\\data\\AppData\\Local\\Temp\\dask-scratch-space\\worker-kx75am_o\n", "
\n", "
\n", "
\n", "
\n", " \n", "\n", "
\n", "
\n", "\n", "
\n", "
\n", "
\n", "
\n", " \n", "\n", "
\n", "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from dask.distributed import Client\n", "client = Client(n_workers=8, threads_per_worker=16, processes=True, memory_limit='20GB')\n", "client" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Start a client for Mongo DB" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import pymongo\n", "import xarray_mongodb\n", "\n", "from DataContainer.MongoDB import MongoDB\n", "\n", "mongoClient = pymongo.MongoClient('mongodb://control:DyLab2021@127.0.0.1:27017/?authMechanism=DEFAULT')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Set global path for experiment" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "groupList = [\n", " \"images/MOT_3D_Camera/in_situ_absorption\",\n", " \"images/ODT_1_Axis_Camera/in_situ_absorption\",\n", " \"images/ODT_2_Axis_Camera/in_situ_absorption\",\n", " \"images/Horizontal_Axis_Camera/in_situ_absorption\",\n", " \"images/Vertical_Axis_Camera/in_situ_absorption\",\n", "]\n", "\n", "dskey = {\n", " \"images/MOT_3D_Camera/in_situ_absorption\": \"camera_0\",\n", " \"images/ODT_1_Axis_Camera/in_situ_absorption\": \"camera_1\",\n", " \"images/ODT_2_Axis_Camera/in_situ_absorption\": \"camera_2\",\n", " \"images/Horizontal_Axis_Camera/in_situ_absorption\": \"camera_3\",\n", " \"images/Vertical_Axis_Camera/in_situ_absorption\": \"camera_4\"\n", "}\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Evaporative Cooling" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# # img_dir = 'C:/Users/control/DyLab/Experiments/DyBEC/'\n", "# img_dir = '//DyLabNAS/Data/'\n", "# SequenceName = \"Repetition_scan\"\n", "# folderPath = img_dir + SequenceName + \"/\" + '2023/06/14' # get_date()\n", "\n", "# mongoDB = mongoClient[SequenceName]\n", "\n", "# DB = MongoDB(mongoClient, mongoDB, date=get_date())" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# img_dir = 'C:/Users/control/DyLab/Experiments/DyBEC/'\n", "img_dir = '//DyLabNAS/Data/'\n", "SequenceName = \"Evaporative_Cooling\"\n", "folderPath = img_dir + SequenceName + \"/\" + '2023/04/21' # get_date()\n", "\n", "mongoDB = mongoClient[SequenceName]\n", "\n", "DB = MongoDB(mongoClient, mongoDB, date=get_date())" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.Dataset>\n",
       "Dimensions:  (runs: 3, x: 1200, y: 1920)\n",
       "Coordinates:\n",
       "  * runs     (runs) float64 0.0 1.0 2.0\n",
       "Dimensions without coordinates: x, y\n",
       "Data variables:\n",
       "    OD       (runs, x, y) float64 0.05407 0.08224 -0.0 ... -0.0 0.04581 -0.0
" ], "text/plain": [ "\n", "Dimensions: (runs: 3, x: 1200, y: 1920)\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0\n", "Dimensions without coordinates: x, y\n", "Data variables:\n", " OD (runs, x, y) float64 0.05407 0.08224 -0.0 ... -0.0 0.04581 -0.0" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res = DB.load_data(shotNum='0002', date='2023/04/21')\n", "res['Side_Camera_OD_Image']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plt.figure()\n", "\n", "# res['OD'].OD.plot.pcolormesh(col='compZ_final_current', cmap='jet', vmin=0, vmax=1)\n", "\n", "# plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 2 }