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


Python Data.y方法代码示例

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


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

示例1: LoadData

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import y [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: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import y [as 别名]
"""Example plot using experimental GBStyle"""
from Stoner import Data, __home__
from Stoner.plot.formats import GBPlotStyle
import os.path as path

filename = path.realpath(path.join(__home__, "..", "doc", "samples", "sample.txt"))
d = Data(filename, setas="xy", template=GBPlotStyle)
d.y = d.y - (max(d.y) / 2)
d.plot()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:11,代码来源:GBStyle.py

示例3: zip

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import y [as 别名]
        data, headers = zip(*result)
        new_data = data[0]
        for r in data[1:]:
            new_data = append(new_data, r, axis=0)
        result = Data(new_data)
        result.column_headers = headers[0]

        # Now plot all the fits

        subfldr.plots_per_page = 6  # Plot results
        subfldr.plot(figsize=(8, 8), extra=extra)

        # Work with the overall results
        result.setas(y="H_res", e="H_res.stderr", x="Freq")
        result.y = result.y / mu_0  # Convert to A/m
        result.e = result.e / mu_0

        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"
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:plot-folder-test.py


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