diff --git a/Analyser/FitAnalyser.py b/Analyser/FitAnalyser.py index 29a6ce6..9f48832 100644 --- a/Analyser/FitAnalyser.py +++ b/Analyser/FitAnalyser.py @@ -1,4 +1,5 @@ import numpy as np +from uncertainties import ufloat import lmfit from lmfit.models import (ConstantModel, ComplexConstantModel, LinearModel, QuadraticModel, @@ -200,16 +201,22 @@ class TwoGaussian2dModel(Model): self.helperModel = Gaussian2dModel() super().__init__(two_gaussian2d, **kwargs) + + self._set_paramhints_prefix() + + def _set_paramhints_prefix(self): + self.set_param_hint('delta', value=-1, max=0) + self.set_param_hint('A_sigmax', expr=f'{self.prefix}delta + {self.prefix}B_sigmax') def guess(self, data, x, y, negative=False, **kwargs): pars_guess = guess_from_peak2d(self.helperModel, data, x, y, negative) - pars = self.make_params(A_amplitude=pars_guess['amplitude'], A_centerx=pars_guess['centerx'], A_centery=pars_guess['centery'], - A_sigmax=pars_guess['sigmax'], A_sigmay=pars_guess['sigmay'], - B_amplitude=pars_guess['amplitude'], B_centerx=pars_guess['centerx'], B_centery=pars_guess['centery'], - B_sigmax=pars_guess['sigmax'], B_sigmay=pars_guess['sigmay']) + pars = self.make_params(A_amplitude=pars_guess['amplitude'].value, A_centerx=pars_guess['centerx'].value, A_centery=pars_guess['centery'].value, + A_sigmax=pars_guess['sigmax'].value, A_sigmay=pars_guess['sigmay'].value, + B_amplitude=pars_guess['amplitude'].value, B_centerx=pars_guess['centerx'].value, B_centery=pars_guess['centery'].value, + B_sigmax=pars_guess['sigmax'].value, B_sigmay=pars_guess['sigmay'].value) - pars.add(f'{self.prefix}delta', value=-1, max=0, vary=True) pars[f'{self.prefix}A_sigmax'].set(expr=f'delta + {self.prefix}B_sigmax') + pars.add(f'{self.prefix}delta', value=-1, max=0, min=-np.inf, vary=True) pars[f'{self.prefix}A_sigmay'].set(min=0.0) pars[f'{self.prefix}B_sigmax'].set(min=0.0) pars[f'{self.prefix}B_sigmay'].set(min=0.0) @@ -263,6 +270,29 @@ class FitAnalyser(): self.fitModel = fitModel self.fitDim = fitDim + + def print_params_set_templet(self, params=None): + + if params is None: + params = self.fitModel.make_params() + + for key in params: + res = "params.add(" + res += "name=\"" + key + "\", " + if not params[key].expr is None: + res += "expr=" + params[key].expr +")" + else: + res += "value=" + f'{params[key].value:3g}' + ", " + if str(params[key].max)=="inf": + res += "max=np.inf, " + else: + res += "max=" + f'{params[key].max:3g}' + ", " + if str(params[key].min)=="-inf": + res += "min=-np.inf, " + else: + res += "min=" + f'{params[key].min:3g}' + ", " + res += "vary=" + str(params[key].vary) + ")" + print(res) def _guess_1D(self, data, x, **kwargs): return self.fitModel.guess(data=data, x=x, **kwargs) @@ -373,29 +403,29 @@ class FitAnalyser(): 'keep_attrs': keep_attrs, } ) - - if input_core_dims is None: - kwargs.update( - { - "input_core_dims": [['x'], []], - } - ) - - if x is None: - if 'x' in dataArray.dims: - x = dataArray['x'].to_numpy() - else: - if isinstance(x, str): - if input_core_dims is None: - kwargs.update( - { - "input_core_dims": [[x], []], - } - ) - x = dataArray[x].to_numpy() if isinstance(paramsArray, type(self.fitModel.make_params())): + if input_core_dims is None: + kwargs.update( + { + "input_core_dims": [['x']], + } + ) + + if x is None: + if 'x' in dataArray.dims: + x = dataArray['x'].to_numpy() + else: + if isinstance(x, str): + if input_core_dims is None: + kwargs.update( + { + "input_core_dims": [[x]], + } + ) + x = dataArray[x].to_numpy() + if self.fitDim == 1: return xr.apply_ufunc(self._fit_1D, dataArray, kwargs={'params':paramsArray,'x':x}, output_dtypes=[type(lmfit.model.ModelResult(self.fitModel, self.fitModel.make_params()))], @@ -409,7 +439,7 @@ class FitAnalyser(): if input_core_dims is None: kwargs.update( { - "input_core_dims": [['x', 'y'], []], + "input_core_dims": [['x', 'y']], } ) else: @@ -419,7 +449,7 @@ class FitAnalyser(): elif input_core_dims is None: kwargs.update( { - "input_core_dims": [['x', 'y'], []], + "input_core_dims": [['x', 'y']], } ) @@ -436,6 +466,27 @@ class FitAnalyser(): **kwargs) else: + + if input_core_dims is None: + kwargs.update( + { + "input_core_dims": [['x'], []], + } + ) + + if x is None: + if 'x' in dataArray.dims: + x = dataArray['x'].to_numpy() + else: + if isinstance(x, str): + if input_core_dims is None: + kwargs.update( + { + "input_core_dims": [[x], []], + } + ) + x = dataArray[x].to_numpy() + if self.fitDim == 1: return xr.apply_ufunc(self._fit_1D, dataArray, paramsArray, kwargs={'x':x}, output_dtypes=[type(lmfit.model.ModelResult(self.fitModel, self.fitModel.make_params()))], @@ -537,4 +588,131 @@ class FitAnalyser(): return xr.apply_ufunc(self._eval_2D, fitResultArray, kwargs={"x":_x, "y":_y, "shape":(len(x), len(y))}, **kwargs) - + def _get_fit_value_single(self, fitResult, key): + return fitResult.params[key].value + + def _get_fit_value(self, fitResult, params): + func = np.vectorize(self._get_fit_value_single) + res = tuple( + func(fitResult, key) + for key in params + ) + + return res + + def get_fit_value(self, fitResult, dask='parallelized', **kwargs): + firstIndex = { + key: fitResult[key][0] + for key in fitResult.dims + } + firstFitResult = fitResult.sel(firstIndex).item() + + params = list(firstFitResult.params.keys()) + + output_core_dims=[ [] for _ in range(len(params))] + + kwargs.update( + { + "dask": dask, + "output_core_dims": output_core_dims, + } + ) + + value = xr.apply_ufunc(self._get_fit_value, fitResult, kwargs=dict(params=params), **kwargs) + + value = xr.Dataset( + data_vars={ + params[i]: value[i] + for i in range(len(params)) + }, + attrs=fitResult.attrs + ) + + return value + + def _get_fit_std_single(self, fitResult, key): + return fitResult.params[key].stderr + + def _get_fit_std(self, fitResult, params): + func = np.vectorize(self._get_fit_std_single) + res = tuple( + func(fitResult, key) + for key in params + ) + + return res + + def get_fit_std(self, fitResult, dask='parallelized', **kwargs): + firstIndex = { + key: fitResult[key][0] + for key in fitResult.dims + } + firstFitResult = fitResult.sel(firstIndex).item() + + params = list(firstFitResult.params.keys()) + + output_core_dims=[ [] for _ in range(len(params))] + + kwargs.update( + { + "dask": dask, + "output_core_dims": output_core_dims, + } + ) + + value = xr.apply_ufunc(self._get_fit_std, fitResult, kwargs=dict(params=params), **kwargs) + + value = xr.Dataset( + data_vars={ + params[i]: value[i] + for i in range(len(params)) + }, + attrs=fitResult.attrs + ) + + return value + + def _get_fit_full_result_single(self, fitResult, key): + return ufloat(fitResult.params[key].value, fitResult.params[key].stderr) + + def _get_fit_full_result(self, fitResult, params): + func = np.vectorize(self._get_fit_full_result_single) + res = tuple( + func(fitResult, key) + for key in params + ) + + return res + + def get_fit_full_result(self, fitResult, dask='parallelized', **kwargs): + firstIndex = { + key: fitResult[key][0] + for key in fitResult.dims + } + firstFitResult = fitResult.sel(firstIndex).item() + + params = list(firstFitResult.params.keys()) + + output_core_dims=[ [] for _ in range(len(params))] + + kwargs.update( + { + "dask": dask, + "output_core_dims": output_core_dims, + } + ) + + value = xr.apply_ufunc(self._get_fit_full_result, fitResult, kwargs=dict(params=params), **kwargs) + + value = xr.Dataset( + data_vars={ + params[i]: value[i] + for i in range(len(params)) + }, + attrs=fitResult.attrs + ) + + return value + + + diff --git a/DataContainer/ReadData.py b/DataContainer/ReadData.py index 3dd7fce..4126261 100644 --- a/DataContainer/ReadData.py +++ b/DataContainer/ReadData.py @@ -3,6 +3,8 @@ import numpy as np from collections import OrderedDict from functools import partial import copy +import glob +import os def _read_globals_attrs(variable_attrs, context=None): @@ -74,6 +76,9 @@ def _read_globals_attrs(variable_attrs, context=None): } ) + # if result['scanAxis'] == []: + # result['scanAxis'] = ['runs',] + return result @@ -83,16 +88,18 @@ def _read_shot_number_from_hdf5(x): return x.assign(shotNum=shotNum) -def _assign_scan_axis_partial(x, datesetOfGlobal): +def _assign_scan_axis_partial(x, datesetOfGlobal, fullFilePath): scanAxis = datesetOfGlobal.scanAxis - filePath = x.encoding["source"] - shotNum = filePath.split("_")[-1].split("_")[-1].split(".")[0] + filePath = x.encoding["source"].replace("\\", "/") + shotNum = np.where(fullFilePath==filePath) + shotNum = np.squeeze(shotNum) + # shotNum = filePath.split("_")[-1].split("_")[-1].split(".")[0] x = x.assign(shotNum=shotNum) x = x.expand_dims(list(scanAxis)) - + return x.assign_coords( { - key: np.atleast_1d(datesetOfGlobal.attrs[key][int(shotNum)]) + key: np.atleast_1d(np.atleast_1d(datesetOfGlobal.attrs[key])[int(shotNum)]) for key in scanAxis } ) @@ -108,6 +115,21 @@ def update_hdf5_file(): def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None, join="outer", parallel=True, engine="h5netcdf", phony_dims="access", **kwargs): + filePath = np.sort(np.atleast_1d(filePath)) + + filePathAbs = [] + + for i in range(len(filePath)): + filePathAbs.append(os.path.abspath(filePath[i]).replace("\\", "/")) + + fullFilePath = [] + for i in range(len(filePathAbs)): + fullFilePath.append(list(np.sort(glob.glob(filePathAbs[i])))) + fullFilePath = np.array(fullFilePath).flatten() + + for i in range(len(fullFilePath)): + fullFilePath[i] = fullFilePath[i].replace("\\", "/") + kwargs.update( { 'join': join, @@ -120,7 +142,7 @@ def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None, if datesetOfGlobal is None: datesetOfGlobal = xr.open_mfdataset( - filePath, + fullFilePath, group="globals", concat_dim="fileNum", combine="nested", @@ -130,14 +152,14 @@ def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None, combine_attrs=_read_globals_attrs, parallel=True, ) - _assgin_scan_axis = partial(_assign_scan_axis_partial, datesetOfGlobal=datesetOfGlobal) + _assgin_scan_axis = partial(_assign_scan_axis_partial, datesetOfGlobal=datesetOfGlobal, fullFilePath=fullFilePath) if preprocess is None: kwargs.update({'preprocess':_assgin_scan_axis}) else: kwargs.update({'preprocess':preprocess}) - ds = xr.open_mfdataset(filePath, **kwargs) + ds = xr.open_mfdataset(fullFilePath, **kwargs) newDimKey = np.append(['x', 'y', 'z'], [ chr(i) for i in range(97, 97+23)]) diff --git a/ToolFunction/ToolFunction.py b/ToolFunction/ToolFunction.py index 48e2fca..2371d92 100644 --- a/ToolFunction/ToolFunction.py +++ b/ToolFunction/ToolFunction.py @@ -1,7 +1,11 @@ -import numpy as np import glob from datetime import date +import numpy as np +from uncertainties import unumpy as unp + +import xarray as xr + def get_mask(dataArray): return np.ones(dataArray.shape, dtype=bool) @@ -41,8 +45,35 @@ def get_date(): return today.strftime("%y/%m/%d") -def resolve_fit_result(fitResult): - +def _combine_uncertainty(value, std): + return unp.uarray(value, std) + + +def combine_uncertainty(value, std, dask='parallelized', **kwargs): + + kwargs.update( + { + "dask": dask, + } + ) + + return xr.apply_ufunc(_combine_uncertainty, value, std, **kwargs) + +def _seperate_uncertainty_single(data): + return data.n, data.s + +def _seperate_uncertainty(data): + func = np.vectorize(_seperate_uncertainty_single) + return func(data) + +def seperate_uncertainty(data, dask='parallelized', **kwargs): - return \ No newline at end of file + kwargs.update( + { + "dask": dask, + "output_core_dims": [[], []], + } + ) + + return xr.apply_ufunc(_seperate_uncertainty, data, **kwargs) \ No newline at end of file diff --git a/test.ipynb b/test.ipynb index 30f2530..eaf0d03 100644 --- a/test.ipynb +++ b/test.ipynb @@ -48,6 +48,16 @@ "execution_count": 2, "metadata": {}, "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 51109 instead\n", + " warnings.warn(\n" + ] + }, { "data": { "text/html": [ @@ -55,7 +65,7 @@ "
\n", "
\n", "

