src/pys5p/s5p_msm.py
def nanmedian(self, data_sel=None, axis=0, keepdims=False):
        """
        Returns S5Pmsm object containing median & standard deviation of the
        original data

        Parameters
        ----------
        data_sel  :  numpy slice, optional
           A numpy slice generated for example numpy.s_. Can be used to skip
           the first and/or last frame
        axis      : int, optional
           Axis or axes along which the medians are computed. Default is 0.
        keepdims  : bool, optional
           If this is set to True, the axes which are reduced are left in the
           result as dimensions with size one. With this option, the result
           will broadcast correctly against the original arr.

        Returns
        -------
        S5Pmsm object with its data (value & error) replaced by its nanmedian
        and standard deviation along one axis.
        The coordinates are adjusted, accordingly.
        """
        if data_sel is None:
            if self.error is not None:
                self.error = np.nanmedian(self.error,
                                          axis=axis, keepdims=keepdims)
            else:
                self.error = np.nanstd(self.value, ddof=1,
                                       axis=axis, keepdims=keepdims)
            self.value = np.nanmedian(self.value, axis=axis, keepdims=keepdims)
        else:
            if self.error is not None:
                self.error = np.nanmedian(self.error[data_sel],
                                          axis=axis, keepdims=keepdims)
            else:
                self.error = np.nanstd(self.value[data_sel], ddof=1,
                                       axis=axis, keepdims=keepdims)
            self.value = np.nanmedian(self.value[data_sel],
                                      axis=axis, keepdims=keepdims)

        # adjust the coordinates
        if keepdims:
            key = self.coords._fields[axis]
            if self.coords[axis][0] == 0:
                dims = [0]
            else:
                dims = np.median(self.coords[axis], keepdims=keepdims)
            self.coords = self.coords._replace(**{key: dims})
        else:
            keys = []
            dims = []
            for ii in range(self.value.ndim+1):
                if ii != axis:
                    keys.append(self.coords._fields[ii])
                    dims.append(self.coords[ii][:])
            coords_namedtuple = namedtuple('Coords', keys)
            self.coords = coords_namedtuple._make(dims)

        return self

        Returns S5Pmsm object containing median & standard deviation of the
        original data

        Parameters
        ----------
        data_sel  :  numpy slice, optional
           A numpy slice generated for example numpy.s_. Can be used to skip
           the first and/or last frame
        axis      : int, optional
           Axis or axes along which the medians are computed. Default is 0.
        keepdims  : bool, optional
           If this is set to True, the axes which are reduced are left in the
           result as dimensions with size one. With this option, the result
           will broadcast correctly against the original arr.

        Returns
        -------
        S5Pmsm object with its data (value & error) replaced by its nanmedian
        and standard deviation along one axis.
        The coordinates are adjusted, accordingly.
        
Returns S5Pmsm object containing median & standard deviation of the
original data

Parameters

data_sel  :  numpy slice, optional
A numpy slice generated for example numpy.s_. Can be used to skip
the first and/or last frame
axis      : int, optional
Axis or axes along which the medians are computed. Default is 0.
keepdims  : bool, optional
If this is set to True, the axes which are reduced are left in the
result as dimensions with size one. With this option, the result
will broadcast correctly against the original arr.

Returns

S5Pmsm object with its data (value & error) replaced by its nanmedian
and standard deviation along one axis.
The coordinates are adjusted, accordingly.
Returns S5Pmsm object containing median & standard deviation of the original data Parameters data_sel : numpy slice optional A numpy slice generated for example numpy . s_ . Can be used to skip the first and / or last frame axis : int optional Axis or axes along which the medians are computed . Default is 0 . keepdims : bool optional If this is set to True the axes which are reduced are left in the result as dimensions with size one . With this option the result will broadcast correctly against the original arr . Returns S5Pmsm object with its data ( value & error ) replaced by its nanmedian and standard deviation along one axis . The coordinates are adjusted accordingly .
def nanmedian(self, data_sel=None, axis=0, keepdims=False):
        if data_sel is None:
            if self.error is not None:
                self.error = np.nanmedian(self.error,
                                          axis=axis, keepdims=keepdims)
            else:
                self.error = np.nanstd(self.value, ddof=1,
                                       axis=axis, keepdims=keepdims)
            self.value = np.nanmedian(self.value, axis=axis, keepdims=keepdims)
        else:
            if self.error is not None:
                self.error = np.nanmedian(self.error[data_sel],
                                          axis=axis, keepdims=keepdims)
            else:
                self.error = np.nanstd(self.value[data_sel], ddof=1,
                                       axis=axis, keepdims=keepdims)
            self.value = np.nanmedian(self.value[data_sel],
                                      axis=axis, keepdims=keepdims)
        if keepdims:
            key = self.coords._fields[axis]
            if self.coords[axis][0] == 0:
                dims = [0]
            else:
                dims = np.median(self.coords[axis], keepdims=keepdims)
            self.coords = self.coords._replace(**{key: dims})
        else:
            keys = []
            dims = []
            for ii in range(self.value.ndim+1):
                if ii != axis:
                    keys.append(self.coords._fields[ii])
                    dims.append(self.coords[ii][:])
            coords_namedtuple = namedtuple('Coords', keys)
            self.coords = coords_namedtuple._make(dims)
        return self
def nanmedian ( self , data_sel = None , axis = 0 , keepdims = False ) : if data_sel is None : if self . error is not None : self . error = np . nanmedian ( self . error , axis = axis , keepdims = keepdims ) else : self . error = np . nanstd ( self . value , ddof = 1 , axis = axis , keepdims = keepdims ) self . value = np . nanmedian ( self . value , axis = axis , keepdims = keepdims ) else : if self . error is not None : self . error = np . nanmedian ( self . error [ data_sel ] , axis = axis , keepdims = keepdims ) else : self . error = np . nanstd ( self . value [ data_sel ] , ddof = 1 , axis = axis , keepdims = keepdims ) self . value = np . nanmedian ( self . value [ data_sel ] , axis = axis , keepdims = keepdims ) if keepdims : key = self . coords . _fields [ axis ] if self . coords [ axis ] [ 0 ] == 0 : dims = [ 0 ] else : dims = np . median ( self . coords [ axis ] , keepdims = keepdims ) self . coords = self . coords . _replace ( ** { key : dims } ) else : keys = [ ] dims = [ ] for ii in range ( self . value . ndim + 1 ) : if ii != axis : keys . append ( self . coords . _fields [ ii ] ) dims . append ( self . coords [ ii ] [ : ] ) coords_namedtuple = namedtuple ( 'Coords' , keys ) self . coords = coords_namedtuple . _make ( dims ) return self
Returns S5Pmsm object containing median & standard deviation of the
original data
Returns S5Pmsm object containing median & standard deviation of the original data
"""
        Returns S5Pmsm object containing median & standard deviation of the
        original data

        Parameters
        ----------
        data_sel  :  numpy slice, optional
           A numpy slice generated for example numpy.s_. Can be used to skip
           the first and/or last frame
        axis      : int, optional
           Axis or axes along which the medians are computed. Default is 0.
        keepdims  : bool, optional
           If this is set to True, the axes which are reduced are left in the
           result as dimensions with size one. With this option, the result
           will broadcast correctly against the original arr.

        Returns
        -------
        S5Pmsm object with its data (value & error) replaced by its nanmedian
        and standard deviation along one axis.
        The coordinates are adjusted, accordingly.
        """ # adjust the coordinates
self
data_sel
axis
keepdims