コード例 #1
0
def equ2cmp( job     =None , \
             InpDir  =None , CnsFile =None, \
             keys    =None , GridMode=None, \
             x1Range =None , x2Range =None, \
             OutDir  =None , \
             silent  =False, config  =None \
):
    # --- [1] 引数チェック --- #
    if (config is None): config = lcf.LoadConfig()
    if (job is None): job = config["equ_job"]
    if (GridMode is None): GridMode = config["equ_GridMode"]
    if (keys is None): keys = [config["equ_key"], "psi"]
    if (InpDir is None): InpDir = "../job/{0}/{1}/".format(job, GridMode)
    if (CnsFile is None):
        CnsFile = "../job/{0}/{1}/parameter.dat".format(job, GridMode)
    if (OutDir is None): OutDir = "../job/{0}/{1}/pdf/".format(job, GridMode)
    # --- [2] データ呼び出し --- #
    Dkeys = keys
    if (not ("psi" in keys)): Dkeys = keys + ["psi"]
    Data        = feq.FetchEQU( job    =job    , InpDir  =InpDir  , CnsFile=CnsFile, \
                                keys   =Dkeys  , GridMode=GridMode, \
                                x1Range=x1Range, x2Range =x2Range , \
                                silent =silent , config  =config )
    # --- [3] プロット --- #
    xAxis = +Data["xAxis"]
    yAxis = +Data["yAxis"]
    flux = +Data["psi"]
    for key in keys:
        cMap = Data[key]
        FigName = "{0}{1}_.png".format(OutDir, key)
        print("[equ2cmp] {0} is under processing...".format(FigName), end="")
        fig     = clm.cMap2D( xAxis  =yAxis  , yAxis =xAxis , cMap  =cMap  , Cntr=flux, \
                              FigName=FigName, config=config )
        print("\t [Done]")
コード例 #2
0
ファイル: equ2cmp.py プロジェクト: wfw-pgr/others
def equ2cmp( job    =None , InpDir =None , CnsFile=None, keys=None , GridMode=None, \
             x1Range=None , x2Range=None , OutDir =None, Flag__electronScale =True, \
             silent =False, config =None ):
    # -------------------------- #
    # --- [1] 引数チェック   --- #
    # -------------------------- #
    if (config is None): config = lcf.LoadConfig()
    if (job is None): job = config["equ_job"]
    if (GridMode is None): GridMode = config["equ_GridMode"]
    if (keys is None): keys = [config["equ_key"], "psi"]
    if (InpDir is None): InpDir = "../job/{0}/{1}/".format(job, GridMode)
    if (CnsFile is None):
        CnsFile = "../job/{0}/{1}/parameter.dat".format(job, GridMode)
    if (OutDir is None): OutDir = "../job/{0}/{1}/pdf/".format(job, GridMode)
    # -------------------------- #
    # --- [2] データ呼び出し --- #
    # -------------------------- #
    const = lcn.LoadConst(InpFile=CnsFile)
    Dkeys = keys
    if (not ("psi" in keys)): Dkeys = keys + ["psi"]
    Data  = feq.FetchEQU( job    =job    , InpDir  =InpDir  , CnsFile=CnsFile, \
                          keys   =Dkeys  , GridMode=GridMode, \
                          x1Range=x1Range, x2Range =x2Range , \
                          silent =silent , config  =config )
    # -------------------------- #
    # --- [3] プロット       --- #
    # -------------------------- #
    xAxis = Data["xAxis"]
    yAxis = Data["yAxis"]
    flux = Data["psi"]
    if (Flag__electronScale):
        xAxis = xAxis * const["wpewce"]
        yAxis = yAxis * const["wpewce"]
    cfs.configSettings(config=config, configType="cMap2D_def")
    for key in keys:
        FigName = "{0}{1}_.png".format(OutDir, key)
        clm.cMap2D( xAxis  =yAxis  , yAxis =xAxis , cMap=Data[key], Cntr=flux, \
                    FigName=FigName, config=config )
コード例 #3
0
ファイル: show__bfield.py プロジェクト: wfw-pgr/shimBField
def show__bfield(datFile=None, pngFile=None, config=None):
    # ------------------------------------------------- #
    # --- [1] Arguments                             --- #
    # ------------------------------------------------- #
    if (datFile is None): datFile = "dat/shimField.dat"
    if (pngFile is None): pngFile = "png/shimField.png"
    if (config is None): config = lcf.LoadConfig()

    # ------------------------------------------------- #
    # --- [2] Fetch Data                            --- #
    # ------------------------------------------------- #
    with open(datFile, "r") as f:
        Data = np.loadtxt(f)

    # ------------------------------------------------- #
    # --- [3] config Settings                       --- #
    # ------------------------------------------------- #
    cfs.configSettings(configType="cMap2D_def", config=config)
    config["xTitle"] = "$X$" + " [m]"
    config["yTitle"] = "$Y$" + " [m]"
    config["cmp_AutoLevel"] = True
    config["cmp_MaxMin"] = [0.0, +1.0]
    config["cmp_xAutoRange"] = True
    config["cmp_yAutoRange"] = True
    config["cmp_xRange"] = [-5.0, +5.0]
    config["cmp_yRange"] = [-5.0, +5.0]
    config["xMajor_Nticks"] = 5
    config["yMajor_Nticks"] = 5
    config["MinimalOut"] = False

    # ------------------------------------------------- #
    # --- [4] plot Figure                           --- #
    # ------------------------------------------------- #
    fig = cmt.cMapTri(xAxis=xAxis,
                      yAxis=yAxis,
                      cMap=cMap,
                      FigName=pngFile,
                      config=config)
    fig = cm2.cMap2D(xAxis=xAxis,
                     yAxis=yAxis,
                     cMap=cMap,
                     FigName=pngFile,
                     config=config)
