本文整理汇总了Python中Stoner.Data.labels方法的典型用法代码示例。如果您正苦于以下问题:Python Data.labels方法的具体用法?Python Data.labels怎么用?Python Data.labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stoner.Data
的用法示例。
在下文中一共展示了Data.labels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exp
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import labels [as 别名]
y = 2 + 4 * exp(-x / 1.7) + random.normal(scale=0.2, size=101)
d = Data(x, y, column_headers=["Time", "Signal"], setas="xy")
d.plot(fmt="ro") # plot our data
func = lambda x, A, B, C: A + B * exp(-x / C)
# Do the fitting and plot the result
fit = d.differential_evolution(
func, result=True, header="Fit", A=1, B=1, C=1, prefix="Model", residuals=True
)
# Reset labels
d.labels = []
# Make nice two panel plot layout
ax = d.subplot2grid((3, 1), (2, 0))
d.setas = "x..y"
d.plot(fmt="g+")
d.title = ""
ax = d.subplot2grid((3, 1), (0, 0), rowspan=2)
d.setas = "xyy"
d.plot(fmt=["r.", "b-"])
d.xticklabels = [[]]
d.xlabel = ""
# Annotate plot with fitting parameters
d.annotate_fit(func, prefix="Model", x=0.7, y=0.3, fontdict={"size": "x-small"})
示例2: Data
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import labels [as 别名]
return res, res.column_headers
###############################################################################################
#################### Important - if using multiprocessing on Windows, this block must be ######
#################### Inside a if __name__=="__main__": test. ###################################
###############################################################################################
if __name__ == "__main__":
# Load data
d = Data(join(__home__, "..", "sample-data", "FMR-data.txt"))
# Rename columns and reset plot labels
d.rename("multi[1]:y", "Field").rename("multi[0]:y", "Frequency").rename(
"Absorption::X", "FMR"
)
d.labels = None
# Deine x and y columns and normalise to a big number
d.setas(x="Field", y="FMR")
d.normalise(base=(-1e6, 1e6))
fldr = d.split(field_sign, "Frequency")
# Split the data file into separate files by frequencies and sign of field
fldr = PlotFolder(fldr) # Convert to a PlotFolder
fldr.template = template # Set my custom plot template
for f in fldr[-1]: # Invert the negative field side
f.x = -f.x[::-1]
f.y = -f.y[::-1]
resfldr = PlotFolder() # Somewhere to keep the results from +ve and -ve fields