def TF_test_6(centerval, dvwid=1, cmap='summer_r'): tfOb = TFs.dv(data[datafld].ravel(), bounds=[-4, 4]) bnds = [centerval - dvwid / 2, centerval + dvwid / 2] TFseg = TFs.TFsegment(tfOb, bounds=bnds, cmap=cmap) dv = TFseg.dvbins_c # dv in this segment alpha = np.full(TFseg.dvbins_c.shape, 0.6) tfOb.addTFsegment(alpha, TFseg) return tfOb
def TF_test_4(): sn='TF_test_4' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) TFseg=TFs.TFsegment(tfOb,bounds=[-2,-.5],cmap='OrRd_r') alpha=np.full(TFseg.dvbins_c.shape,0.5) tfOb.addTFsegment(alpha,TFseg) TFseg2=TFs.TFsegment(tfOb,bounds=[.2,2],cmap='cool') alpha2=np.full(TFseg2.dvbins_c.shape,0.7) tfOb.addTFsegment(alpha2,TFseg2) return (tfOb,sn)
def TF_test_5(): sn='TF_test_5' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) TFseg=TFs.TFsegment(tfOb,bounds=[-2,-.5],cmap='OrRd_r') dv=TFseg.dvbins_c # dv in this segment dvcenter=dv.mean() alpha=erfc((dv-dvcenter)/.25)/2. * 0.5+.4 # transmission coefficient for this bin tfOb.addTFsegment(alpha,TFseg) TFseg2=TFs.TFsegment(tfOb,bounds=[.2,3],cmap='cool') dv=TFseg2.dvbins_c # dv in this segment dvcenter=dv.mean() alpha2=(1+erf((dv-dvcenter)/.5))/2*0.5+.4 tfOb.addTFsegment(alpha2,TFseg2) return (tfOb,sn)
def TF_test_7(): # alpha inverse to histogram density sn='TF_test_7' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) def alphaHist(histData,maxAlpha,alphaFac): if alphaFac>maxAlpha: alphaFac=maxAlpha return maxAlpha - alphaFac*histData/histData.max() bnds=[-2,-.2] TFseg=TFs.TFsegment(tfOb,bounds=bnds,cmap='OrRd') histData,_=tfOb.calcHist(bin_edges=TFseg.dvbins) tfOb.addTFsegment(alphaHist(histData,.8,0.3),TFseg) bnds=[.2,1.5] TFseg=TFs.TFsegment(tfOb,bounds=bnds,cmap='cool') histData,_=tfOb.calcHist(bin_edges=TFseg.dvbins) tfOb.addTFsegment(alphaHist(histData,.8,0.3),TFseg) return (tfOb,sn)
def TF_test_6(): sn='TF_test_6' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) dvwid=1 centerval=-1.2 bnds=[centerval-dvwid/2,centerval+dvwid/2] TFseg=TFs.TFsegment(tfOb,bounds=bnds,cmap='OrRd') dv=TFseg.dvbins_c # dv in this segment slope = -.4 / (TFseg.bounds[1]-TFseg.bounds[0]) alpha=.8 + (dv-dv[0]) * slope tfOb.addTFsegment(alpha,TFseg) bnds=[.1,.6] TFseg2=TFs.TFsegment(tfOb,bounds=bnds,cmap='cool') dv=TFseg2.dvbins_c # dv in this segment slope = (.4) / (TFseg2.bounds[1]-TFseg2.bounds[0]) alpha=.4 + (dv-dv[0]) * slope tfOb.addTFsegment(alpha,TFseg2) return (tfOb,sn)
def TF_test_3(): sn='TF_test_3' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-2,2]) alpha=np.full(tfOb.dvbins_c.shape,0.5) tfOb.addTFsegment(alpha) return (tfOb,sn)
def TF_test_2(): sn='TF_test_2' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-1,1]) alpha=.75*abs(erf(tfOb.dvbins_c/.3)) tfOb.addTFsegment(alpha) return (tfOb,sn)
def TF_test_1(): sn='TF_test_1' tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) tfOb.piecewiseLinear([-1.,-0.1,.05,.55],alpha_max=0.7,cmap='kelp_r') return (tfOb,sn)
sc=thisshp.addToScene(sc) clrs={ 'transform':[0.8,0.,0.8,0.05], 'ridge':[0.,0.,0.8,0.05], 'trench':[0.8,0.,0.,0.05], 'global_volcanos':[0.,0.8,0.,0.05] } for bound in ['transform','ridge','trench','global_volcanos']: tect=sp.shapedata(bound,radius=R*1000.,buildTraces=False) sc=tect.buildTraces(RGBa=clrs[bound],sc=sc,bbox=shp_bbox) # build and set the transfer function tfOb = TFs.dv(data[datafld].ravel(),bounds=[-4,4]) # segment 1, slow anomalies bnds=[-1.3,-.3] TFseg=TFs.TFsegment(tfOb,bounds=bnds,cmap='OrRd_r') alpha_o=0.95 Dalpha=-0.85 alpha=alpha_o + Dalpha/(bnds[1]-bnds[0]) * (TFseg.dvbins_c-bnds[0]) tfOb.addTFsegment(alpha,TFseg) # segment 2, fast anomalies bnds=[.1,.35] TFseg=TFs.TFsegment(tfOb,bounds=bnds,cmap='winter_r') alpha_o=.6 Dalpha=.4 alpha=alpha_o+ Dalpha/(bnds[1]-bnds[0]) * (TFseg.dvbins_c-bnds[0])