ribolands/utils.py
def parse_ratefile(rfile, binary = False):
    """Return the content of a barriers rates-file.

    Args:
      rfile (str): Filename of a barriers rates file.
      binary (bool, optional): Set to True if the rates file is in binary format.
        Defaults to False.

    Returns:
      [[flt],[flt]]: A rate matrix.
    """
    if binary:
        with open(rfile, 'rb') as rf:
            dim, = unpack('i', rf.read(calcsize('i')))
            rm = []
            for e in range(dim):
                col = []
                for e in range(dim):
                    r, = unpack('d', rf.read(8))
                    col.append(r)
                rm.append(col)
            RM = list(map(list, list(zip(*rm))))
    else:
        RM = []
        with open(rfile) as rates:
            for line in rates:
                RM.append((list(map(float, line.strip().split()))))
    return RM
Return the content of a barriers rates-file.

    Args:
      rfile (str): Filename of a barriers rates file.
      binary (bool, optional): Set to True if the rates file is in binary format.
        Defaults to False.

    Returns:
      [[flt],[flt]]: A rate matrix.
    
Return the content of a barriers rates-file.
Return the content of a barriers rates - file .
def parse_ratefile(rfile, binary = False):
    if binary:
        with open(rfile, 'rb') as rf:
            dim, = unpack('i', rf.read(calcsize('i')))
            rm = []
            for e in range(dim):
                col = []
                for e in range(dim):
                    r, = unpack('d', rf.read(8))
                    col.append(r)
                rm.append(col)
            RM = list(map(list, list(zip(*rm))))
    else:
        RM = []
        with open(rfile) as rates:
            for line in rates:
                RM.append((list(map(float, line.strip().split()))))
    return RM
def parse_ratefile ( rfile , binary = False ) : if binary : with open ( rfile , 'rb' ) as rf : dim , = unpack ( 'i' , rf . read ( calcsize ( 'i' ) ) ) rm = [ ] for e in range ( dim ) : col = [ ] for e in range ( dim ) : r , = unpack ( 'd' , rf . read ( 8 ) ) col . append ( r ) rm . append ( col ) RM = list ( map ( list , list ( zip ( * rm ) ) ) ) else : RM = [ ] with open ( rfile ) as rates : for line in rates : RM . append ( ( list ( map ( float , line . strip ( ) . split ( ) ) ) ) ) return RM
Return the content of a barriers rates-file.
Return the content of a barriers rates - file .
"""Return the content of a barriers rates-file.

    Args:
      rfile (str): Filename of a barriers rates file.
      binary (bool, optional): Set to True if the rates file is in binary format.
        Defaults to False.

    Returns:
      [[flt],[flt]]: A rate matrix.
    """
A rate matrix.
A rate matrix .
[[flt],[flt]]
rfile
Filename of a barriers rates file.
Filename of a barriers rates file .
binary
Set to True if the rates file is in binary format.
Defaults to False.
Set to True if the rates file is in binary format . Defaults to False .