当前位置: 首页>>代码示例>>Python>>正文


Python Data.setas[-1]方法代码示例

本文整理汇总了Python中Stoner.Data.setas[-1]方法的典型用法代码示例。如果您正苦于以下问题:Python Data.setas[-1]方法的具体用法?Python Data.setas[-1]怎么用?Python Data.setas[-1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stoner.Data的用法示例。


在下文中一共展示了Data.setas[-1]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LoadData

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import setas[-1] [as 别名]
    def LoadData(self, data_item_number, filename):
        """LoadData(self, data_item_number, filename) --> none

        Loads the data from filename into the data_item_number.
        """
        try:
            datafile=Data(str(filename),debug=True) # does all the hard work here
        except Exception as e:
            ShowWarningDialog(self.parent, 'Could not load the file: ' +\
                    filename + ' \nPlease check the format.\n\n Stoner.Data'\
                    + ' gave the following error:\n'  +  str(e))
        else:
            # For the freak case of only one data point
            try:
                if datafile.setas.cols["axes"]==0:
                    self.x_col=datafile.find_col(self.x_col)
                    self.y_col=datafile.find_col(self.y_col)
                    self.e_col=datafile.find_col(self.e_col)
                    datafile.etsas(x=self.x_col,y=self.y_col,e=self.e_col)
                else:
                    self.x_col=datafile.setas.cols["xcol"]
                    self.y_col=datafile.setas.cols["ycol"][0]
                    if len(datafile.setas.cols["yerr"])>0:
                        self.e_col=datafile.setas.cols["yerr"][0]
                    else:
                        datafile.add_column(np.ones(len(datafile)))
                        datafile.setas[-1]="e"
            except Exception as e:
                ShowWarningDialog(self.parent, 'The data file does not contain'\
                        + 'all the columns specified in the opions\n'+e.message)
                # Okay now we have showed a dialog lets bail out ...
                return
            # The data is set by the default Template.__init__ function, neat hu
            # Know the loaded data goes into *_raw so that they are not
            # changed by the transforms
            datafile.y=np.where(datafile.y==0.0,1E-8,datafile.y)
            self.data[data_item_number].x_raw = datafile.x
            self.data[data_item_number].y_raw =  datafile.y
            self.data[data_item_number].error_raw =  datafile.e
            # Run the commands on the data - this also sets the x,y, error memebers
            # of that data item.
            self.data[data_item_number].run_command()

            # Send an update that new data has been loaded
            self.SendUpdateDataEvent()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:47,代码来源:stoner.py

示例2: enumerate

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import setas[-1] [as 别名]
    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")
        data.title="Ramp {}".format(data[iterator][0])
        row.extend([data["linear:intercept"],data["linear:intercept err"]])
    data.tight_layout()
    result+=np.array(row)

result.column_headers=["Ramp","Sample 4 R","dR","Sample 7 R","dR"]
result.setas="xyeye"
result.plot(fmt=["k.","r."])



开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:29,代码来源:Tc_Fit.py

示例3: gmean

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import setas[-1] [as 别名]
        resfldr += result  # Stash the results

    # Merge the two field signs into a single file, taking care of the error columns too
    result = resfldr[0].clone
    for c in [0, 2, 4, 6, 8, 9, 10]:
        result.data[:, c] = (resfldr[1][:, c] + resfldr[0][:, c]) / 2.0
    for c in [1, 3, 5, 7]:
        result.data[:, c] = gmean((resfldr[0][:, c], resfldr[1][:, c]), axis=0)

    # Doing the Kittel fit with an orthogonal distance regression as we have x errors not y errors
    p0 = [2, 200e3, 10e3]  # Some sensible guesses
    result.lmfit(
        Inverse_Kittel, p0=p0, result=True, header="Kittel Fit", output="report"
    )
    result.setas[-1] = "y"

    result.template.yformatter = TexEngFormatter
    result.template.xformatter = TexEngFormatter
    result.labels = None
    result.figure(figsize=(6, 8))
    result.subplot(211)
    result.plot(fmt=["r.", "b-"])
    result.annotate_fit(Inverse_Kittel, x=7e9, y=1e5, fontdict={"size": 8})
    result.ylabel = "$H_{res} \\mathrm{(Am^{-1})}$"
    result.title = "Inverse Kittel Fit"

    # Get alpha
    result.subplot(212)
    result.setas(y="Delta_H", e="Delta_H.stderr", x="Freq")
    result.y /= mu_0
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:plot-folder-test.py


注:本文中的Stoner.Data.setas[-1]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。