bnmr/bnqr泥浆文件读取器及非对称计算器

bdata的Python项目详细描述


b数据

测试数据包。bdata对象很大程度上是一个数据容器,用于读取MUD数据文件并提供用户友好的访问BNMR/BNQR data

设置

  • 使用pip安装:pip install bdata
  • 导出用于查找数据文件的环境变量(添加到.bashrc或类似文件) 设置环境变量bnmr_u archive和bnqr_u archive,以便 可以按照以下方案访问MSR文件:
    ${BNMR_ARCHIVE}/year/filename
       ${BNQR_ARCHIVE}/year/filename
    

对象映射

签名

bdata(run_number,year=None,filename='')

示例:

bd=bdata(40001)# read run 40001 from the current year. bd=bdata(40001,year=2017)# read run 40001 from year 2017.bd=bdata(0,filename='filename.msr')# read file from local memory, run number unused 

函数

SignatureDescription
^{}Calculate asymmetry. See below for docstring.
^{}Get beam implantation energy in keV
^{}Get beam pulse duration in s

其他功能

表示

表示已被很好地格式化,以便键入对象 name进入解释器会产生很好的输出。

操作员

bvar、bscaler和bhist对象允许算术或逻辑 要使用的运算符,其中操作中使用的值是 平均数、计数或数据数组。

示例:bd.ppg.bias15 + 1 相当于 bd.ppg.bias15.mean + 1

属性的特殊规则

如果在bdata中找不到属性,它将查找 bdict对象中的属性按顺序:camp、epics、ppg、hist。 这个二级属性搜索比常规的要慢得多 进入。

bdict对象都允许分配和获取字典键 好像它们是属性。注意,可以用p替换+, 以及-m以允许获取直方图。

示例:bd.ppg.beam_onbd.ppg['beam_on']bd.beam_on都有 完全相同的输出,最后一个比 其他人。

bdata.asym()文档字符串

usage: asym(option="",omit="",rebin=1,hist_select='')

Inputs:
    options:        see below for details
    omit:           1f bins to omit if space seperated string in options 
                        is not feasible. See options description below.
    rebin:          SLR only. Weighted average over 'rebin' bins to 
                        reduce array length by a factor of rebin. 
    hist_select:    string to specify which histograms get combined into 
                        making the asymmetry calculation. Deliminate 
                        with [,] or [;]. Histogram names cannot 
                        therefore contain either of these characters.

Asymmetry calculation outline (with default detectors) ---------------

    Split helicity      (NMR): (F-B)/(F+B) for each
    Combined helicity   (NMR): (r-1)/(r+1)
        where r = sqrt([(B+)(F-)]/[(F+)(B-)])

    Split helicity      (NQR): (R-L)/(R+L) for each
    Combined helicity   (NQR): (r-1)/(r+1)
        where r = sqrt([(L+)(R-)]/[(R+)(L-)])

    Alpha diffusion     (NQR) sum(AL0)/sum(L+R)
    Alpha tagged        (NQR) same as NQR, but using the tagged counters

Histogram Selection ---------------------------------------------------

    If we wished to do a simple asymmetry calculation in the form of 

                            (F-B)/(F+B)

    for each helicity, then 
                               |--|  |--|   paired counter location
                hist_select = 'F+,F-,B+,B-'
                                |-----|       paired helicities
                                   |-----|

    for alpha diffusion calculations append the two alpha counters

        hist_select = 'R+,R-,L+,L-,A+,A-

    for alpha tagged calculations do the following

        hist_select = 'R+,R-,L+,L-,TR+,TR-,TL+,TL-,nTR+,nTR-,nTL+,nTL-'

        where TR is the right counter tagged (coincident) with alphas, 
              TL is the left  counter tagged with alphas, 
             nTR is the right counter tagged with !alphas (absence of), 
             nLR is the right counter tagged with !alphas, 


