def _get_obs_array(self, k, use_raw=False, layer='X'):
        """Get an array from the layer (default layer='X') along the observation dimension by first looking up
        obs.keys and then var.index."""
        in_raw_var_names = k in self.raw.var_names if self.raw is not None else False

        if use_raw and self.raw is None:
            raise ValueError('.raw doesn\'t exist')

        if k in self.obs.keys():
            x = self._obs[k]
        elif in_raw_var_names and use_raw and layer == 'X':
            x = self.raw[:, k].X
        elif k in self.var_names and not use_raw and (layer == 'X' or layer in self.layers.keys()):
            x = self[:, k].X if layer=='X' else self[:, k].layers[layer]
        elif use_raw and layer != 'X':
            raise ValueError('No layers in .raw')
        elif layer != 'X' and layer not in self.layers.keys():
            raise ValueError('Did not find {} in layers.keys.'
                             .format(layer))
        else:
            raise ValueError('Did not find {} in obs.keys or var_names.'
                             .format(k))
        return x
def _get_obs_array ( self , k , use_raw = False , layer = 'X' ) : in_raw_var_names = k in self . raw . var_names if self . raw is not None else False if use_raw and self . raw is None : raise ValueError ( '.raw doesn\'t exist' ) if k in self . obs . keys ( ) : x = self . _obs [ k ] elif in_raw_var_names and use_raw and layer == 'X' : x = self . raw [ : , k ] . X elif k in self . var_names and not use_raw and ( layer == 'X' or layer in self . layers . keys ( ) ) : x = self [ : , k ] . X if layer == 'X' else self [ : , k ] . layers [ layer ] elif use_raw and layer != 'X' : raise ValueError ( 'No layers in .raw' ) elif layer != 'X' and layer not in self . layers . keys ( ) : raise ValueError ( 'Did not find {} in layers.keys.' . format ( layer ) ) else : raise ValueError ( 'Did not find {} in obs.keys or var_names.' . format ( k ) ) return x
Get an array from the layer (default layer='X') along the observation dimension by first looking up
        obs.keys and then var.index.