示例#1
0
文件: driver.py 项目: gabocic/python
 def plot_matrix(self, parameters):
     matrix_image_file_path = os.path.join(self.workspaceHandler["matrix"], parameters["data"]["matrix"]["image"]["filename"])
     max_dim = parameters.get_value("data.matrix.image.dimension", default_value = 1000)
     plotTools.matrixToImage(self.matrixHandler.distance_matrix, matrix_image_file_path, max_dim=max_dim, observer=self.observer)
     self.generatedFiles.append({"description":"Matrix image",
                                 "path":os.path.abspath(matrix_image_file_path),
                                 "type":"image"})
示例#2
0
文件: driver.py 项目: lowks/pyProCT
 def create_matrix(self, parameters):
     self.matrixHandler = MatrixHandler(parameters["data"]["matrix"])
     self.notify("Matrix calculation", [])
     self.timer.start("Matrix Generation")
     self.matrixHandler.create_matrix(self.trajectoryHandler)
     statistics_file_path = self.matrixHandler.save_statistics(self.workspaceHandler["matrix"])
     self.generatedFiles.append({"description":"Matrix statistics",
                                 "path":os.path.abspath(statistics_file_path),
                                 "type":"text"})
     self.timer.stop("Matrix Generation")
     if "filename" in parameters["data"]["matrix"]:
         self.timer.start("Matrix Save")
         self.matrixHandler.save_matrix(os.path.join(self.workspaceHandler["matrix"], parameters["data"]["matrix"]["filename"]))
         self.timer.stop("Matrix Save")
     #########################
     # Matrix plot
     #########################
     if "image" in parameters["data"]["matrix"].keys():
         self.timer.start("Matrix Imaging")
         matrix_image_file_path = os.path.join(self.workspaceHandler["matrix"], parameters["data"]["matrix"]["image"]["filename"])
         max_dim = parameters["data"]["matrix"]["image"]["dimension"] if "dimension" in parameters["data"]["matrix"]["image"] else 1000
         plotTools.matrixToImage(self.matrixHandler.distance_matrix, matrix_image_file_path, max_dim=max_dim, observer=self.observer)
         self.generatedFiles.append({"description":"Matrix image",
                                     "path":os.path.abspath(matrix_image_file_path),
                                     "type":"image"})
         self.timer.stop("Matrix Imaging")
示例#3
0
 def plot_matrix(cls, matrix_handler, workspace_handler, parameters, generated_files):
     matrix_image_file_path = os.path.join(workspace_handler["matrix"], 
                                           parameters["image"]["filename"])
     max_dim = parameters.get_value("image.dimension", default_value = 1000)
     
     plotTools.matrixToImage(matrix_handler.distance_matrix, 
                             matrix_image_file_path, 
                             max_dim=max_dim)
     
     generated_files.append({
                            "description":"Matrix image",
                            "path":os.path.abspath(matrix_image_file_path),
                            "type":"image"
     })
def process_matrix(folders, image_path, sim_type):
    data = []
    for i in range(0,len(folders)-1):
        A_folder = folders[i]
        for j in range(i+1,len(campari_folders)):
            B_folder = folders[j]
            results_file = os.path.join("comparisons",sim_type, "%svs%s"%(A_folder, B_folder), "results", "conf_space_comp.json")
            print results_file
            if os.path.exists(results_file):
                data.append(load_dic_in_json(results_file)["overlap"])
            else:
                data.append(0.)
    print data
    matrixToImage(CondensedMatrix(data), image_path, diagonal_value=1.)
示例#5
0
def print_matrix(input_coordsets, output):
    # Generate the matrix and print it
    calculator = RMSDCalculator(calculatorType="QCP_OMP_CALCULATOR",
                                fittingCoordsets=input_coordsets)
    matrixToImage(CondensedMatrix(calculator.pairwiseRMSDMatrix()),
                  output + ".png")
示例#6
0
    parameters["data"]["files"] = [sys.argv[1], sys.argv[2]]

    frames_ini = get_number_of_frames(sys.argv[1])
    frames_proto = get_number_of_frames(sys.argv[2])
    print sys.argv[1],"->",frames_ini
    print sys.argv[2],"->",frames_proto

    try:
        Driver(Observer()).run(parameters)
    except SystemExit:
        # Expected improductive search
        # Load again the matrix
        handler = MatrixHandler({
            "method": "load",
            "parameters": {
                "path": parameters["workspace"]["base"]+"/matrix/matrix"
            }
        })
        matrix = handler.create_matrix(None)
        submatrix = get_submatrix(matrix, range(frames_ini,frames_ini+frames_proto))
        matrixToImage(submatrix, parameters["workspace"]["base"] +"/submatrix.png")
        print "Original mean:",get_submatrix(matrix, range(0,frames_ini)).calculateMean()
        values = []
        for i in range(0,frames_ini):
            for j in range(frames_ini,frames_ini+frames_proto):
                values.append((handler.distance_matrix[i,j],i,j-frames_ini))
        for d,i,j in sorted(values):
            print "%d %d %.2f"% (i,j,d)

        print "Combined mean:", numpy.mean(values)
示例#7
0
    print sys.argv[1], "->", frames_ini
    print sys.argv[2], "->", frames_proto

    try:
        Driver(Observer()).run(parameters)
    except SystemExit:
        # Expected improductive search
        # Load again the matrix
        handler = MatrixHandler({
            "method": "load",
            "parameters": {
                "path": parameters["workspace"]["base"] + "/matrix/matrix"
            }
        })
        matrix = handler.create_matrix(None)
        submatrix = get_submatrix(matrix,
                                  range(frames_ini, frames_ini + frames_proto))
        matrixToImage(submatrix,
                      parameters["workspace"]["base"] + "/submatrix.png")
        print "Original mean:", get_submatrix(matrix, range(
            0, frames_ini)).calculateMean()
        values = []
        for i in range(0, frames_ini):
            for j in range(frames_ini, frames_ini + frames_proto):
                values.append((handler.distance_matrix[i,
                                                       j], i, j - frames_ini))
        for d, i, j in sorted(values):
            print "%d %d %.2f" % (i, j, d)

        print "Combined mean:", numpy.mean(values)
def print_matrix(input_coordsets, output):
    # Generate the matrix and print it
    calculator = RMSDCalculator(calculatorType="QCP_OMP_CALCULATOR", fittingCoordsets = input_coordsets)
    matrixToImage(CondensedMatrix(calculator.pairwiseRMSDMatrix()), output + ".png")