def plotSimul(axR2, flnPrefix, strF2B, strB2F, strB2B, strHrad, strBrad,
              strNtrials):
    lblB2B = latex_float(float(strB2B))
    sd = SimulData()
    sd.metadata(flnPrefix,
                strF2B,
                strB2F,
                strB2B,
                strHrad,
                strBrad,
                strNtrials,
                loadData=True)
    #sd.getData()
    estilo = lineStyDAT(sd)
    linea, = axR2.plot(sd.ttime, sd.DelR2, **estilo)
    popt, pcov, i_min, i_max = fitPowLawFromTo(sd.ttime,
                                               sd.DelR2,
                                               xmin=1e4,
                                               xmax=1e6,
                                               returnIndx=True)
    print popt[0], popt[1]
    #axR2.plot(sd.ttime, sd.DelR2[0]*sd.ttime, "--", color='r')
    XXX = sd.ttime[i_min:i_max]
    YYY = powLaw(XXX, popt[0], popt[1])
    #axR2.plot(XXX, YYY, ":", color='k')
    xpos = 10**(0.5 * (np.log10(XXX[0]) + np.log10(XXX[-1])))
    ypos = 10**(0.4 * (np.log10(YYY[0]) + np.log10(YYY[-1])))
    xpos = 1e4
    ypos = 2
    lblExponente = str(popt[0])
    #axR2.text(xpos, ypos, "$ \\sim t^{"+lblExponente+"} "+"$")

    #scaXX, scaYY  = ScaleFunction(sd)
    #linea, = axR2Sca.plot(scaXX, scaYY, **estilo)
    return True, linea, ""
def plotSimulData(axR2, flnPrefix, strF2B, strB2F, strB2B, strHrad, strBrad,
                  strNtrials):
    sd = SimulData()
    sd.metadata(flnPrefix,
                strF2B,
                strB2F,
                strB2B,
                strHrad,
                strBrad,
                strNtrials,
                loadData=True)

    i_min = 1
    ymax = 0.1 * sd.Hrad**2
    i_max = len(sd.DelR2[sd.DelR2 < ymax])
    #  print sd.Hrad, len(tmpo), tmpo, tmpo[:12], tmpo[11]
    popt, pcov = fitPowLaw(sd.ttime[i_min:i_max], sd.DelR2[i_min:i_max])
    print popt[0], popt[1]
    #  axR2.plot(sd.ttime, sd.DelR2[0]*sd.ttime, "--", color='r')
    #lblExponente = str(popt[0])
    lblExponente = "{:03.2f}".format(popt[0])
    estilo = lineStyDAT(sd)
    estilo["label"] = estilo["label"] + ", " + lblExponente
    linea, = axR2.plot(sd.ttime, sd.DelR2, **estilo)
    XXX = sd.ttime[i_min:i_max]
    YYY = powLaw(XXX, popt[0], popt[1])
    axR2.plot(XXX, YYY, ":", color='k')

    #scaXX, scaYY  = ScaleFunction(sd)
    #linea, = axR2Sca.plot(scaXX, scaYY, **estilo)
    return True, linea, ""
def plotSimul(axR2,flnPrefix, strF2B, strB2F, strB2B, strHrad, strBrad, strNtrials ):
  lblB2B = latex_float( float(strB2B) )
  sd = SimulData()
  sd.metadata(flnPrefix, strF2B, strB2F, strB2B, strHrad, strBrad, strNtrials, loadData=True )
  #sd.getData()
  estilo = lineStyDAT(sd)
  linea, = axR2.plot(sd.ttime, sd.DelR2, **estilo)
  axR2.plot(sd.ttime, sd.ttime, "--")
  axR2.plot(sd.ttime, 1.5*sd.ttime, "--")
  #scaXX, scaYY  = ScaleFunction(sd)
  #linea, = axR2Sca.plot(scaXX, scaYY, **estilo)
  return True, linea, ""
def plotSimul(axR2, axR2Sca, dirList, strF2B, strB2F, strB2B, strHrad, strBrad, strNtrials ):
  lblB2B = latex_float( float(strB2B) )
  flag = False
  idir = 0
  while idir < len(dirList):
    try:
      sd = SimulData()
      #print dirList[idir]
      flnPrefix02 = dirList[idir]+flnPrefix 
      sd.metadata(flnPrefix02, strF2B, strB2F, strB2B, strHrad, strBrad, strNtrials )
      sd.getData()
      estilo = lineStyDAT(sd)
