|
|
@ -196,16 +196,16 @@ class ImageAnalyser(): |
|
|
|
return dataSet.isel(x=slice(x_start, x_end), y=slice(y_start, y_end)) |
|
|
|
|
|
|
|
def get_OD(self, imageAtom, imageBackground, imageDrak): |
|
|
|
"""_summary_ |
|
|
|
|
|
|
|
:param imageAtom: _description_ |
|
|
|
:type imageAtom: _type_ |
|
|
|
:param imageBackground: _description_ |
|
|
|
:type imageBackground: _type_ |
|
|
|
:param imageDrak: _description_ |
|
|
|
:type imageDrak: _type_ |
|
|
|
:return: _description_ |
|
|
|
:rtype: _type_ |
|
|
|
"""Calculate the OD image for absorption imaging. |
|
|
|
|
|
|
|
:param imageAtom: The image with atoms |
|
|
|
:type imageAtom: numpy array |
|
|
|
:param imageBackground: The image without atoms |
|
|
|
:type imageBackground: numpy array |
|
|
|
:param imageDrak: The image without light |
|
|
|
:type imageDrak: numpy array |
|
|
|
:return: The OD images |
|
|
|
:rtype: numpy array |
|
|
|
""" |
|
|
|
|
|
|
|
numerator = np.atleast_1d(imageBackground - imageDrak) |
|
|
@ -222,9 +222,29 @@ class ImageAnalyser(): |
|
|
|
return imageOD |
|
|
|
|
|
|
|
def get_Ncount(self, dataSet, dim=['x', 'y'], **kwargs): |
|
|
|
"""Sum all the value in the image to give the Ncount. |
|
|
|
|
|
|
|
:param dataSet: The images |
|
|
|
:type dataSet: xarray DataArray or DataSet |
|
|
|
:param dim: The dimensions to take the sumation, defaults to ['x', 'y'] |
|
|
|
:type dim: list, optional |
|
|
|
:return: The Ncount |
|
|
|
:rtype: xarray DataArray or DataSet |
|
|
|
""" |
|
|
|
return dataSet.sum(dim=['x', 'y'], **kwargs) |
|
|
|
|
|
|
|
def get_absorption_images(self, dataSet, dask='allowed', keep_attrs=True, **kwargs): |
|
|
|
"""Calculate the OD images for absorption imaging. |
|
|
|
|
|
|
|
:param dataSet: The data from absorption imaging. |
|
|
|
:type dataSet: xarray DataSet |
|
|
|
:param dask: over write of the same argument in xarray.apply_ufunc, defaults to 'allowed' |
|
|
|
:type dask: str, optional |
|
|
|
:param keep_attrs: over write of the same argument in xarray.apply_ufunc, defaults to True |
|
|
|
:type keep_attrs: bool, optional |
|
|
|
:return: The data including the OD images. |
|
|
|
:rtype: xarray DataSet |
|
|
|
""" |
|
|
|
|
|
|
|
kwargs.update( |
|
|
|
{ |
|
|
@ -244,7 +264,16 @@ class ImageAnalyser(): |
|
|
|
return dataSet |
|
|
|
|
|
|
|
def remove_background(self, dataSet, dask='allowed', keep_attrs=True, **kwargs): |
|
|
|
|
|
|
|
"""Remove the background for the given image data |
|
|
|
|
|
|
|
:param dataSet: The data from absorption imaging. |
|
|
|
:type dataSet: xarray DataSet |
|
|
|
:param dask: over write of the same argument in xarray.apply_ufunc, defaults to 'allowed' |
|
|
|
:type dask: str, optional |
|
|
|
:param keep_attrs: over write of the same argument in xarray.apply_ufunc, defaults to True |
|
|
|
:type keep_attrs: bool, optional |
|
|
|
""" |
|
|
|
|
|
|
|
kwargs.update( |
|
|
|
{ |
|
|
|
'dask': dask, |
|
|
|