示例#1
0
def myStar(scene, directions=sd.skyTurtle(), w=150, h=150, dfact=8, wr=False):
    tab = [{1: [sh.getId() for sh in scene]}]
    mss = ssFromDict('myTree', scene, tab, "Cvx Hull")
    star = mss.vgStar(pos=directions,
                      width=w,
                      height=h,
                      d_factor=dfact,
                      write=wr)
    return star
示例#2
0
def decomposedSTAR(scene,
                   directions=sd.skyTurtle(),
                   w=150,
                   h=150,
                   dfact=8,
                   wr=False):
    tab = [{1: [sh.getId() for sh in scene]}]
    mss = ssFromDict('myTree', scene, tab, "Cvx Hull")
    iPEA, TLA = mss.vgStar(pos=directions,
                           width=w,
                           height=h,
                           d_factor=dfact,
                           write=wr,
                           details=True)
    return iPEA / TLA, iPEA, TLA
示例#3
0
def vgStar(self, **kwds):
  """
  If the details option is set to true, it return a couple (integrated PEA, TLA)
  """
  start = time()
  width = kwds.get('width', 150)
  height = kwds.get('height', 150)
  d_factor = kwds.get('d_factor', 8)
  pth = kwds.get('pth', os.path.abspath(os.curdir))
  pos = kwds.get('pos', sd.skyTurtle() )
  write = kwds.get('write', True )
  details = kwds.get('details', False )
  root_id = self.get1Scale(1)[0]
  tla = self.totalLA(root_id)
  rstar = []
  soc = []
  for s,p in enumerate(pos):
    az = p[0]
    el = p[1]
    wg = p[2]
    dir = azel2vect(az, el)
    prepareScene(self.genScaleScene(self.depth), width, height, az, el, dist_factor=d_factor)
    sproj = pgl.Viewer.frameGL.getProjectionSize()[0]
    #real_star = sproj / tla
    real_star = sproj
    rstar.append(real_star)
    soc.append(wg)
    #writing result to file
    if write :
      row=[] #line to write in csv file
      row.append(s+1)
      row.append(az)
      row.append(el)
      row.append(wg)
      row.append(real_star)
      savedir = os.path.join(pth, self.name)
      if not os.path.isdir(savedir):
        os.mkdir(savedir)
      csv_file = self.name + "_vgstar.csv"
      file = os.path.join(savedir, csv_file)
      writer = csv.writer(open(file, 'ab'), dialect='excel')
      writer.writerow(row)
  stop = time()
  print "total computation time : ", stop-start, " s."
  if details:
    return ( (array(rstar) * array(soc)).sum(), tla )
  else:
    return (array(rstar) * array(soc)).sum() / tla
示例#4
0
def totalInterception(scene,
                      lat=43.36,
                      long=3.52,
                      jj=221,
                      start=7,
                      stop=19,
                      stp=30,
                      dsun=1,
                      dGMT=0):
    diffu = sd.skyTurtle()
    direct = sd.getDirectLight(latitude=lat,
                               longitude=long,
                               jourJul=jj,
                               startH=start,
                               stopH=stop,
                               step=stp,
                               decalSun=dsun,
                               decalGMT=dGMT)
    all = direct + diffu
    return directionalInterception(scene, directions=all)
示例#5
0
def diffuseInterception(scene):
    return directionalInterception(scene, directions=sd.skyTurtle())