當前位置: 首頁>>代碼示例>>Python>>正文


Python Data.data方法代碼示例

本文整理匯總了Python中Data.data方法的典型用法代碼示例。如果您正苦於以下問題:Python Data.data方法的具體用法?Python Data.data怎麽用?Python Data.data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Data的用法示例。


在下文中一共展示了Data.data方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: compile_and_resample

# 需要導入模塊: import Data [as 別名]
# 或者: from Data import data [as 別名]
def compile_and_resample(rs_factor, path):
    """ Will compile all of the data for a given simulation run and save
        all of it including individual metrics trends. Will also return
        a saved version of the compiled data
        return - compiled data object
    """
    #keep track of all the data
    all_data = []
    #first list all of the dirs
    dirs = os.listdir(path)
    num_sims = 0#keep track of the names
    names = []
    for i in range(0, len(dirs)):
        d = dirs[i]
        if(os.path.isdir(path + d)):
            #find the data.txt and load this form a file
            info = Data.data()
            loaded = True
            try:
                info.load(path + d + "\\data.txt")
            except IOError:
                loaded = False
            print(path + d, loaded)
            if(loaded):
                #append this to the data list
                all_data.append(info)
                names.append(d)
                #increment this count
                num_sims += 1

    #Now for each of the data sets only take every r_s timepoint
    d = Data.data()
    #add all fo the measurements to this
    print('Copying measurements...')
    ml = all_data[0].get_measurement_list()
    for i in range(0, len(ml)):
        d.add_measurement(ml[i])
        print(ml[i])
    for i in range(0, num_sims):
        #get the data object
        info = all_data[i]
        #get all its samples (ie.e time-points)
        sl = info.get_sample_list()
        #add these measurements with the sample ID
        for j in range(0, len(sl)):
            #gte it measurement list
            ml = info.get_measurement_list()
            #see if it matches the resampleing factor
            if(j % rs_factor == 0):
                #get the measurement associated with this data
                ms = info.get_sample(sl[j])
                #get the name
                name = names[i] + "_" + sl[j]
##                print("Processing...")
##                print(name)
                #add this as a sample
                d.add_sample(name)
                #Now for all of these measurements,
                #add them to the new data set
                for k in range(0, len(ml)):
                    d.set_data(name, ml[k], ms[k])
    #save the heat map
    d.save(path + "compiled_data.txt")
    #normalize
    d.normalize_measurements()
    #tranpose the measurements
    d.transpose_measurments_and_samples()
    d.save_heat_map(path)
    #cluster
    d.save_clustered_heat_map(path)
    #return it
    return d
開發者ID:dmarcbriers,項目名稱:Cell_Model,代碼行數:74,代碼來源:ModelAnalysisFunctions.py

示例2: for

# 需要導入模塊: import Data [as 別名]
# 或者: from Data import data [as 別名]
                    if self.NMS_IOU(cls_collect[i], cls_collect[j]) > cfg.NMS_threshold:
                        cls_collect[i] = [(x + y) / 2.0 for (x, y) in zip(cls_collect[i], cls_collect[j])]
                        del cls_collect[j]

            for each_result in cls_collect:
                final_result.append(
                    [each_result[1], each_result[2], each_result[3] - each_result[1], each_result[4] - each_result[2],
                     cls_ind, each_result[0]])
        return final_result

if __name__ == '__main__':

    train = True
    if train:
        net = Net.Alexnet(is_training = True)
        data = Data.data()
        solver = Solver(net, data, is_training = True)
        solver.train()
    else:
        net = Net.Alexnet(is_training=False)
        data = Data.data()
        solver = Solver(net, data, is_training=False)
        solver.predict()







開發者ID:ausk,項目名稱:Fast-RCNN,代碼行數:25,代碼來源:train.py


注:本文中的Data.data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。