def main():

  nproc = 20

  sodium_d = [5889.950,5895.924]
  midtransit = 54341.056842
  period =  2.21857312
  planet_K = 154
  star_K = 0.20196
  line_centers = sodium_d

  index = arange(9,29)

  plotting = True
  
  #output = calc_profile(sort(index),midtransit,period,planet_K,star_K,line_centers,plotting=plotting,nproc=1)
  #quit()

  for x in range(0,10000):
#    index, index2 = sample_without_replacement(20,15)
    index, index2 = sample_with_replacement(20,20)
    index = index + 9
    output = calc_profile(index,midtransit,period,planet_K,star_K,line_centers,plotting=False,nproc=nproc)
    with open('bootstrap_ldfree.txt','a') as outfile:
      outwrite = ''
      for i in range(0,len(output)):
	outwrite += str(output[i])+' ' 
      outfile.write(outwrite+'\n')
def main():

    nproc = 20

    sodium_d = [5889.950, 5895.924]
    midtransit = 54341.056842
    period = 2.21857312
    planet_K = 154
    star_K = 0.20196
    line_centers = sodium_d

    index = arange(9, 29)

    plotting = True

    #output = calc_profile(sort(index),midtransit,period,planet_K,star_K,line_centers,plotting=plotting,nproc=1)
    #quit()

    for x in range(0, 10000):
        #    index, index2 = sample_without_replacement(20,15)
        index, index2 = sample_with_replacement(20, 20)
        index = index + 9
        output = calc_profile(index,
                              midtransit,
                              period,
                              planet_K,
                              star_K,
                              line_centers,
                              plotting=False,
                              nproc=nproc)
        with open('bootstrap_ldfree.txt', 'a') as outfile:
            outwrite = ''
            for i in range(0, len(output)):
                outwrite += str(output[i]) + ' '
            outfile.write(outwrite + '\n')
Example #3
0
def initialise_walker(x,nproc,bootstrap=False,best_fit=False):

  sodium_d = [5889.950,5895.924]
  midtransit = 54341.056842
  period =  2.21857312
  planet_K = 154
  star_K = 0.20196
  line_centers = sodium_d

  if bootstrap == True:
    index, index2 = sample_with_replacement(20,20)
    index = index + 9
    index = np.sort(index)
  else:
    index = np.arange(9,29)

  plotting = False

#  lp = lnprior(x)

  lp = 0.0

  if lp == -np.inf:
    print 'fail!'
    print x[0],x[1]
    print lp
    return lp  

  lnprob = calc_profile(x,index,midtransit,period,planet_K,star_K,line_centers,plotting=plotting,nproc=nproc,best_fit=best_fit)

  lnprob = lnprob + lp

  return lnprob
Example #4
0
def initialise_walker(x, nproc, bootstrap=False, best_fit=False):

    sodium_d = [5889.950, 5895.924]
    midtransit = 54341.056842
    period = 2.21857312
    planet_K = 154
    star_K = 0.20196
    line_centers = sodium_d

    if bootstrap == True:
        index, index2 = sample_with_replacement(20, 20)
        index = index + 9
        index = np.sort(index)
    else:
        index = np.arange(9, 29)

    plotting = False

    #  lp = lnprior(x)

    lp = 0.0

    if lp == -np.inf:
        print 'fail!'
        print x[0], x[1]
        print lp
        return lp

    lnprob = calc_profile(x,
                          index,
                          midtransit,
                          period,
                          planet_K,
                          star_K,
                          line_centers,
                          plotting=plotting,
                          nproc=nproc,
                          best_fit=best_fit)

    lnprob = lnprob + lp

    return lnprob