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


Python BriPy.verbosity方法代码示例

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


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

示例1: test_verbosity

# 需要导入模块: import BriPy [as 别名]
# 或者: from BriPy import verbosity [as 别名]
 def test_verbosity(self):
     old_verbosity = BriPy.verbosity()
     BriPy.verbosity(100)
     assert_equal(BriPy.verbosity(), 100)
     BriPy.verbosity(old_verbosity)
开发者ID:sylvainvayre,项目名称:bright,代码行数:7,代码来源:test_bright.py

示例2: print

# 需要导入模块: import BriPy [as 别名]
# 或者: from BriPy import verbosity [as 别名]
fc0 = BriPy.FCComp()
print("Empty Fuel Cycle Component")
printFCComp(fc0)
print("")

print(BriPy.isos2track())
BriPy.isos2track([922350, 942390, 10010])
print(BriPy.isos2track())


fc1 = BriPy.FCComp()
print("Isotope track with no name...")
printFCComp(fc1)
print("")

BriPy.verbosity(1)
print(BriPy.verbosity())

fc2 = BriPy.FCComp("Isotope track with name!")
printFCComp(fc2)
print("")

BriPy.verbosity(100)
print(BriPy.verbosity())

ptrack = ["My first Param", "Another Param"]
fc3 = BriPy.FCComp(ptrack)
print("Full track with no name...")
printFCComp(fc3)
print("")
开发者ID:sylvainvayre,项目名称:bright,代码行数:32,代码来源:FCCompTest.py

示例3: main

# 需要导入模块: import BriPy [as 别名]
# 或者: from BriPy import verbosity [as 别名]
def main():
    parser = OptionParser()
    parser.add_option("-c", "--case", dest="case", help="Benchmark case to run.")
    parser.add_option("-p", "--calibrate", action="store_true", dest="calibrate", default=False, help="Calibrate non-leakage probability.")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Prints extra information.")
    options, args = parser.parse_args()

    if options.case == "LWR_NEA":
        name = options.case
    elif options.case == "LWR_VIS51":
        name = options.case
    else:
        print "Case not valid, please pick from: LWR_NEA, or LWR_VIS51."
        raise SystemExit

    shutil.copy(name + "_fcparams.py", "fcparams.py")

    import BriPy
    import tables

    from fcparams import lwr_params
    from fcparams import Quiet

    #Various Variables
    snf_need = []
    if (not Quiet) or (options.verbose):
        BriPy.verbosity(100)


    #redefine isotrak
    trackfile = tables.openFile("../LWR.h5", 'r')
    itrack = trackfile.root.ToIso_zz.read()
    trackfile.close()
    BriPy.isos2track(itrack)

    if name == "LWR_NEA":
        #NEA
        U234 = BriPy.MassStream({922340: 1.0}, 0.00032, "U234")
        U235 = BriPy.MassStream({922350: 1.0}, 0.03600, "U235")
        U236 = BriPy.MassStream({922350: 1.0}, 0.00016, "U235")
        U238 = BriPy.MassStream({922380: 1.0}, 0.96352, "U238")
    elif name == "LWR_VIS51":
        #VISION
        U234 = BriPy.MassStream({922340: 1.0}, 3.439849E-04, "U234")
        U235 = BriPy.MassStream({922350: 1.0}, 4.299811E-02, "U235")
        U236 = BriPy.MassStream({922350: 1.0}, 0.000000E+00, "U235")
        U238 = BriPy.MassStream({922380: 1.0}, 9.566579E-01, "U238")
    else:
        print "Case not valid, please pick from: LWR_NEA, or LWR_VIS51."
        raise SystemExit

    #######################
    ### LWR Computation ###
    #######################

    #Fuel Cycle Components
    LWR = BriPy.LightWaterReactor1G("../LWR.h5", lwr_params, name)

    def LWR_delR_BU_(ms):
        "Calculates the delta Reaction Rates at the target burnup."
        LWR.IsosIn = ms
        LWR.foldMassWeights()
        dR = LWR.batchAve(lwr_params.BUt, "p") - LWR.batchAve(lwr_params.BUt, "d")
        return dR

    def Run_PNL(temp_pnl):
        LWR.P_NL = temp_pnl

        delR_U235 = LWR_delR_BU_(U235)
        delR_U238 = LWR_delR_BU_(U238)

        #Calculate delta R for the Guess
        LWR_CoreInput = U238 + U235 + U234 + U236
        LWR_CoreInput.name = "LWR_CoreInput"
        LWR_CoreInput.Normalize()
        LWR_delR_Guess = LWR_delR_BU_(LWR_CoreInput)

        k = LWR.batchAveK(lwr_params.BUt)
        n = 0
        if not Quiet:
            print str(1) + ")",  k, 

        while 0.001 < abs(1.0 - k) and n < 10:
            #Adjust Masses based on pertubation guess.
            LWR_DeltaM_U238 = - LWR_delR_Guess / (delR_U238 - delR_U235)
            U238.mass = U238.mass + LWR_DeltaM_U238
            U235.mass = U235.mass - LWR_DeltaM_U238

            #Recalculate core parameters for new masses guess
            LWR_CoreInput = U238 + U235 + U234 + U236
            LWR_CoreInput.name = "LWR_CoreInput"
            LWR_delR_Guess = LWR_delR_BU_(LWR_CoreInput)
            k = LWR.batchAveK(lwr_params.BUt)
            n = n+1
            if not Quiet:
                print k, 
        if not Quiet:
            print
            print

