pypet/parameter.py
def _reconstruct_matrix(data_list):
        """Reconstructs a matrix from a list containing sparse matrix extracted properties

        `data_list` needs to be formatted as the first result of
        :func:`~pypet.parameter.SparseParameter._serialize_matrix`

        """
        matrix_format = data_list[0]
        data = data_list[1]
        is_empty = isinstance(data, str) and data == '__empty__'

        if matrix_format == 'csc':
            if is_empty:
                return spsp.csc_matrix(data_list[4])
            else:
                return spsp.csc_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'csr':
            if is_empty:
                return spsp.csr_matrix(data_list[4])
            else:
                return spsp.csr_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'bsr':
            if is_empty:
                # We have an empty matrix, that cannot be build as in elee case
                return spsp.bsr_matrix(data_list[4])
            else:
                return spsp.bsr_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'dia':
            if is_empty:
                return spsp.dia_matrix(data_list[3])
            else:
                return spsp.dia_matrix(tuple(data_list[1:3]), shape=data_list[3])
        else:
            raise RuntimeError('You shall not pass!')
def _reconstruct_matrix(data_list):
        matrix_format = data_list[0]
        data = data_list[1]
        is_empty = isinstance(data, str) and data == '__empty__'

        if matrix_format == 'csc':
            if is_empty:
                return spsp.csc_matrix(data_list[4])
            else:
                return spsp.csc_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'csr':
            if is_empty:
                return spsp.csr_matrix(data_list[4])
            else:
                return spsp.csr_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'bsr':
            if is_empty:
                # We have an empty matrix, that cannot be build as in elee case
                return spsp.bsr_matrix(data_list[4])
            else:
                return spsp.bsr_matrix(tuple(data_list[1:4]), shape=data_list[4])
        elif matrix_format == 'dia':
            if is_empty:
                return spsp.dia_matrix(data_list[3])
            else:
                return spsp.dia_matrix(tuple(data_list[1:3]), shape=data_list[3])
        else:
            raise RuntimeError('You shall not pass!')
def _reconstruct_matrix ( data_list ) : matrix_format = data_list [ 0 ] data = data_list [ 1 ] is_empty = isinstance ( data , str ) and data == '__empty__' if matrix_format == 'csc' : if is_empty : return spsp . csc_matrix ( data_list [ 4 ] ) else : return spsp . csc_matrix ( tuple ( data_list [ 1 : 4 ] ) , shape = data_list [ 4 ] ) elif matrix_format == 'csr' : if is_empty : return spsp . csr_matrix ( data_list [ 4 ] ) else : return spsp . csr_matrix ( tuple ( data_list [ 1 : 4 ] ) , shape = data_list [ 4 ] ) elif matrix_format == 'bsr' : if is_empty : # We have an empty matrix, that cannot be build as in elee case return spsp . bsr_matrix ( data_list [ 4 ] ) else : return spsp . bsr_matrix ( tuple ( data_list [ 1 : 4 ] ) , shape = data_list [ 4 ] ) elif matrix_format == 'dia' : if is_empty : return spsp . dia_matrix ( data_list [ 3 ] ) else : return spsp . dia_matrix ( tuple ( data_list [ 1 : 3 ] ) , shape = data_list [ 3 ] ) else : raise RuntimeError ( 'You shall not pass!' )
Reconstructs a matrix from a list containing sparse matrix extracted properties

        `data_list` needs to be formatted as the first result of
        :func:`~pypet.parameter.SparseParameter._serialize_matrix`
Reconstructs a matrix from a list containing sparse matrix extracted properties