Client

\n", - "

Client-93efe695-ebe5-11ed-a61c-9c7bef43b4fb

\n", + "

Client-224091e0-ec5e-11ed-addc-9c7bef43b4fb

\n", " \n", "\n", " \n", @@ -68,7 +78,7 @@ " \n", " \n", " \n", " \n", " \n", @@ -77,6 +87,10 @@ "
\n", - " Dashboard: http://127.0.0.1:8787/status\n", + " Dashboard: http://127.0.0.1:51109/status\n", "
\n", "\n", " \n", + " \n", + " \n", "\n", " \n", "
\n", @@ -86,11 +100,11 @@ "
\n", "
\n", "

LocalCluster

\n", - "

94c234d4

\n", + "

f360131e

\n", " \n", " \n", " \n", "
\n", - " Dashboard: http://127.0.0.1:8787/status\n", + " Dashboard: http://127.0.0.1:51109/status\n", " \n", " Workers: 6\n", @@ -123,11 +137,11 @@ "
\n", "
\n", "

Scheduler

\n", - "

Scheduler-77c49924-2581-4f0b-859a-8ae3d230ee64

\n", + "

Scheduler-0e581a89-0733-49c5-8d25-60e26c6ac0bf

\n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", - " Comm: tcp://127.0.0.1:62867\n", + " Comm: tcp://127.0.0.1:51110\n", " \n", " Workers: 6\n", @@ -135,7 +149,7 @@ "
\n", - " Dashboard: http://127.0.0.1:8787/status\n", + " Dashboard: http://127.0.0.1:51109/status\n", " \n", " Total threads: 60\n", @@ -169,7 +183,7 @@ " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -214,7 +228,7 @@ "
\n", - " Comm: tcp://127.0.0.1:62896\n", + " Comm: tcp://127.0.0.1:51150\n", " \n", " Total threads: 10\n", @@ -177,7 +191,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62905/status\n", + " Dashboard: http://127.0.0.1:51155/status\n", " \n", " Memory: 9.31 GiB\n", @@ -185,13 +199,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62870\n", + " Nanny: tcp://127.0.0.1:51113\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-zu_ku8iu\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-2b8gvagb\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -259,7 +273,7 @@ "
\n", - " Comm: tcp://127.0.0.1:62899\n", + " Comm: tcp://127.0.0.1:51141\n", " \n", " Total threads: 10\n", @@ -222,7 +236,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62910/status\n", + " Dashboard: http://127.0.0.1:51148/status\n", " \n", " Memory: 9.31 GiB\n", @@ -230,13 +244,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62871\n", + " Nanny: tcp://127.0.0.1:51114\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-kqys5zrx\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-a2ff372r\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -304,7 +318,7 @@ "
\n", - " Comm: tcp://127.0.0.1:62895\n", + " Comm: tcp://127.0.0.1:51139\n", " \n", " Total threads: 10\n", @@ -267,7 +281,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62902/status\n", + " Dashboard: http://127.0.0.1:51145/status\n", " \n", " Memory: 9.31 GiB\n", @@ -275,13 +289,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62872\n", + " Nanny: tcp://127.0.0.1:51115\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-jp4ehnch\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-r4y9shfe\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -349,7 +363,7 @@ "
\n", - " Comm: tcp://127.0.0.1:62894\n", + " Comm: tcp://127.0.0.1:51140\n", " \n", " Total threads: 10\n", @@ -312,7 +326,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62900/status\n", + " Dashboard: http://127.0.0.1:51144/status\n", " \n", " Memory: 9.31 GiB\n", @@ -320,13 +334,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62873\n", + " Nanny: tcp://127.0.0.1:51116\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-bwrlhm69\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-jcbj2z99\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -394,7 +408,7 @@ "
\n", - " Comm: tcp://127.0.0.1:62898\n", + " Comm: tcp://127.0.0.1:51143\n", " \n", " Total threads: 10\n", @@ -357,7 +371,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62908/status\n", + " Dashboard: http://127.0.0.1:51153/status\n", " \n", " Memory: 9.31 GiB\n", @@ -365,13 +379,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62874\n", + " Nanny: tcp://127.0.0.1:51117\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-qicelv9a\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-3ol5ipx3\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", @@ -443,7 +457,7 @@ "" ], "text/plain": [ - "" + "" ] }, "execution_count": 2, @@ -486,6 +500,10 @@ "\n", "filepath = r\"./testData/0002/*.h5\"\n", "\n", + "# filepath = r\"./testData/0002/2023-04-21_0002_Evaporative_Cooling_0.h5\"\n", + "\n", + "# filepath = r'd:/Jianshun Gao/Simulations/analyseScripts/testData/0002/2023-04-21_0002_Evaporative_Cooling_0.h5'\n", + "\n", "# filepath = \"//DyLabNAS/Data/Evaporative_Cooling/2023/04/18/0003/*.h5\"\n", "\n", "# filepath = \"//DyLabNAS/Data/Evaporative_Cooling/2023/05/04/0000/*.h5\"" @@ -495,7 +513,15 @@ "cell_type": "code", "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'unlimited_dims': set(), 'source': 'd:\\\\Jianshun Gao\\\\Simulations\\\\analyseScripts\\\\testData\\\\0002\\\\2023-04-21_0002_Evaporative_Cooling_0.h5'}\n" + ] + } + ], "source": [ "groupList = [\n", " \"images/MOT_3D_Camera/in_situ_absorption\",\n", @@ -938,7 +964,7 @@ " atoms (runs, x, y) uint16 dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>\n", " background (runs, x, y) uint16 dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>\n", " dark (runs, x, y) uint16 dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>\n", - " shotNum (runs) <U1 '0' '1' '2'\n", + " shotNum (runs) int64 0 1 2\n", " OD (runs, x, y) float64 dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>\n", "Attributes: (12/96)\n", " TOF_free: 0.02\n", @@ -953,7 +979,7 @@ " z_offset_img: 0.189\n", " runs: [0. 1. 2.]\n", " scanAxis: ['runs']\n", - " scanAxisLength: [3.]
\n", - " Comm: tcp://127.0.0.1:62897\n", + " Comm: tcp://127.0.0.1:51142\n", " \n", " Total threads: 10\n", @@ -402,7 +416,7 @@ "
\n", - " Dashboard: http://127.0.0.1:62904/status\n", + " Dashboard: http://127.0.0.1:51151/status\n", " \n", " Memory: 9.31 GiB\n", @@ -410,13 +424,13 @@ "
\n", - " Nanny: tcp://127.0.0.1:62875\n", + " Nanny: tcp://127.0.0.1:51118\n", "
\n", - " Local directory: C:\\Users\\JIANSH~1\\AppData\\Local\\Temp\\dask-worker-space\\worker-m2e77hzu\n", + " Local directory: C:\\Users\\Jianshun Gao\\AppData\\Local\\Temp\\dask-worker-space\\worker-0u_6_n9d\n", "
\n", + " scanAxisLength: [3.]
\n", " \n", "
\n", " \n", @@ -1035,7 +1061,7 @@ "\n", " \n", " \n", - "
  • background
    (runs, x, y)
    uint16
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", + "
  • background
    (runs, x, y)
    uint16
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", " \n", "
    \n", " \n", @@ -1117,7 +1143,7 @@ "\n", " \n", " \n", - "
  • dark
    (runs, x, y)
    uint16
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", + "
  • dark
    (runs, x, y)
    uint16
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", " \n", "
    \n", " \n", @@ -1199,7 +1225,7 @@ "\n", " \n", " \n", - "
  • shotNum
    (runs)
    <U1
    '0' '1' '2'
    array(['0', '1', '2'], dtype='<U1')
  • OD
    (runs, x, y)
    float64
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", + "
  • shotNum
    (runs)
    int64
    0 1 2
    array([0, 1, 2], dtype=int64)
  • OD
    (runs, x, y)
    float64
    dask.array<chunksize=(1, 1200, 1920), meta=np.ndarray>
    IMAGE_SUBCLASS :
    IMAGE_GRAYSCALE
    IMAGE_VERSION :
    1.2
    IMAGE_WHITE_IS_ZERO :
    0
    \n", " \n", "
    \n", " \n", @@ -1281,7 +1307,7 @@ "\n", " \n", " \n", - "
    • runs
      PandasIndex
      PandasIndex(Float64Index([0.0, 1.0, 2.0], dtype='float64', name='runs'))
  • TOF_free :
    0.02
    abs_img_freq :
    110.858
    absorption_imaging_flag :
    True
    backup_data :
    True
    blink_off_time :
    nan
    blink_on_time :
    nan
    c_duration :
    0.2
    cmot_final_current :
    0.65
    cmot_hold :
    0.06
    cmot_initial_current :
    0.18
    compX_current :
    0.005
    compX_current_sg :
    0
    compX_final_current :
    0.002
    compX_initial_current :
    0.005
    compY_current :
    0
    compY_current_sg :
    0
    compY_final_current :
    0
    compY_initial_current :
    0
    compZ_current :
    0
    compZ_current_sg :
    0.189
    compZ_final_current :
    0.283
    compZ_initial_current :
    0
    default_camera :
    0
    evap_1_arm_1_final_pow :
    0.35
    evap_1_arm_1_mod_depth_final :
    0
    evap_1_arm_1_mod_depth_initial :
    1.0
    evap_1_arm_1_mod_ramp_duration :
    1.15
    evap_1_arm_1_pow_ramp_duration :
    1.65
    evap_1_arm_1_start_pow :
    7
    evap_1_arm_2_final_pow :
    5
    evap_1_arm_2_ramp_duration :
    0.5
    evap_1_arm_2_start_pow :
    0
    evap_1_mod_ramp_trunc_value :
    1
    evap_1_pow_ramp_trunc_value :
    1.0
    evap_1_rate_constant_1 :
    0.525
    evap_1_rate_constant_2 :
    0.51
    evap_2_arm_1_final_pow :
    0.037
    evap_2_arm_1_start_pow :
    0.35
    evap_2_arm_2_final_pow :
    0.09
    evap_2_arm_2_start_pow :
    5
    evap_2_ramp_duration :
    1.0
    evap_2_ramp_trunc_value :
    1.0
    evap_2_rate_constant_1 :
    0.37
    evap_2_rate_constant_2 :
    0.71
    evap_3_arm_1_final_pow :
    0.1038
    evap_3_arm_1_mod_depth_final :
    0.43
    evap_3_arm_1_mod_depth_initial :
    0
    evap_3_arm_1_start_pow :
    0.037
    evap_3_ramp_duration :
    0.1
    evap_3_ramp_trunc_value :
    1.0
    evap_3_rate_constant_1 :
    -0.879
    evap_3_rate_constant_2 :
    -0.297
    final_amp :
    8e-05
    final_freq :
    104
    gradCoil_current :
    0.18
    gradCoil_current_sg :
    0
    imaging_method :
    in_situ_absorption
    imaging_pulse_duration :
    2.5e-05
    imaging_wavelength :
    4.21291e-07
    initial_amp :
    0.62
    initial_freq :
    102.13
    mod_depth_initial :
    1.0
    mot_3d_amp :
    0.62
    mot_3d_camera_exposure_time :
    0.002
    mot_3d_camera_trigger_duration :
    0.00025
    mot_3d_freq :
    102.13
    mot_load_duration :
    4
    odt_axis_camera_trigger_duration :
    0.002
    odt_hold_time_1 :
    0.01
    odt_hold_time_2 :
    0.1
    odt_hold_time_3 :
    0.1
    odt_hold_time_4 :
    1
    pow_arm_1 :
    7
    pow_arm_2 :
    0
    pulse_delay :
    8e-05
    push_amp :
    0.16
    push_freq :
    102
    ramp_duration :
    1
    recomp_ramp_duration :
    0.5
    recomp_ramp_pow_fin_arm_1 :
    0.1038
    recomp_ramp_pow_fin_arm_2 :
    0.09
    recomp_ramp_pow_ini_arm_1 :
    0.1038
    recomp_ramp_pow_ini_arm_2 :
    0.09
    save_results :
    False
    stern_gerlach_duration :
    0.001
    wait_after_2dmot_off :
    0
    wait_time_between_images :
    0.22
    x_offset :
    0
    x_offset_img :
    0
    y_offset :
    0
    y_offset_img :
    0
    z_offset :
    0.189
    z_offset_img :
    0.189
    runs :
    [0. 1. 2.]
    scanAxis :
    ['runs']
    scanAxisLength :
    [3.]
  • " + "
    • runs
      PandasIndex
      PandasIndex(Float64Index([0.0, 1.0, 2.0], dtype='float64', name='runs'))
  • TOF_free :
    0.02
    abs_img_freq :
    110.858
    absorption_imaging_flag :
    True
    backup_data :
    True
    blink_off_time :
    nan
    blink_on_time :
    nan
    c_duration :
    0.2
    cmot_final_current :
    0.65
    cmot_hold :
    0.06
    cmot_initial_current :
    0.18
    compX_current :
    0.005
    compX_current_sg :
    0
    compX_final_current :
    0.002
    compX_initial_current :
    0.005
    compY_current :
    0
    compY_current_sg :
    0
    compY_final_current :
    0
    compY_initial_current :
    0
    compZ_current :
    0
    compZ_current_sg :
    0.189
    compZ_final_current :
    0.283
    compZ_initial_current :
    0
    default_camera :
    0
    evap_1_arm_1_final_pow :
    0.35
    evap_1_arm_1_mod_depth_final :
    0
    evap_1_arm_1_mod_depth_initial :
    1.0
    evap_1_arm_1_mod_ramp_duration :
    1.15
    evap_1_arm_1_pow_ramp_duration :
    1.65
    evap_1_arm_1_start_pow :
    7
    evap_1_arm_2_final_pow :
    5
    evap_1_arm_2_ramp_duration :
    0.5
    evap_1_arm_2_start_pow :
    0
    evap_1_mod_ramp_trunc_value :
    1
    evap_1_pow_ramp_trunc_value :
    1.0
    evap_1_rate_constant_1 :
    0.525
    evap_1_rate_constant_2 :
    0.51
    evap_2_arm_1_final_pow :
    0.037
    evap_2_arm_1_start_pow :
    0.35
    evap_2_arm_2_final_pow :
    0.09
    evap_2_arm_2_start_pow :
    5
    evap_2_ramp_duration :
    1.0
    evap_2_ramp_trunc_value :
    1.0
    evap_2_rate_constant_1 :
    0.37
    evap_2_rate_constant_2 :
    0.71
    evap_3_arm_1_final_pow :
    0.1038
    evap_3_arm_1_mod_depth_final :
    0.43
    evap_3_arm_1_mod_depth_initial :
    0
    evap_3_arm_1_start_pow :
    0.037
    evap_3_ramp_duration :
    0.1
    evap_3_ramp_trunc_value :
    1.0
    evap_3_rate_constant_1 :
    -0.879
    evap_3_rate_constant_2 :
    -0.297
    final_amp :
    8e-05
    final_freq :
    104
    gradCoil_current :
    0.18
    gradCoil_current_sg :
    0
    imaging_method :
    in_situ_absorption
    imaging_pulse_duration :
    2.5e-05
    imaging_wavelength :
    4.21291e-07
    initial_amp :
    0.62
    initial_freq :
    102.13
    mod_depth_initial :
    1.0
    mot_3d_amp :
    0.62
    mot_3d_camera_exposure_time :
    0.002
    mot_3d_camera_trigger_duration :
    0.00025
    mot_3d_freq :
    102.13
    mot_load_duration :
    4
    odt_axis_camera_trigger_duration :
    0.002
    odt_hold_time_1 :
    0.01
    odt_hold_time_2 :
    0.1
    odt_hold_time_3 :
    0.1
    odt_hold_time_4 :
    1
    pow_arm_1 :
    7
    pow_arm_2 :
    0
    pulse_delay :
    8e-05
    push_amp :
    0.16
    push_freq :
    102
    ramp_duration :
    1
    recomp_ramp_duration :
    0.5
    recomp_ramp_pow_fin_arm_1 :
    0.1038
    recomp_ramp_pow_fin_arm_2 :
    0.09
    recomp_ramp_pow_ini_arm_1 :
    0.1038
    recomp_ramp_pow_ini_arm_2 :
    0.09
    save_results :
    False
    stern_gerlach_duration :
    0.001
    wait_after_2dmot_off :
    0
    wait_time_between_images :
    0.22
    x_offset :
    0
    x_offset_img :
    0
    y_offset :
    0
    y_offset_img :
    0
    z_offset :
    0.189
    z_offset_img :
    0.189
    runs :
    [0. 1. 2.]
    scanAxis :
    ['runs']
    scanAxisLength :
    [3.]
  • " ], "text/plain": [ "\n", @@ -1293,7 +1319,7 @@ " atoms (runs, x, y) uint16 dask.array\n", " background (runs, x, y) uint16 dask.array\n", " dark (runs, x, y) uint16 dask.array\n", - " shotNum (runs) \n", "Attributes: (12/96)\n", " TOF_free: 0.02\n", @@ -1332,7 +1358,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -1353,16 +1379,16 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 8, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" }, @@ -1394,7 +1420,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -1403,7 +1429,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -1420,7 +1446,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -1431,16 +1457,16 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ - "fitResult = fitAnalyser.fit(dataSet_crop.OD, params, dask=\"parallelized\").load()" + "fitResult = fitAnalyser.fit(dataSet_crop.OD, params).load()" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -1449,16 +1475,16 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" }, @@ -1483,891 +1509,63 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "a = fitAnalyser.get_fit_value(fitResult)\n", + "b = fitAnalyser.get_fit_std(fitResult)\n", + "data = combine_uncertainty(a, b)" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Get the Ncount" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "Ncount = dataSet_crop.OD.sum(dim=(scanAxis[0], 'x', 'y'))" + ] + }, + { + "cell_type": "code", + "execution_count": 18, "metadata": {}, "outputs": [ + { + "ename": "TypeError", + "evalue": "No numeric data to plot.", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32md:\\Jianshun Gao\\Simulations\\analyseScripts\\test.ipynb Cell 29\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m fig \u001b[39m=\u001b[39m plt\u001b[39m.\u001b[39mfigure()\n\u001b[0;32m 4\u001b[0m ax \u001b[39m=\u001b[39m fig\u001b[39m.\u001b[39mgca()\n\u001b[1;32m----> 5\u001b[0m Ncount\u001b[39m.\u001b[39;49mplot(ax\u001b[39m=\u001b[39;49max)\n", + "File \u001b[1;32mD:\\Program Files\\Python\\Python38\\Lib\\site-packages\\xarray\\plot\\accessor.py:46\u001b[0m, in \u001b[0;36mDataArrayPlotAccessor.__call__\u001b[1;34m(self, **kwargs)\u001b[0m\n\u001b[0;32m 44\u001b[0m \u001b[39m@functools\u001b[39m\u001b[39m.\u001b[39mwraps(dataarray_plot\u001b[39m.\u001b[39mplot, assigned\u001b[39m=\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39m__doc__\u001b[39m\u001b[39m\"\u001b[39m, \u001b[39m\"\u001b[39m\u001b[39m__annotations__\u001b[39m\u001b[39m\"\u001b[39m))\n\u001b[0;32m 45\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__call__\u001b[39m(\u001b[39mself\u001b[39m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Any:\n\u001b[1;32m---> 46\u001b[0m \u001b[39mreturn\u001b[39;00m dataarray_plot\u001b[39m.\u001b[39;49mplot(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_da, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n", + "File \u001b[1;32mD:\\Program Files\\Python\\Python38\\Lib\\site-packages\\xarray\\plot\\dataarray_plot.py:285\u001b[0m, in \u001b[0;36mplot\u001b[1;34m(darray, row, col, col_wrap, ax, hue, subplot_kws, **kwargs)\u001b[0m\n\u001b[0;32m 282\u001b[0m plotfunc: Callable\n\u001b[0;32m 284\u001b[0m \u001b[39mif\u001b[39;00m ndims \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m \u001b[39mor\u001b[39;00m darray\u001b[39m.\u001b[39msize \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m:\n\u001b[1;32m--> 285\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mNo numeric data to plot.\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m 286\u001b[0m \u001b[39mif\u001b[39;00m ndims \u001b[39min\u001b[39;00m (\u001b[39m1\u001b[39m, \u001b[39m2\u001b[39m):\n\u001b[0;32m 287\u001b[0m \u001b[39mif\u001b[39;00m row \u001b[39mor\u001b[39;00m col:\n", + "\u001b[1;31mTypeError\u001b[0m: No numeric data to plot." + ] + }, { "data": { - "text/html": [ - "
    \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
    <xarray.DataArray 'OD' (runs: 3)>\n",
    -       "array([<lmfit.model.ModelResult object at 0x000001B28325EC40>,\n",
    -       "       <lmfit.model.ModelResult object at 0x000001B28325EEB0>,\n",
    -       "       <lmfit.model.ModelResult object at 0x000001B28320A0D0>],\n",
    -       "      dtype=object)\n",
    -       "Coordinates:\n",
    -       "  * runs     (runs) float64 0.0 1.0 2.0
    " - ], - "text/plain": [ - "\n", - "array([,\n", - " ,\n", - " ],\n", - " dtype=object)\n", - "Coordinates:\n", - " * runs (runs) float64 0.0 1.0 2.0" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "fitResult" - ] - }, - { - "cell_type": "code", - "execution_count": 138, - "metadata": {}, - "outputs": [], - "source": [ - "def resolve_fit_result(fitResult):\n", - " return\n", - "\n", - "def _get_best_value_sigle(fitResult, key):\n", - " return fitResult.params[key].value\n", - "\n", - "def _get_best_value(fitResult, params):\n", - " func = np.vectorize(_get_best_value_sigle)\n", - " res = tuple(\n", - " func(fitResult, key)\n", - " for key in params\n", - " )\n", - "\n", - " return res\n", - "\n", - "def get_best_value(fitResult):\n", - " firstIndex = {\n", - " key: fitResult[key][0]\n", - " for key in fitResult.dims\n", - " }\n", - " firstFitResult = fitResult.sel(firstIndex).item()\n", - "\n", - " params = list(firstFitResult.params.keys())\n", - "\n", - " output_core_dims=[ [] for _ in range(len(params))]\n", - "\n", - " value = xr.apply_ufunc(_get_best_value, fitResult, dask=\"forbidden\", kwargs=dict(params=params), output_core_dims=output_core_dims)\n", - "\n", - " value = xr.Dataset(\n", - " data_vars={\n", - " params[i]: value[i]\n", - " for i in range(len(params))\n", - " },\n", - " attrs=fitResult.attrs\n", - " )\n", - "\n", - " return value\n", - "\n", - "# print(_get_best_value(fitResult.to_numpy()))\n", - "value = get_best_value(fitResult)" - ] - }, - { - "cell_type": "code", - "execution_count": 139, - "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)\n",
    -       "Coordinates:\n",
    -       "  * runs         (runs) float64 0.0 1.0 2.0\n",
    -       "Data variables:\n",
    -       "    A_amplitude  (runs) float64 707.7 677.1 672.9\n",
    -       "    A_centerx    (runs) float64 53.79 54.95 53.33\n",
    -       "    A_centery    (runs) float64 41.15 45.33 42.93\n",
    -       "    A_sigmax     (runs) float64 4.623 4.042 4.348\n",
    -       "    A_sigmay     (runs) float64 11.14 11.08 10.93\n",
    -       "    B_amplitude  (runs) float64 226.6 255.8 236.7\n",
    -       "    B_centerx    (runs) float64 56.33 56.77 55.35\n",
    -       "    B_centery    (runs) float64 40.97 45.56 43.29\n",
    -       "    B_sigmax     (runs) float64 15.93 14.59 13.32\n",
    -       "    B_sigmay     (runs) float64 11.67 11.32 10.98\n",
    -       "    delta        (runs) float64 -11.31 -10.54 -8.974
    " - ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAANT0lEQVR4nO3cYYjkd33H8ffHO1NpjKb0VpC706T00njYQtIlTRFqirZc8uDugUXuIFgleGAbKVWEFEuU+MiGWhCu1ZOKVdAYfSALntwDjQTEC7chNXgXItvTeheFrDHNk6Ax7bcPZtKdrneZf3Zndy/7fb/gYP7/+e3Mlx97752d2ZlUFZKk7e8VWz2AJGlzGHxJasLgS1ITBl+SmjD4ktSEwZekJqYGP8lnkzyZ5PuXuD5JPplkKcmjSW6c/ZiSpPUa8gj/c8CBF7n+VmDf+N9R4F/WP5YkadamBr+q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YII=", "text/plain": [ - "\n", - "Dimensions: (runs: 3)\n", - "Coordinates:\n", - " * runs (runs) float64 0.0 1.0 2.0\n", - "Data variables:\n", - " A_amplitude (runs) float64 707.7 677.1 672.9\n", - " A_centerx (runs) float64 53.79 54.95 53.33\n", - " A_centery (runs) float64 41.15 45.33 42.93\n", - " A_sigmax (runs) float64 4.623 4.042 4.348\n", - " A_sigmay (runs) float64 11.14 11.08 10.93\n", - " B_amplitude (runs) float64 226.6 255.8 236.7\n", - " B_centerx (runs) float64 56.33 56.77 55.35\n", - " B_centery (runs) float64 40.97 45.56 43.29\n", - " B_sigmax (runs) float64 15.93 14.59 13.32\n", - " B_sigmay (runs) float64 11.67 11.32 10.98\n", - " delta (runs) float64 -11.31 -10.54 -8.974" + "
    " ] }, - "execution_count": 139, - "metadata": {}, - "output_type": "execute_result" + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" } ], - "source": [ - "value" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Get the Ncount" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "Ncount = dataSet_crop.OD.sum(dim=(scanAxis[0], 'x', 'y'))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], "source": [ "Ncount.load()\n", "\n",