Пример #1
0
def samplingRMSDmixing(RMSDfile, numSamples = 100):
    import random
    RMSDs = libRMSD.readRMSDfromCSV(RMSDfile, WithRemovedLimit=10)
    if len(RMSDs.keys()) < numSamples:
        return (RMSDs)
    else:
        samplesList = random.sample(RMSDs.keys(), numSamples)
        # create the new samplesRMSD
        samplesRMSD = {}
        for key in samplesList:
            samplesRMSD[key] = RMSDs[key]
        return (samplesRMSD)
Пример #2
0
def samplingRMSDtoCluster(RMSDfile, numSamples = 100):
    import random
    RMSDs = libRMSD.readRMSDfromCSV(RMSDfile, WithRemovedLimit=10)
    samplesRMSD = {}
    totalSamplesPerCluster = int(numSamples / MAX_ANGSTROM)
    for value in range(MAX_ANGSTROM):
        filterRMSD = filterDict(RMSDs, minValue=value, maxValue=value+1)
        if len(filterRMSD.keys()) > totalSamplesPerCluster:
            samplesList = random.sample(filterRMSD.keys(), totalSamplesPerCluster)
            # create the new samplesRMSD
            randomRMSD = {}
            for key in samplesList:
                randomRMSD[key] = filterRMSD[key]
            filterRMSD = randomRMSD
        #print(filterRMSD)
        samplesRMSD.update(filterRMSD)
    return (samplesRMSD)