Browse Source

bugs fixing

joschka_dev
Jianshun Gao 1 year ago
parent
commit
c85b19ec44
  1. 6
      Analyser/FitAnalyser.py
  2. 4
      DataContainer/ReadData.py
  3. 30
      ToolFunction/HomeMadeXarrayFunction.py
  4. 2
      ToolFunction/ToolFunction.py

6
Analyser/FitAnalyser.py

@ -559,7 +559,8 @@ class FitAnalyser():
}
)
return xr.apply_ufunc(self._eval_1D, fitResultArray, kwargs={"x":x}, **kwargs)
res = xr.apply_ufunc(self._eval_1D, fitResultArray, kwargs={"x":x}, **kwargs)
return res.assign_coords({prefix+'x':np.array(x)})
if self.fitDim == 2:
if output_core_dims is None:
@ -586,7 +587,8 @@ class FitAnalyser():
_x = _x.flatten()
_y = _y.flatten()
return xr.apply_ufunc(self._eval_2D, fitResultArray, kwargs={"x":_x, "y":_y, "shape":(len(x), len(y))}, **kwargs)
res = xr.apply_ufunc(self._eval_2D, fitResultArray, kwargs={"x":_x, "y":_y, "shape":(len(x), len(y))}, **kwargs)
return res.assign_coords({prefix+'x':np.array(x), prefix+'y':np.array(y)})
def _get_fit_value_single(self, fitResult, key):
return fitResult.params[key].value

4
DataContainer/ReadData.py

@ -113,7 +113,7 @@ def update_hdf5_file():
pass
def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None, join="outer", parallel=True, engine="h5netcdf", phony_dims="access", **kwargs):
def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None, join="outer", parallel=True, engine="h5netcdf", phony_dims="access", excludeAxis=[], **kwargs):
filePath = np.sort(np.atleast_1d(filePath))
@ -152,6 +152,8 @@ def read_hdf5_file(filePath, group=None, datesetOfGlobal=None, preprocess=None,
combine_attrs=_read_globals_attrs,
parallel=True, )
datesetOfGlobal.attrs['scanAxis'] = np.setdiff1d(datesetOfGlobal.attrs['scanAxis'], excludeAxis)
_assgin_scan_axis = partial(_assign_scan_axis_partial, datesetOfGlobal=datesetOfGlobal, fullFilePath=fullFilePath)
if preprocess is None:

30
ToolFunction/HomeMadeXarrayFunction.py

@ -210,7 +210,35 @@ def errorbar(
_ensure_plottable(xplt_val, yplt_val)
primitive = ax.errorbar(xplt_val, yplt_val, *args, xerr=xerr, yerr=yerr, **kwargs)
fmt = None
if 'fmt' in kwargs and isinstance(kwargs['fmt'], list):
fmt = kwargs["fmt"]
if len(np.shape(xplt_val)) == len(np.shape(yplt_val)):
primitive = ax.errorbar(xplt_val, yplt_val, *args, xerr=xerr, yerr=yerr, **kwargs)
else:
primitive = np.empty(np.shape(yplt_val)[1], dtype=object)
if not yerr is None:
if not fmt is None:
for i in range(np.shape(yplt_val)[1]):
kwargs.update({'fmt': fmt[i]})
primitive[i] = ax.errorbar(xplt_val, yplt_val[:, i], *args, xerr=xerr, yerr=yerr[:, i], **kwargs)
else:
for i in range(np.shape(yplt_val)[1]):
primitive[i] = ax.errorbar(xplt_val, yplt_val[:, i], *args, xerr=xerr, yerr=yerr[:, i], **kwargs)
else:
if not fmt is None:
for i in range(np.shape(yplt_val)[1]):
kwargs.update({'fmt': fmt[i]})
primitive[i] = ax.errorbar(xplt_val, yplt_val[:, i], *args, xerr=xerr, yerr=yerr, **kwargs)
else:
for i in range(np.shape(yplt_val)[1]):
primitive[i] = ax.errorbar(xplt_val, yplt_val[:, i], *args, xerr=xerr, yerr=yerr, **kwargs)
primitive = tuple(primitive)
if _labels:
if xlabel is not None:

2
ToolFunction/ToolFunction.py

@ -104,7 +104,7 @@ def print_scanAxis(dataSet):
key: scanValue[indices]
}
)
print("The detected scaning axes and values are: /n")
print("The detected scaning axes and values are: \n")
print(scan)

Loading…
Cancel
Save