regular backup

This commit is contained in:
Jianshun Gao 2023-05-19 18:52:33 +02:00
parent ab0e4cb83b
commit 9e6d3a8230
2 changed files with 1926 additions and 2638 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,22 +10,33 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import xarray as xr\n", "import xarray as xr\n",
"import pandas as pd\n",
"import numpy as np\n", "import numpy as np\n",
"import copy\n",
"\n",
"import glob\n",
"\n",
"import xrft\n",
"import finufft\n",
"\n", "\n",
"from uncertainties import ufloat\n", "from uncertainties import ufloat\n",
"from uncertainties import unumpy as unp\n", "from uncertainties import unumpy as unp\n",
"from uncertainties import umath\n", "from uncertainties import umath\n",
"\n", "\n",
"import matplotlib.pyplot as plt\n", "from datetime import datetime\n",
"\n", "\n",
"from DataContainer.ReadData import read_hdf5_file\n", "import matplotlib.pyplot as plt\n",
"plt.rcParams['font.size'] = 18\n",
"\n",
"from DataContainer.ReadData import read_hdf5_file, read_hdf5_global, read_hdf5_run_time\n",
"from Analyser.ImagingAnalyser import ImageAnalyser\n", "from Analyser.ImagingAnalyser import ImageAnalyser\n",
"from Analyser.FitAnalyser import FitAnalyser\n", "from Analyser.FitAnalyser import FitAnalyser\n",
"from Analyser.FFTAnalyser import fft, ifft, fft_nutou\n",
"from ToolFunction.ToolFunction import *\n", "from ToolFunction.ToolFunction import *\n",
"\n", "\n",
"from ToolFunction.HomeMadeXarrayFunction import errorbar, dataarray_plot_errorbar\n", "from ToolFunction.HomeMadeXarrayFunction import errorbar, dataarray_plot_errorbar\n",
@ -45,19 +56,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"D:\\Program Files\\Python\\Python38\\Lib\\site-packages\\distributed\\node.py:182: UserWarning: Port 8787 is already in use.\n",
"Perhaps you already have a cluster running?\n",
"Hosting the HTTP server on port 59390 instead\n",
" warnings.warn(\n"
]
},
{ {
"data": { "data": {
"text/html": [ "text/html": [
@ -65,7 +66,7 @@
" <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n", " <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px;\">Client</h3>\n", " <h3 style=\"margin-bottom: 0px;\">Client</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Client-9a0ca19d-ecb4-11ed-af18-9c7bef43b4fb</p>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Client-200775db-f65c-11ed-b2b8-80e82ce2fa8e</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
"\n", "\n",
" <tr>\n", " <tr>\n",
@ -78,7 +79,7 @@
" \n", " \n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59390/status\" target=\"_blank\">http://127.0.0.1:59390/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
@ -87,10 +88,6 @@
" </table>\n", " </table>\n",
"\n", "\n",
" \n", " \n",
" <button style=\"margin-bottom: 12px;\" data-commandlinker-command=\"dask:populate-and-launch-layout\" data-commandlinker-args='{\"url\": \"http://127.0.0.1:59390/status\" }'>\n",
" Launch dashboard in JupyterLab\n",
" </button>\n",
" \n",
"\n", "\n",
" \n", " \n",
" <details>\n", " <details>\n",
@ -100,11 +97,11 @@
" </div>\n", " </div>\n",
" <div style=\"margin-left: 48px;\">\n", " <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px; margin-top: 0px;\">LocalCluster</h3>\n", " <h3 style=\"margin-bottom: 0px; margin-top: 0px;\">LocalCluster</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">40e09024</p>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">2c51e6b4</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:59390/status\" target=\"_blank\">http://127.0.0.1:59390/status</a>\n", " <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Workers:</strong> 6\n", " <strong>Workers:</strong> 6\n",
@ -137,11 +134,11 @@
" <div style=\"width: 24px; height: 24px; background-color: #FFF7E5; border: 3px solid #FF6132; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"width: 24px; height: 24px; background-color: #FFF7E5; border: 3px solid #FF6132; border-radius: 5px; position: absolute;\"> </div>\n",
" <div style=\"margin-left: 48px;\">\n", " <div style=\"margin-left: 48px;\">\n",
" <h3 style=\"margin-bottom: 0px;\">Scheduler</h3>\n", " <h3 style=\"margin-bottom: 0px;\">Scheduler</h3>\n",
" <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Scheduler-616be11d-c546-4d58-ad88-3bacd53b13c0</p>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Scheduler-f9b0168c-58e7-417d-a784-847c37353ae6</p>\n",
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm:</strong> tcp://127.0.0.1:59391\n", " <strong>Comm:</strong> tcp://127.0.0.1:61152\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Workers:</strong> 6\n", " <strong>Workers:</strong> 6\n",
@ -149,7 +146,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:59390/status\" target=\"_blank\">http://127.0.0.1:59390/status</a>\n", " <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads:</strong> 60\n", " <strong>Total threads:</strong> 60\n",
@ -183,7 +180,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59424\n", " <strong>Comm: </strong> tcp://127.0.0.1:61184\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -191,7 +188,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59428/status\" target=\"_blank\">http://127.0.0.1:59428/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61187/status\" target=\"_blank\">http://127.0.0.1:61187/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -199,13 +196,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59394\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61155\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-ybrgy95q\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-i0hiphpk\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -228,7 +225,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59422\n", " <strong>Comm: </strong> tcp://127.0.0.1:61180\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -236,7 +233,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59427/status\" target=\"_blank\">http://127.0.0.1:59427/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61181/status\" target=\"_blank\">http://127.0.0.1:61181/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -244,13 +241,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59395\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61156\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-ms_3izxs\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-iip3bgkh\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -273,7 +270,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59434\n", " <strong>Comm: </strong> tcp://127.0.0.1:61192\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -281,7 +278,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59437/status\" target=\"_blank\">http://127.0.0.1:59437/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61194/status\" target=\"_blank\">http://127.0.0.1:61194/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -289,13 +286,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59396\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61157\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-qteiamcm\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-fysqgu68\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -318,7 +315,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59421\n", " <strong>Comm: </strong> tcp://127.0.0.1:61183\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -326,7 +323,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59426/status\" target=\"_blank\">http://127.0.0.1:59426/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61185/status\" target=\"_blank\">http://127.0.0.1:61185/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -334,13 +331,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59397\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61158\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-r2y5vxh3\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-se3tovak\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -363,7 +360,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59425\n", " <strong>Comm: </strong> tcp://127.0.0.1:61193\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -371,7 +368,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59435/status\" target=\"_blank\">http://127.0.0.1:59435/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61195/status\" target=\"_blank\">http://127.0.0.1:61195/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -379,13 +376,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59398\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61159\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-3ykst_31\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-4pxl4754\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -408,7 +405,7 @@
" <table style=\"width: 100%; text-align: left;\">\n", " <table style=\"width: 100%; text-align: left;\">\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Comm: </strong> tcp://127.0.0.1:59423\n", " <strong>Comm: </strong> tcp://127.0.0.1:61189\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Total threads: </strong> 10\n", " <strong>Total threads: </strong> 10\n",
@ -416,7 +413,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:59429/status\" target=\"_blank\">http://127.0.0.1:59429/status</a>\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:61190/status\" target=\"_blank\">http://127.0.0.1:61190/status</a>\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Memory: </strong> 9.31 GiB\n", " <strong>Memory: </strong> 9.31 GiB\n",
@ -424,13 +421,13 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td style=\"text-align: left;\">\n", " <td style=\"text-align: left;\">\n",
" <strong>Nanny: </strong> tcp://127.0.0.1:59399\n", " <strong>Nanny: </strong> tcp://127.0.0.1:61160\n",
" </td>\n", " </td>\n",
" <td style=\"text-align: left;\"></td>\n", " <td style=\"text-align: left;\"></td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <td colspan=\"2\" style=\"text-align: left;\">\n", " <td colspan=\"2\" style=\"text-align: left;\">\n",
" <strong>Local directory: </strong> C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-egpqiwk3\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-h3v0lbw6\n",
" </td>\n", " </td>\n",
" </tr>\n", " </tr>\n",
"\n", "\n",
@ -457,10 +454,10 @@
"</div>" "</div>"
], ],
"text/plain": [ "text/plain": [
"<Client: 'tcp://127.0.0.1:59391' processes=6 threads=60, memory=55.88 GiB>" "<Client: 'tcp://127.0.0.1:61152' processes=6 threads=60, memory=55.88 GiB>"
] ]
}, },
"execution_count": 2, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -471,6 +468,539 @@
"client" "client"
] ]
}, },
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set global path for experiment"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"groupList = [\n",
" \"images/MOT_3D_Camera/in_situ_absorption\",\n",
" \"images/ODT_1_Axis_Camera/in_situ_absorption\",\n",
" \"images/ODT_2_Axis_Camera/in_situ_absorption\",\n",
"]\n",
"\n",
"dskey = {\n",
" \"images/MOT_3D_Camera/in_situ_absorption\": \"camera_0\",\n",
" \"images/ODT_1_Axis_Camera/in_situ_absorption\": \"camera_1\",\n",
" \"images/ODT_2_Axis_Camera/in_situ_absorption\": \"camera_2\",\n",
"}\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"img_dir = '//DyLabNAS/Data/'\n",
"SequenceName = \"Evaporative_Cooling\" + \"/\"\n",
"folderPath = img_dir + SequenceName + \"2023/05/09\" # get_date()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Read CSV"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "concat_dims has length 1 but the datasets passed are nested in a 0-dimensional structure",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mf:\\Jianshun\\analyseScript\\test.ipynb Cell 9\u001b[0m in \u001b[0;36m1\n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=12'>13</a>\u001b[0m data[i] \u001b[39m=\u001b[39m data_single\n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=13'>14</a>\u001b[0m i \u001b[39m=\u001b[39m i \u001b[39m+\u001b[39m \u001b[39m1\u001b[39m\n\u001b[1;32m---> <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=15'>16</a>\u001b[0m xr\u001b[39m.\u001b[39;49mcombine_nested(data, concat_dim\u001b[39m=\u001b[39;49m[\u001b[39m'\u001b[39;49m\u001b[39mruns\u001b[39;49m\u001b[39m'\u001b[39;49m])\n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=17'>18</a>\u001b[0m \u001b[39m# data.assign_coords(dict(index=data.Time))\u001b[39;00m\n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=18'>19</a>\u001b[0m \n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=19'>20</a>\u001b[0m \u001b[39m# data = xr.Dataset(\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=28'>29</a>\u001b[0m \n\u001b[0;32m <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X55sZmlsZQ%3D%3D?line=29'>30</a>\u001b[0m \u001b[39m# data = data.rename(dict(index='time'))\u001b[39;00m\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:580\u001b[0m, in \u001b[0;36mcombine_nested\u001b[1;34m(datasets, concat_dim, compat, data_vars, coords, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 577\u001b[0m concat_dim \u001b[39m=\u001b[39m [concat_dim]\n\u001b[0;32m 579\u001b[0m \u001b[39m# The IDs argument tells _nested_combine that datasets aren't yet sorted\u001b[39;00m\n\u001b[1;32m--> 580\u001b[0m \u001b[39mreturn\u001b[39;00m _nested_combine(\n\u001b[0;32m 581\u001b[0m datasets,\n\u001b[0;32m 582\u001b[0m concat_dims\u001b[39m=\u001b[39;49mconcat_dim,\n\u001b[0;32m 583\u001b[0m compat\u001b[39m=\u001b[39;49mcompat,\n\u001b[0;32m 584\u001b[0m data_vars\u001b[39m=\u001b[39;49mdata_vars,\n\u001b[0;32m 585\u001b[0m coords\u001b[39m=\u001b[39;49mcoords,\n\u001b[0;32m 586\u001b[0m ids\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m,\n\u001b[0;32m 587\u001b[0m fill_value\u001b[39m=\u001b[39;49mfill_value,\n\u001b[0;32m 588\u001b[0m join\u001b[39m=\u001b[39;49mjoin,\n\u001b[0;32m 589\u001b[0m combine_attrs\u001b[39m=\u001b[39;49mcombine_attrs,\n\u001b[0;32m 590\u001b[0m )\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:359\u001b[0m, in \u001b[0;36m_nested_combine\u001b[1;34m(datasets, concat_dims, compat, data_vars, coords, ids, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 356\u001b[0m _check_shape_tile_ids(combined_ids)\n\u001b[0;32m 358\u001b[0m \u001b[39m# Apply series of concatenate or merge operations along each dimension\u001b[39;00m\n\u001b[1;32m--> 359\u001b[0m combined \u001b[39m=\u001b[39m _combine_nd(\n\u001b[0;32m 360\u001b[0m combined_ids,\n\u001b[0;32m 361\u001b[0m concat_dims,\n\u001b[0;32m 362\u001b[0m compat\u001b[39m=\u001b[39;49mcompat,\n\u001b[0;32m 363\u001b[0m data_vars\u001b[39m=\u001b[39;49mdata_vars,\n\u001b[0;32m 364\u001b[0m coords\u001b[39m=\u001b[39;49mcoords,\n\u001b[0;32m 365\u001b[0m fill_value\u001b[39m=\u001b[39;49mfill_value,\n\u001b[0;32m 366\u001b[0m join\u001b[39m=\u001b[39;49mjoin,\n\u001b[0;32m 367\u001b[0m combine_attrs\u001b[39m=\u001b[39;49mcombine_attrs,\n\u001b[0;32m 368\u001b[0m )\n\u001b[0;32m 369\u001b[0m \u001b[39mreturn\u001b[39;00m combined\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:224\u001b[0m, in \u001b[0;36m_combine_nd\u001b[1;34m(combined_ids, concat_dims, data_vars, coords, compat, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 222\u001b[0m n_dims \u001b[39m=\u001b[39m \u001b[39mlen\u001b[39m(example_tile_id)\n\u001b[0;32m 223\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mlen\u001b[39m(concat_dims) \u001b[39m!=\u001b[39m n_dims:\n\u001b[1;32m--> 224\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 225\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mconcat_dims has length \u001b[39m\u001b[39m{}\u001b[39;00m\u001b[39m but the datasets \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 226\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mpassed are nested in a \u001b[39m\u001b[39m{}\u001b[39;00m\u001b[39m-dimensional structure\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m.\u001b[39mformat(\n\u001b[0;32m 227\u001b[0m \u001b[39mlen\u001b[39m(concat_dims), n_dims\n\u001b[0;32m 228\u001b[0m )\n\u001b[0;32m 229\u001b[0m )\n\u001b[0;32m 231\u001b[0m \u001b[39m# Each iteration of this loop reduces the length of the tile_ids tuples\u001b[39;00m\n\u001b[0;32m 232\u001b[0m \u001b[39m# by one. It always combines along the first dimension, removing the first\u001b[39;00m\n\u001b[0;32m 233\u001b[0m \u001b[39m# element of the tuple\u001b[39;00m\n\u001b[0;32m 234\u001b[0m \u001b[39mfor\u001b[39;00m concat_dim \u001b[39min\u001b[39;00m concat_dims:\n",
"\u001b[1;31mValueError\u001b[0m: concat_dims has length 1 but the datasets passed are nested in a 0-dimensional structure"
]
}
],
"source": [
"filePath = 'Z:/Dy_Lab/Data/Measurements/Experiments/DyBEC/BEC Stability Check/20230509-0007/*.csv'\n",
"\n",
"filePath = np.sort(glob.glob(filePath))\n",
"\n",
"data = np.empty(filePath.shape,dtype=object)\n",
"\n",
"i = 0\n",
"for fp in filePath:\n",
" data_single = pd.read_csv(fp)\n",
" data_single = xr.Dataset.from_dataframe(data_single)\n",
" data_single = data_single.drop_isel(index=0)\n",
" data_single = data_single.expand_dims(dim='runs')\n",
" data[i] = data_single\n",
" i = i + 1\n",
"\n",
"xr.combine_nested(data, concat_dim=['runs'])\n",
"\n",
"# data.assign_coords(dict(index=data.Time))\n",
"\n",
"# data = xr.Dataset(\n",
"# data_vars = {\n",
"# 'arm1': data['Channel C'],\n",
"# 'arm2': data['Channel A'],\n",
"# },\n",
"# coords = {\n",
"# 'index': data['Time']\n",
"# }\n",
"# )\n",
"\n",
"# data = data.rename(dict(index='time'))"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body[data-theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block !important;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-index-preview {\n",
" grid-column: 2 / 5;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data,\n",
".xr-index-data-in:checked ~ .xr-index-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-index-name div,\n",
".xr-index-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data,\n",
".xr-index-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2,\n",
".xr-no-icon {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (index: 100004, runs: 1)\n",
"Coordinates:\n",
" * index (index) int64 1 2 3 4 5 6 ... 100000 100001 100002 100003 100004\n",
"Dimensions without coordinates: runs\n",
"Data variables:\n",
" Time (runs, index) object &#x27;-0.44999999&#x27; &#x27;-0.44994999&#x27; ... &#x27;4.55014989&#x27;\n",
" Channel A (runs, index) object &#x27;-0.02044740&#x27; &#x27;-0.03051851&#x27; ... &#x27;0.09063997&#x27;\n",
" Channel C (runs, index) object &#x27;-0.01525925&#x27; &#x27;-0.01525925&#x27; ... &#x27;0.05981628&#x27;</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-3173c483-e0df-4c54-b1d1-fba2e8347e6d' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-3173c483-e0df-4c54-b1d1-fba2e8347e6d' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>index</span>: 100004</li><li><span>runs</span>: 1</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-b017a61a-75a4-4945-a5a7-c9c22a3a4904' class='xr-section-summary-in' type='checkbox' checked><label for='section-b017a61a-75a4-4945-a5a7-c9c22a3a4904' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>index</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>1 2 3 4 ... 100002 100003 100004</div><input id='attrs-ebc2dfec-83d3-4337-95dc-ddc3b521f06d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ebc2dfec-83d3-4337-95dc-ddc3b521f06d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-67b01792-ac53-4641-9710-7c82cb2f87e5' class='xr-var-data-in' type='checkbox'><label for='data-67b01792-ac53-4641-9710-7c82cb2f87e5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 1, 2, 3, ..., 100002, 100003, 100004], dtype=int64)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-6e744b28-70da-4c5a-b447-58b39ebc1a32' class='xr-section-summary-in' type='checkbox' checked><label for='section-6e744b28-70da-4c5a-b447-58b39ebc1a32' class='xr-section-summary' >Data variables: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>Time</span></div><div class='xr-var-dims'>(runs, index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;-0.44999999&#x27; ... &#x27;4.55014989&#x27;</div><input id='attrs-304c227d-f7d9-42bd-b4db-1daedc6497e9' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-304c227d-f7d9-42bd-b4db-1daedc6497e9' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-29e7b056-bf5f-41e2-a80d-cbedd8cc6d90' class='xr-var-data-in' type='checkbox'><label for='data-29e7b056-bf5f-41e2-a80d-cbedd8cc6d90' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[&#x27;-0.44999999&#x27;, &#x27;-0.44994999&#x27;, &#x27;-0.44989999&#x27;, ..., &#x27;4.55004989&#x27;,\n",
" &#x27;4.55009989&#x27;, &#x27;4.55014989&#x27;]], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>Channel A</span></div><div class='xr-var-dims'>(runs, index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;-0.02044740&#x27; ... &#x27;0.09063997&#x27;</div><input id='attrs-8c6510db-4498-4fc9-b45d-c5fa1d19a1de' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8c6510db-4498-4fc9-b45d-c5fa1d19a1de' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2c60aa58-2e9f-44af-8546-db020067661c' class='xr-var-data-in' type='checkbox'><label for='data-2c60aa58-2e9f-44af-8546-db020067661c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[&#x27;-0.02044740&#x27;, &#x27;-0.03051851&#x27;, &#x27;0.02014222&#x27;, ..., &#x27;0.02502518&#x27;,\n",
" &#x27;0.06561480&#x27;, &#x27;0.09063997&#x27;]], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>Channel C</span></div><div class='xr-var-dims'>(runs, index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;-0.01525925&#x27; ... &#x27;0.05981628&#x27;</div><input id='attrs-0dc8b2af-af1a-485b-8942-e642aa1862ed' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0dc8b2af-af1a-485b-8942-e642aa1862ed' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6a955ee8-f77f-4b45-b18a-0ea0486b5932' class='xr-var-data-in' type='checkbox'><label for='data-6a955ee8-f77f-4b45-b18a-0ea0486b5932' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([[&#x27;-0.01525925&#x27;, &#x27;-0.01525925&#x27;, &#x27;-0.05005036&#x27;, ..., &#x27;0.05981628&#x27;,\n",
" &#x27;0.07477035&#x27;, &#x27;0.05981628&#x27;]], dtype=object)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-de543410-3007-4fef-be30-b59e0d5f577b' class='xr-section-summary-in' type='checkbox' ><label for='section-de543410-3007-4fef-be30-b59e0d5f577b' class='xr-section-summary' >Indexes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>index</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-f4743108-022b-4ecd-bfc2-9fd48d2c1ba1' class='xr-index-data-in' type='checkbox'/><label for='index-f4743108-022b-4ecd-bfc2-9fd48d2c1ba1' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Int64Index([ 1, 2, 3, 4, 5, 6, 7, 8,\n",
" 9, 10,\n",
" ...\n",
" 99995, 99996, 99997, 99998, 99999, 100000, 100001, 100002,\n",
" 100003, 100004],\n",
" dtype=&#x27;int64&#x27;, name=&#x27;index&#x27;, length=100004))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-43582b8a-7f7d-4cc9-bd19-38ceb739f793' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-43582b8a-7f7d-4cc9-bd19-38ceb739f793' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (index: 100004, runs: 1)\n",
"Coordinates:\n",
" * index (index) int64 1 2 3 4 5 6 ... 100000 100001 100002 100003 100004\n",
"Dimensions without coordinates: runs\n",
"Data variables:\n",
" Time (runs, index) object '-0.44999999' '-0.44994999' ... '4.55014989'\n",
" Channel A (runs, index) object '-0.02044740' '-0.03051851' ... '0.09063997'\n",
" Channel C (runs, index) object '-0.01525925' '-0.01525925' ... '0.05981628'"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data[0]"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "concat_dims has length 1 but the datasets passed are nested in a 0-dimensional structure",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mf:\\Jianshun\\analyseScript\\test.ipynb Cell 11\u001b[0m in \u001b[0;36m1\n\u001b[1;32m----> <a href='vscode-notebook-cell:/f%3A/Jianshun/analyseScript/test.ipynb#X63sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m xr\u001b[39m.\u001b[39;49mcombine_nested(data[\u001b[39m0\u001b[39;49m:\u001b[39m2\u001b[39;49m], concat_dim\u001b[39m=\u001b[39;49m[[\u001b[39m'\u001b[39;49m\u001b[39mruns\u001b[39;49m\u001b[39m'\u001b[39;49m]])\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:580\u001b[0m, in \u001b[0;36mcombine_nested\u001b[1;34m(datasets, concat_dim, compat, data_vars, coords, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 577\u001b[0m concat_dim \u001b[39m=\u001b[39m [concat_dim]\n\u001b[0;32m 579\u001b[0m \u001b[39m# The IDs argument tells _nested_combine that datasets aren't yet sorted\u001b[39;00m\n\u001b[1;32m--> 580\u001b[0m \u001b[39mreturn\u001b[39;00m _nested_combine(\n\u001b[0;32m 581\u001b[0m datasets,\n\u001b[0;32m 582\u001b[0m concat_dims\u001b[39m=\u001b[39;49mconcat_dim,\n\u001b[0;32m 583\u001b[0m compat\u001b[39m=\u001b[39;49mcompat,\n\u001b[0;32m 584\u001b[0m data_vars\u001b[39m=\u001b[39;49mdata_vars,\n\u001b[0;32m 585\u001b[0m coords\u001b[39m=\u001b[39;49mcoords,\n\u001b[0;32m 586\u001b[0m ids\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m,\n\u001b[0;32m 587\u001b[0m fill_value\u001b[39m=\u001b[39;49mfill_value,\n\u001b[0;32m 588\u001b[0m join\u001b[39m=\u001b[39;49mjoin,\n\u001b[0;32m 589\u001b[0m combine_attrs\u001b[39m=\u001b[39;49mcombine_attrs,\n\u001b[0;32m 590\u001b[0m )\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:359\u001b[0m, in \u001b[0;36m_nested_combine\u001b[1;34m(datasets, concat_dims, compat, data_vars, coords, ids, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 356\u001b[0m _check_shape_tile_ids(combined_ids)\n\u001b[0;32m 358\u001b[0m \u001b[39m# Apply series of concatenate or merge operations along each dimension\u001b[39;00m\n\u001b[1;32m--> 359\u001b[0m combined \u001b[39m=\u001b[39m _combine_nd(\n\u001b[0;32m 360\u001b[0m combined_ids,\n\u001b[0;32m 361\u001b[0m concat_dims,\n\u001b[0;32m 362\u001b[0m compat\u001b[39m=\u001b[39;49mcompat,\n\u001b[0;32m 363\u001b[0m data_vars\u001b[39m=\u001b[39;49mdata_vars,\n\u001b[0;32m 364\u001b[0m coords\u001b[39m=\u001b[39;49mcoords,\n\u001b[0;32m 365\u001b[0m fill_value\u001b[39m=\u001b[39;49mfill_value,\n\u001b[0;32m 366\u001b[0m join\u001b[39m=\u001b[39;49mjoin,\n\u001b[0;32m 367\u001b[0m combine_attrs\u001b[39m=\u001b[39;49mcombine_attrs,\n\u001b[0;32m 368\u001b[0m )\n\u001b[0;32m 369\u001b[0m \u001b[39mreturn\u001b[39;00m combined\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\xarray\\core\\combine.py:224\u001b[0m, in \u001b[0;36m_combine_nd\u001b[1;34m(combined_ids, concat_dims, data_vars, coords, compat, fill_value, join, combine_attrs)\u001b[0m\n\u001b[0;32m 222\u001b[0m n_dims \u001b[39m=\u001b[39m \u001b[39mlen\u001b[39m(example_tile_id)\n\u001b[0;32m 223\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mlen\u001b[39m(concat_dims) \u001b[39m!=\u001b[39m n_dims:\n\u001b[1;32m--> 224\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 225\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mconcat_dims has length \u001b[39m\u001b[39m{}\u001b[39;00m\u001b[39m but the datasets \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 226\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mpassed are nested in a \u001b[39m\u001b[39m{}\u001b[39;00m\u001b[39m-dimensional structure\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m.\u001b[39mformat(\n\u001b[0;32m 227\u001b[0m \u001b[39mlen\u001b[39m(concat_dims), n_dims\n\u001b[0;32m 228\u001b[0m )\n\u001b[0;32m 229\u001b[0m )\n\u001b[0;32m 231\u001b[0m \u001b[39m# Each iteration of this loop reduces the length of the tile_ids tuples\u001b[39;00m\n\u001b[0;32m 232\u001b[0m \u001b[39m# by one. It always combines along the first dimension, removing the first\u001b[39;00m\n\u001b[0;32m 233\u001b[0m \u001b[39m# element of the tuple\u001b[39;00m\n\u001b[0;32m 234\u001b[0m \u001b[39mfor\u001b[39;00m concat_dim \u001b[39min\u001b[39;00m concat_dims:\n",
"\u001b[1;31mValueError\u001b[0m: concat_dims has length 1 but the datasets passed are nested in a 0-dimensional structure"
]
}
],
"source": [
"xr.combine_nested(data[0:2], concat_dim=[['runs']])"
]
},
{ {
"attachments": {}, "attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
@ -1590,7 +2120,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]" "version": "3.9.13"
}, },
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {