Esempio n. 1
0
File: make.py Progetto: rocdat/STLIB
def birthConstant(size):
    # dx/dt = 

    # n is the size.
    # p is the propensity factor.
    # t is the time.
    # n * 2^(p t) = 2^t
    # n = 2^(t (1 - p))
    # log_2 n = t (1 - p)
    # (1/t) log_2 n = (1 - p)
    # p = 1 - (1/t) log_2 n 
    #p = 1 - (1./15.) * math.log(size) / math.log(2)

    # n 2^t = 2^15
    # n = 2^(15 - t)
    # log_2 n = 15 - t
    # t = 15 - log_2 n

    file = open('Birth' + str(size) + 'Constant.txt', 'w')
    # Propensity factors sum to unity.
    file.write('%s' % Birth.output(size, 1, lambda n: 1))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('%f\n' % (15 - math.log(size) / math.log(2)))
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 2
0
File: make.py Progetto: rocdat/STLIB
def deathConstant(size, initialAmount):
    file = open('Death' + str(size) + 'Constant.txt', 'w')
    file.write('%s' % Death.output(size, initialAmount, lambda n: 1))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('1000\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 3
0
File: make.py Progetto: rocdat/STLIB
def decayingDimerizingConstant(size):
    file = open('DecayingDimerizing' + str(size) + '.txt', 'w')
    file.write('%s' % DecayingDimerizing.output(size))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('30\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 4
0
File: make.py Progetto: rocdat/STLIB
def immigrationConstant(size):
    file = open('Immigration' + str(size) + 'Constant.txt', 'w')
    file.write('%s' % Immigration.output(size, 0, 
                                         lambda n: 1. / size))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('1000000\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 5
0
File: make.py Progetto: rocdat/STLIB
def deathGeometric(size, initialAmount, factor):
    file = open('Death' + str(size) + 'Geometric' + str(factor) + '.txt', 'w')
    file.write('%s' % Death.output(size, initialAmount, 
                                   lambda n: factor**(float(n)/max(size-1,1))))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('1000\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 6
0
File: make.py Progetto: rocdat/STLIB
def immigrationGeometric(size, factor):
    file = open('Immigration' + str(size) + 'Geometric' + str(factor) +
                '.txt', 'w')
    sum = 0
    for n in range(size):
        sum += factor**(float(n)/max(size-1,1))
    file.write('%s' % Immigration.output(size, 0, 
                                         lambda n: factor**(float(n)/max(size-1,1)) / sum))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('1000000\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 7
0
File: make.py Progetto: rocdat/STLIB
def birthGeometric(size, factor):
    file = open('Birth' + str(size) + 'Geometric' + str(factor) + '.txt', 'w')
    # Propensity factors sum to unity.
    sum = 0
    for n in range(size):
        sum += factor**(float(n)/max(size-1,1))
    file.write('%s' % Birth.output(size, 1, 
                                   lambda n: factor**(float(n)/max(size-1,1)) / sum))
    # number of frames
    file.write('1\n')
    # list of frame times
    file.write('1000\n')
    # maximum allowed steps
    file.write('0\n')
    # list of MT 19937 state
    file.write('%s' % MT19937.output())
    # number of trajectories
    file.write('1\n')
Esempio n. 8
0
  numberOfBins = int(sys.argv[3])
  # The recorded species.
  recordedSpecies = [int(x) for x in sys.argv[4:-1]]
  # The number of trajectories.
  numberOfTrajectories = int(sys.argv[-1])

  # 
  # Write the input file.
  #

  # Number of frames
  print '1'
  # List of frame times
  print endTime
  # Maximum allowed steps
  print maximumAllowedSteps
  # Number of species to record.
  print len(recordedSpecies)
  # List of species to record.
  print ('%s ' * len(recordedSpecies)) % tuple(recordedSpecies)
  # Number of bins.
  print numberOfBins
  # Number of parameters.
  print '0'
  # Empty line for the parameters.
  print ''
  # List of MT 19937 state
  sys.stdout.write(MT19937.output())
  # Number of trajectories
  print numberOfTrajectories