#      titulo =  "$p_{FB} = "+lblF2B+", p_{BF} = "+lblB2F+", p_{BB} = "+lblB2B+", R_H = "+strHrad+"$"
#      if fit_params[strHrad]["lambFlag"]:
#        Figuras[hr], Conexions[hr] = sd.calcDwithLamb(fit_params[strHrad], colorcito, titulo)
#      else:
#        sd.calcDiffCoeff(fit_params[strHrad])
#      DiffCoeff[hr] = sd.DiffCoeff
#      D_err_mim[hr] = sd.D_err_min
#      D_err_max[hr] = sd.D_err_max
      axR2.plot(sd.ttime, sd.DelR2, **estilo)
      #axR2.plot(sd.ttime[sd.imin:sd.imax], line(sd.ttime[sd.imin:sd.imax], sd.popt[0], sd.popt[1]), '--', color='k' )
      
      scaXX, scaYY  = ScaleFunction(sd)
      #linea, = axR2Sca.plot(sd.pB2B*sd.ttime/sd.Hrad**2.0, sd.DelR2/(sd.pB2B*sd.ttime), **estilo)
      linea, = axR2Sca.plot(scaXX, scaYY, **estilo)
      flag = True
      return flag, linea, estilo['label']
      break;
    except IOError as e:
      flag = False
      #print e
      pass
    idir = idir + 1
  
  return False, None, None
colvals = np.abs(np.log(map(float, strB2BList))) + 3.0
colvals = (colvals / colvals.max())[::-1]
#print colvals

#ofile = open(outfln_DAT,"w")
#linea="#prob DiffCoeff\n"
#ofile.write(linea)

for b2b in range(len(strB2BList)):
    strB2B = strB2BList[b2b]
    sd = SimulData()
    try:
        sd.metadata(flnPrefix,
                    strF2B,
                    strB2F,
                    strB2B,
                    strHrad,
                    strBrad,
                    strNtrials,
                    loadData=False)
        if sd.isDatafile():
            sd.getData()
        else:
            sd.metadata(flnPrefix,
                        strF2B,
                        strB2F,
                        strB2B,
                        strHrad,
                        strBrad,
                        "1000",
                        loadData=True)
示例#6
0
  datay = np.loadtxt(dataFiley)
  dataz = np.loadtxt(dataFilez)
  
  freq = (datax[:,2]+datay[:,2]+dataz[:,2])/3.0
  posx = 0.5*(datax[:,0]+datax[:,1])
  axHis   .plot(posx, freq, **estilo ) # "-o", color=colorcito, label="$"+strHistoTime+"$")
  
  posxSca = posx/np.sqrt(histoTime)
  freqSca = freq*np.sqrt(histoTime)
  axHisSca.plot(posxSca, freqSca, **estilo ) #"-o", color=colorcito, label="$"+strHistoTime+"$")
  
########### INSET PLOT ############3
sd = SimulData()
#print dirList[idir]
flnPrefix02 = "./"+flnPrefix 
sd.metadata(flnPrefix02, strF2B, strB2F, strB2B, strHrad, strBrad, strNtrials )
sd.getData()
estilo = lineStyDAT(sd)
axR2.plot(sd.ttime, sd.DelR2, linestyle='-', color='k') #**estilo)  
axR2.plot(sd.ttime, sd.ttime, linestyle='--', color='r') #estilo['color'])  
DifCoeff = get_D_from_DB("RandomIniCond_02/", sd)

  
#popt, pcov = fitGaussian(posxSca, freqSca)
#print popt
#XX = np.linspace(-0.25,0.25, num=100)
#YY = gaussian(XX, popt[0], popt[1])


#axHisSca    .plot(XX, YY, '--', color='r', linewidth=2, alpha=0.5)
#axHisScaZoom.plot(XX, YY, '--', color='r', linewidth=2, alpha=0.5)
        'linewidth': anchoLinea,
        'label': etiqueta,
        'alpha': alfa
        #        'marker'          : marcador,
        #        'markersize'      : 9,
        #        'markeredgewidth' : 2,
        #        'markeredgecolor' : colorcito,
    }
    return estilo  #'solid'


sd = SimulData()
sd.metadata("RandomIniCond_02/" + flnPrefix,
            strF2B,
            strB2F,
            strB2B,
            strHrad,
            strBrad,
            strNtrials,
            loadData=True)

sdOld = SimulData()
sdOld.metadata("../rw3D_RegularPorousNEWRANDOM/" + flnPrefix,
               strF2B,
               strB2F,
               strB2B,
               strHrad,
               strBrad,
               strNtrials,
               loadData=True)

#sd.getData()