Ejemplo n.º 1
0
def plot_single_matrix(args):

    cwd = os.getcwd()
    subdir = args.subdir

    os.chdir(subdir)

    FRETfile = args.trace
    FRETr = np.loadtxt(FRETfile)

    # Calculate transition matrix
    tmatrix = tmcalc.get_T_matrix(FRETr,
                                  spacing=args.spacing,
                                  framestep=args.fstep)

    # Unflatten matrix if necessary
    if tmcalc.check_matrix(tmatrix):
        tmatrix = tmcalc.unflatten_matrix(tmatrix)

    # Plot matrix
    if "color" in args.plot_type:
        diff = False
        ptm.plot_matrix(tmatrix, "Transition Matrix", 0, 0.5, diff)
    if "spy" in args.plot_type:
        ptm.spy_matrix(tmatrix, "Non-Zero Transitions")
Ejemplo n.º 2
0
def plot_single_matrix(args):
    
    cwd = os.getcwd()
    subdir = args.subdir

    os.chdir(subdir)
    
    FRETfile = args.trace
    FRETr = np.loadtxt(FRETfile)
    
    # Calculate transition matrix
    tmatrix = tmcalc.get_T_matrix(FRETr, spacing=args.spacing, framestep=args.fstep)
    
    # Unflatten matrix if necessary
    if tmcalc.check_matrix(tmatrix):
        tmatrix = tmcalc.unflatten_matrix(tmatrix)

    # Plot matrix
    if "color" in args.plot_type:
        diff = False
        ptm.plot_matrix(tmatrix, "Transition Matrix", 0, 0.5, diff)
    if "spy" in args.plot_type:
        ptm.spy_matrix(tmatrix, "Non-Zero Transitions")
Ejemplo n.º 3
0
def plot_compare(args):

    cwd = os.getcwd()
    subdir = args.subdir
    os.chdir(subdir)

    FRETfile = args.trace
    FRETr = np.loadtxt(FRETfile)

    # Load full experimental transition matrix
    TMfile = args.TMfile
    T_matrix = np.loadtxt(TMfile)

    # Calculate and unflatten transition matrix
    tmatrix = tmcalc.get_T_matrix(FRETr,
                                  spacing=args.spacing,
                                  framestep=args.fstep)
    if tmcalc.check_matrix(tmatrix):
        tmatrix = tmcalc.unflatten_matrix(tmatrix)

    # Calculate experimental matrix
    bin_size = np.size(tmatrix)**0.5
    spacing = 0.1
    lower_ran = spacing * (np.floor(10 * np.min(FRETr)))
    upper_ran = spacing * (np.ceil(10 * np.max(FRETr)))
    ran_size = (lower_ran, upper_ran)
    tmatrix_exp = xtm.tmatrix_exp_calc(T_matrix, bin_size, ran_size, spacing)
    if tmcalc.check_matrix(tmatrix_exp):
        tmatrix_exp = tmcalc.unflatten_matrix(tmatrix_exp)

    # Difference matrix
    diff_matrix = tmatrix - tmatrix_exp
    diff_squared = np.mean(np.abs(diff_matrix))
    print "Average absolute difference is: "
    print diff_squared

    # Generate plots
    if "color" in args.plot_type:
        ptm.plot_matrix(tmatrix, "Simulated Transition Matrix", 0, 0.5)
        ptm.plot_matrix(tmatrix_exp, "Experimental Transition Matrix", 0, 0.5)
        ptm.plot_matrix(diff_matrix,
                        "Transition Probability Differences",
                        -0.5,
                        0.5,
                        diff=True)
    if "spy" in args.plot_type:
        ptm.spy_matrix(tmatrix, "Non-zero entries, simulated")
        ptm.spy_matrix(tmatrix_exp, "Non-zero entries, experimental")
        ptm.spy_matrix(diff_matrix, "Non-zero entries, difference")
Ejemplo n.º 4
0
def plot_compare(args):
    
    cwd = os.getcwd()
    subdir = args.subdir
    os.chdir(subdir)
    
    FRETfile = args.trace
    FRETr = np.loadtxt(FRETfile)
    
    # Load full experimental transition matrix
    TMfile = args.TMfile
    T_matrix = np.loadtxt(TMfile)
    
    # Calculate and unflatten transition matrix
    tmatrix = tmcalc.get_T_matrix(FRETr, spacing=args.spacing, framestep=args.fstep)
    if tmcalc.check_matrix(tmatrix):
        tmatrix = tmcalc.unflatten_matrix(tmatrix)
    
    # Calculate experimental matrix
    bin_size = np.size(tmatrix)**0.5
    spacing=0.1
    lower_ran = spacing*(np.floor(10*np.min(FRETr)))
    upper_ran = spacing*(np.ceil(10*np.max(FRETr)))
    ran_size = (lower_ran, upper_ran)
    tmatrix_exp = xtm.tmatrix_exp_calc(T_matrix, bin_size, ran_size, spacing)
    if tmcalc.check_matrix(tmatrix_exp):
        tmatrix_exp = tmcalc.unflatten_matrix(tmatrix_exp)
    
    # Difference matrix
    diff_matrix = tmatrix - tmatrix_exp
    diff_squared = np.mean(np.abs(diff_matrix))
    print "Average absolute difference is: "
    print diff_squared
    
    # Generate plots
    if "color" in args.plot_type:
        ptm.plot_matrix(tmatrix, "Simulated Transition Matrix", 0, 0.5)
        ptm.plot_matrix(tmatrix_exp, "Experimental Transition Matrix", 0, 0.5)
        ptm.plot_matrix(diff_matrix, "Transition Probability Differences", -0.5, 0.5, diff=True)
    if "spy" in args.plot_type:
        ptm.spy_matrix(tmatrix, "Non-zero entries, simulated")
        ptm.spy_matrix(tmatrix_exp, "Non-zero entries, experimental")
        ptm.spy_matrix(diff_matrix, "Non-zero entries, difference")