#.........这里部分代码省略.........
开发者ID:sylvainvayre,项目名称:bright,代码行数:103,代码来源:LWR_PNL.py

示例4: main

# 需要导入模块: import BriPy [as 别名]
# 或者: from BriPy import verbosity [as 别名]
def main():
    parser = OptionParser()
    parser.add_option("-c", "--case", dest="case", help="Benchmark case to run.")
    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="Prints extra information.")
    options, args = parser.parse_args()

    if options.case == "FR_NEA":
        name = options.case
        bud_t = 27.3969072997
    elif options.case == "FR_VISp1":
        name = options.case
        bud_t = 176.6
    elif options.case == "FR_VISp5":
        name = options.case
        bud_t = 176.6
    else:
        print "Case not valid, please pick from: FR_NEA, FR_VISp1, or FR_VISp5."
        raise SystemExit

    shutil.copy(name + "_fcparams.py", "fcparams.py")

    import BriPy
    import tables

    from fcparams import fr_params
    from fcparams import Quiet

    #Various Variables
    snf_need = []
    if (not Quiet) or (options.verbose):
        BriPy.verbosity(100)

    #redefine isotrak
    trackfile = tables.openFile("../FR.h5", 'r')
    itrack = trackfile.root.ToIso_zz.read()
    trackfile.close()
    BriPy.isos2track(itrack)

    ######################
    ### FR Computation ###
    ######################
    InStream = BriPy.MassStream(name + '_Benchmark_In.txt', 1.0, "InStream")


    #Fuel Cycle Components
    FR = BriPy.FastReactor1G("../FR.h5", fr_params, name)

    def Run_PNL(temp_pnl):
        FR.P_NL = temp_pnl

        #Calculate output
        FR.IsosIn = InStream
        FR.foldMassWeights()
        FR.BUd_BisectionMethod()


    #Calibration proceeds by bisection method...
    pnl_a = 0.6
    Run_PNL(pnl_a)
    bud_a = FR.BUd
    sign_a = (bud_a - bud_t) / abs(bud_a - bud_t)

    pnl_b = 0.7
    Run_PNL(pnl_b)
    bud_b = FR.BUd
    sign_b = (bud_b - bud_t) / abs(bud_b - bud_t)

    DoA = 10.0**(-15)        #Degree of accuracy to carry out calculations to.
    q = 0
    while (DoA < abs(pnl_a - pnl_b)) and (DoA < abs(bud_a - bud_b)) and q < 100:
        pnl_c = (pnl_a + pnl_b) / 2.0
        Run_PNL(pnl_c)
        bud_c = FR.BUd
        sign_c = (bud_c - bud_t) / abs(bud_c - bud_t)

        q = q + 1

        if (sign_a == sign_c) and not (sign_b == sign_c):
            pnl_a = pnl_c 
            bud_a = bud_c
            sign_a = sign_c
        elif (sign_b == sign_c) and not (sign_a == sign_c):
            pnl_b = pnl_c 
            bud_b = bud_c
            sign_b = sign_c
        else:
            if not Quiet:
                print
                print "SOMEWHERE WHILE FINDING k SOMETHING WENT WRONG!!!"
                print "Here is some information that might help you debug ^_^"
                print "pnl_%(ltr)s = %(pnl)f\tBUd_%(ltr)s = %(bud)f\tsign_%(ltr)s = %(sign)f"%{'ltr': 'a', 'pnl': pnl_a, 'bud': bud_a, 'sign': sign_a}
                print "pnl_%(ltr)s = %(pnl)f\tBUd_%(ltr)s = %(bud)f\tsign_%(ltr)s = %(sign)f"%{'ltr': 'b', 'pnl': pnl_b, 'bud': bud_b, 'sign': sign_b}
                print "pnl_%(ltr)s = %(pnl)f\tBUd_%(ltr)s = %(bud)f\tsign_%(ltr)s = %(sign)f"%{'ltr': 'c', 'pnl': pnl_c, 'bud': bud_c, 'sign': sign_c}
                print

    if not Quiet:
        print
        print "Final Result of Burnup Bisection Method Calculation:"
        print "q = ", q
        print "pnl_%(ltr)s = %(pnl).16f\tBUd_%(ltr)s = %(bud)f\tsign_%(ltr)s = %(sign)f"%{'ltr': 'a', 'pnl': pnl_a, 'bud': bud_a, 'sign': sign_a}
#.........这里部分代码省略.........
开发者ID:sylvainvayre,项目名称:bright,代码行数:103,代码来源:FR_PNL.py


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