Status of Data Corrections --------------------------------------------
    SLR/2H: 
        Removes prebeam bins. 

        Rebinning: 
            returned time is average time over rebin range
            returned asym is weighted mean

    1F: 
        Allows manual removal of unwanted bins. 

        Scan Combination:
            Multiscans are considered as a single scan with long 
            integration time. Histogram bins are summed according to 
            their frequency bin, errors are Poisson.

    1N:
        Same as 1F. Uses the neutral beam monitor values to calculate 
        asymetries in the same manner as the NMR calculation. 

    2E: 
        Prebeam bin removal. 
        Postbeam bin removal. Assumes beamoff time is 0. 
        Splits saved 1D histograms into 2D.

        Asymmetry calculations: 
            raw: calculated through differences method (as described in 
                the asymmetry calculation outline)
            dif: let 0 be the index of the centermost scan in time. dif 
                asymmetries are then calculated via raw[i+1]-raw[i-1], 
                where "raw" is as calculated in the above line, for each 
                of the three types: +,-,combined 
            sl: take a weighted least squares fit to the two bins prior 
                and the two bins after the center bin (in time). For 
                each find the value of the asymmetry at the center time 
                position. Take the difference: post-prior

Return value depends on option provided:

    SLR DESCRIPTIONS --------------------------------------------------

    "":     dictionary of 2D numpy arrays keyed by 
                {"p","n","c","time_s"} for each helicity and combination 
                (val,err). Default return state for unrecognized options
    "h":    dictionary 2D numpy arrays keyed by {"p","n","time_s"} for 
                each helicity (val,err).
    "p":    2D np array of up helicity state [time_s,val,err].
    "n":    2D np array of down helicity state [time_s,val,err].
    "c":    2D np array of combined asymmetry [time_s,val,err].
    "ad":   2D np array of alpha diffusion ratio [time_s,val,err].
    "at":   dictionary of alpha tagged asymmetries key:[val,err]. 
            Keys:

                'time_s'               : 1D array of times in seconds   
                'p_wiA','n_wiA','c_wiA': coincident with alpha
                'p_noA','n_noA','c_noA': coincident with no alpha
                'p_noT','n_noT','c_noT': untagged

        where p,n,c refer to pos helicity, neg helicity, combined 
        helicity respectively. Only in 2h mode. 


    1F DESCRIPTIONS ---------------------------------------------------

        all options can include a space deliminated list of bins or 
        ranges of bins which will be omitted. ex: "raw 1 2 5-20 3"

    "":     dictionary of 2D numpy arrays keyed by {p,n,c,freq} for each 
                helicity and combination [val,err]. Default return state 
                for unrecognized options.
    "r":    Dictionary of 2D numpy arrays keyed by {p,n} for each 
                helicity (val,err), but listed by bin, not combined by 
                frequency. 
    "h":    get unshifted +/- helicity scan-combined asymmetries as a 
                dictionary {'p':(val,err),'n':(val,err),'freq'}
    "p":    get pos helicity states as tuple, combined by frequency 
                (freq,val,err)
    "n":    similar to p but for negative helicity states
    "c":    get combined helicity states as tuple (freq,val,err)


    2E DESCRIPTIONS ---------------------------------------------------

        Takes no options. Returns a dictionary with the keys: 

    'dif_p':    [val,err][frequency] of pos. helicity asymmetry 
    'dif_n':    [ve][f] of negative helicity asymmetry
    'dif_c':    [ve][f] of combined helicity asymmetry

    'raw_p':    [ve][f][time] raw asymmetries of each time bin. Pos hel. 
    'raw_n':    [ve][f][t] negative helicity.
    'raw_c':    [ve][f][t] combined helicity

    'freq':     [f] frequency values
    'time':     [t] time bin values

    'sl_p':     [ve][f] pos. hel. of asymmetry calcuated through slopes 
                    of pre and post middle time bin. Slope method only 
                    for >= 5 time bins, corresponds to >= 3 RF on delays
    'sl_n':     [ve][f] negative helicity.
    'sl_c':     [ve][f] combined helicity.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Spring 4升级后未加载java应用程序上下文   java Android 2.3.3 internet可以在我的Galaxy S上运行,但不能在我的Galaxy选项卡上运行?(许可?)   java通过不改变其原始位置对大小写字母进行排序   java Spring Boot一直在破坏我的电脑。。。sts的最佳配置是什么。Windows 10上的ini文件?   css Java Spring+引导问题   java Jackson将GeoJsonPoint序列化为纬度/经度   xml Java Transformer:如何将其结果生成OutputStream?   java如何更改字体、文本大小和设置文本位置?   在JavaSpringHibernate3.6.3中,如何告诉一个方法等待,直到获得锁,以及如何重试失败的事务?   java安卓服务代替线程   Java Swing使用鼠标移动JFrame