コード例 #4
0
def equ2cmp( job     =None , InpDir  =None , CnsFile =None, keys    =None , GridMode=None, \
             x1Range =None , x2Range =None , OutDir  =None, Flag__electronScale=True, \
             silent  =False, config  =None ):
    # --- [1] 引数チェック --- #
    if (config is None): config = lcf.LoadConfig()
    if (job is None): job = config["equ_job"]
    if (GridMode is None): GridMode = config["equ_GridMode"]
    if (keys is None): keys = [config["equ_key"], "psi"]
    if (InpDir is None): InpDir = "../../job/{0}/{1}/".format(job, GridMode)
    if (CnsFile is None): CnsFile = "{0}parameter.dat".format(InpDir)
    if (OutDir is None): OutDir = "{0}pdf/".format(InpDir)
    # --- [2] データ呼び出し --- #
    const = lcn.LoadConst(InpFile=CnsFile)
    Dkeys = keys
    if (not ("psi" in keys)): Dkeys = keys + ["psi"]
    Data        = feq.FetchEQU( job    =job    , InpDir  =InpDir  , CnsFile=CnsFile, \
                                keys   =Dkeys  , GridMode=GridMode, \
                                x1Range=x1Range, x2Range =x2Range , \
                                silent =silent , config  =config )
    # --- [3] プロット --- #
    xAxis = +Data["xAxis"]
    yAxis = +Data["yAxis"]
    flux = +Data["psi"]
    if (Flag__electronScale):
        xAxis = xAxis * const["wpewce"]
        yAxis = yAxis * const["wpewce"]
    cfs.configSettings(config=config, configType="cMap2D_thesis")
    config["axes_x_NoLabel"] = True
    config["axes_y_NoLabel"] = True
    # --  Jy -- #
    key = "Jy"
    config["cnt_Color"] = "grey"
    config["cmp_ColorTable"] = "jet"
    config["cmp_AutoLevel"] = False
    config["cmp_MaxMin"] = [0, 0.2]
    FigName = "{0}{1}_.png".format(OutDir, key)
    print("[equ2cmp] {0:30} is under processing...".format(FigName), end="")
    clm.cMap2D( xAxis  =yAxis  , yAxis =xAxis , cMap=Data[key], Cntr=flux, \
                FigName=FigName, config=config )
    print("\t [Done]")
    # --  By -- #
    key = "By"
    config["cnt_Color"] = "grey"
    config["cmp_ColorTable"] = "bwr"
    config["cmp_AutoLevel"] = False
    config["cmp_MaxMin"] = [-5, 5]
    FigName = "{0}{1}_.png".format(OutDir, key)
    print("[equ2cmp] {0:30} is under processing...".format(FigName), end="")
    clm.cMap2D( xAxis  =yAxis  , yAxis =xAxis , cMap=Data[key], Cntr=flux, \
                FigName=FigName, config=config )
    print("\t [Done]")
    # -- psi -- #
    key = "psi"
    config["cnt_Color"] = "DeepSkyBlue"
    config["cmp_ColorTable"] = "hot"
    config["cmp_AutoLevel"] = False
    config["cmp_MaxMin"] = [-1.4, 1.0]
    FigName = "{0}{1}_.png".format(OutDir, key)
    print("[equ2cmp] {0:30} is under processing...".format(FigName), end="")
    clm.cMap2D( xAxis  =yAxis  , yAxis =xAxis , cMap=Data[key], Cntr=flux, \
                FigName=FigName, config=config )
    print("\t [Done]")
コード例 #5
0
        Data_  =     np.array( Data  , dtype=np.float64 )
        ret_   =     np.array( ret   , dtype=np.float64 )
        x1a_   =     np.array( x1Axis, dtype=np.float64 )
        x2a_   =     np.array( x2Axis, dtype=np.float64 )
        alpha_ =     np.array( alpha , dtype=np.float64 )
        LI_    = ctypes.byref( ctypes.c_int64( LI   )   )
        LJ_    = ctypes.byref( ctypes.c_int64( LJ   )   )

        # ---------------------------------------- #
        # --- [5]       関数呼出 / 返却        --- #
        # ---------------------------------------- #
        pyLIB.cyllinearfilter2d_( Data_, ret_, x1a_, x2a_, alpha_, LI_, LJ_ )
    else:
        print( " coordinate = {0} ??  ".format( coordinate ) )
    return( ret_ )


# ======================================== #
# ===             テスト用             === #
# ======================================== #
if ( __name__=='__main__' ):
    # ---- テスト用 プロファイル ---- #
    # -- 座標系 xg, yg -- #
    import myBasicAlgs.dist as dist
    Data = dist.dist( 21,21 )
    ret  = LinearFilter2D( Data=Data )
    import myStyle.cMap2D as clm
    clm.cMap2D( cMap=Data, FigName="Data.png" )
    clm.cMap2D( cMap=ret, FigName="ret.png" )
    print( Data.shape, ret.shape )