Exemplo n.º 1
0
def getPoint(maxL=10):
    RStarSample = random.uniform(0 , 2)
    fPlanets = random.uniform(-1 , 0)
    nEnvironment = random.uniform(-1 , 0)
    fInteligence = random.uniform(-3 , 0)
    fCivilization = random.uniform(-2 , 0)
    L = random.uniform(2 , maxL)
    
    fLife = lifeDist(vMin=-35, vMax=15, tMin=14, tMax=17, mean=0, sigma=200)
    fLifeEks = float(mp.log(fLife, 10))
    
    resitev = RStarSample + fPlanets + nEnvironment + fLifeEks + fInteligence + fCivilization + L
    '''
        # modification
    skip = 0
    mini = -RStarSample - L
    for it in (fPlanets, nEnvironment, fInteligence, fCivilization, fLifeEks):
        if it < np.log10(1/(10**-mini+2)):
            skip = 1
            break
        mini-=it
    # modification
    if skip:
        return getPoint()
    #return np.power(10,resitev)
    if(math.isinf(resitev)):
        return getPoint()
    '''   
    return resitev
Exemplo n.º 2
0
def sampleMultiple(parameters, minExp, maxExp, size, dist, life):
    val = mpf('1.0')
    for p in parameters:
        newVal = sampleU(p)
        val *= newVal
    if (life[0]):
        newVal = lifeDist(life[1], life[2], life[3], life[4], life[5], life[6])
        val *= newVal
    dist = logHistogramAdd(minExp, maxExp, size, dist, val)
    return dist
Exemplo n.º 3
0
def getNEksponentSample(N):
    RStarSample = random.uniform(0, 2)
    fPlanets = random.uniform(-1, 0)
    nEnvironment = random.uniform(-1, 0)
    fInteligence = random.uniform(-3, 0)
    fCivilization = random.uniform(-2, 0)
    L = random.uniform(2, 10)

    fLife = lifeDist(vMin=-35, vMax=15, tMin=14, tMax=17, mean=0, sigma=200)
    fLifeEks = float(mp.log(fLife, 10))
    ''' 
    if ( knownFI != 100):
        resitev= RStarSample + fPlanets + nEnvironment + fLifeEks + knownFI + fCivilization + L
    elif ( knownFC != 100):
        resitev= RStarSample + fPlanets + nEnvironment + fLifeEks + fInteligence + knownFC + L
    else:
        resitev = RStarSample + fPlanets + nEnvironment + fLifeEks + fInteligence + fCivilization + L
    '''
    '''
    # modification
    skip = 0
    mini = -RStarSample - L
    for it in (fPlanets, nEnvironment, fInteligence, fCivilization, fLifeEks):
        if it < mini:
            skip = 1
            break
        mini-=it
    # modification
    '''
    '''     
    skip = 0
    mini = -RStarSample - L
    for it in (fPlanets, nEnvironment, fInteligence, fCivilization, fLifeEks):
        if it < np.log10(1/(10**-mini+2)):
            skip = 1
            break
        mini-=it
        return (skip,resitev)
    '''

    resitev = random.choice(N) - (RStarSample + fPlanets + nEnvironment +
                                  fLifeEks + fInteligence + fCivilization)

    if (math.isinf(resitev)):
        return getNEksponentSample(N)

    return resitev
Exemplo n.º 4
0
def sampleL(parameters, minExp, maxExp, size, timeLimit, life, N):
    dist = [0] * size
    timeStart = time.time()
    while True:
        val = mpf('1.0')
        for p in parameters:
            newVal = sample(p)
            val *= newVal
        if (life[0]):
            val *= lifeDist(life[1], life[2], life[3], life[4], life[5],
                            life[6])
        val = 1 / val
        if (N[0]):
            val *= sampleByBisection(StandardizeDistribution(N[1][0], N[1][1]))
        dist = logHistogramAdd(minExp, maxExp, size, dist, val)
        if time.time() - timeStart > timeLimit:
            break
    return (scale(minExp, maxExp, size), dist)
Exemplo n.º 5
0
def getPoint(N):
    RStarSample = random.uniform(0, 2)
    fPlanets = random.uniform(-1, 0)
    nEnvironment = random.uniform(-1, 0)
    fInteligence = random.uniform(-3, 0)
    fCivilization = random.uniform(-2, 0)
    #L = random.uniform(2 , 10)

    fLife = lifeDist(vMin=-35, vMax=15, tMin=14, tMax=17, mean=0, sigma=200)
    fLifeEks = float(mp.log(fLife, 10))

    #resitev = random.choice(N)-(RStarSample + fPlanets + nEnvironment + fLifeEks + fInteligence + fCivilization)
    resitev = N - (RStarSample + fPlanets + nEnvironment + fLifeEks +
                   fInteligence + fCivilization)

    if (math.isinf(resitev)):
        return getPoint(N)

    return resitev
Exemplo n.º 6
0
startTime = time.time()

for i in range(0, noIterations):
    if i % 1000 == 0:
        totalTime = 300
        print((time.time() - startTime) / totalTime)
        if time.time() - startTime > totalTime:
            break
    nStars = random.uniform(
        11, 11.60205999132
    )  # current number of stars in our galaxy (log uniform distibution)

    fPlanets = random.uniform(-1, 0)
    nEnvironment = random.uniform(-1, 0)
    fLife = float(lifeDist(mean=0, sigma=50))
    fIntelligence = random.uniform(-3, 0)
    fContact = random.uniform(-2, 0)
    RStarSample = random.uniform(0, 2)
    L = random.uniform(2, 10)
    parameters = [
        nStars, fPlanets, nEnvironment, fLife, fIntelligence, fContact,
        RStarSample, L
    ]

    E3 = nStars + fPlanets + nEnvironment
    E4 = E3 + fLife
    E5 = E4 + fIntelligence
    E6 = E5 + fContact  #This is the result of Sandberg method, for adding new methods just this E-s are replaced

    E7 = RStarSample + fPlanets + nEnvironment + fLife + fIntelligence + fContact + L
Exemplo n.º 7
0
'''
Created on 10 Aug 2018

@author: benos
'''

import random
import numpy as np
from mpmath import mp,mpmathify
from mpLogspace import mpLogspace
from logHistogramAdd import logHistogramAdd
import matplotlib.pyplot as plt
from lifeDist import lifeDist



size = 300
times = 500
y = lifeDist(size,times)

start = mpmathify(10**(-220))
end = mpmathify(10**(10))

x = mpLogspace(start, end, size)

plt.plot(x, y)
plt.xscale("log")
#plt.xlim(start , end)
plt.show()