本文整理汇总了Python中Stoner.Data.del_rows方法的典型用法代码示例。如果您正苦于以下问题:Python Data.del_rows方法的具体用法?Python Data.del_rows怎么用?Python Data.del_rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stoner.Data
的用法示例。
在下文中一共展示了Data.del_rows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import del_rows [as 别名]
# We then threshold for zero crossing of the derivative
# And check the second derivative to see whether we like the peak as signficant. This is the significance parameter
# and seems to be largely empirical
# Finally we interpolate back to the complete data set to make sure we get the angle as well as the counts.
d.lmfit(ExponentialModel,result=True,replace=False,header="Envelope")
d.subtract("Counts","Envelope",replace=False,header="peaks")
d.setas="xy"
sys.exit()
t=Data(d.interpolate(d.peaks(significance=sensitivity,width=8,poly=4)))
t.column_headers=copy(d.column_headers)
d%='peaks'
t%='peaks'
d.setas="xy"
d.labels[d.find_col('Angle')]=r"Reflection Angle $\theta$"
t.del_rows(0, lambda x,y: x<critical_edge)
t.setas="xy"
t.template.fig_width=7.0
t.template.fig_height=5.0
t.plot(fmt='go', plotter=pyplot.semilogy)
main_fig=d.plot(figure=t.fig, plotter=pyplot.semilogy)
d.show()
#Now convert the angle to sin^2
t.apply(lambda x: np.sin(np.radians(x[0]/2.0))**2, 0,header=r"$sin^2\theta$")
# Now create the m^2 order
m=np.arange(len(t))+fringe_offset
m=m**2
#And add it to t
t.add_column(m, column_header='$m^2$')
#Now we can it a straight line
t.setas="x..y"
示例2: enumerate
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import del_rows [as 别名]
iterator="iterator" #Temperature ramp iteration column label
threshold=0.85 #Fraction of transition to fit to
data=Data(filename) #Use FALSE to get a dialog box to the file containing Tc data
#Define my working x and y axes
#Split one file into a folder of two files by the iterator column
fldr=data.split(iterator)
result=Data()
for data in fldr: #For each iteration ramp in the Tc data
row=[data.mean(iterator)]
data.figure(figsize=(8,4))
for i,r_col in enumerate(r_cols):
data.setas(x=t_col,y=r_col)
data.del_rows(isnan(data.y))
#Normalise data on y axis between +/- 1
data.normalise(base=(-1.,1.), replace=True)
#Swap x and y axes around so that R is x and T is y
data=~data
#Curve fit a straight line, using only the central 90% of the resistance transition
data.curve_fit(linear,bounds=lambda x,r:-threshold<x<threshold,result=True,p0=[7.0,0.0]) #result=True to record fit into metadata
#Plot the results
data.setas[-1]="y"
data.subplot(1,len(r_cols),i+1)
data.plot(fmt=["k.","r-"])
data.annotate_fit(linear,x=-1.,y=7.3c,fontsize="small")