コード例 #1
0
def _im_actions__Ops_2_0():  # /im/im_action

    print("[%s:%d] _im_actions__Ops_2_0()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()

        ), file=sys.stderr)

    command = "C:\\WORKS_2\\Programs\\sakura\\sakura.exe"
    arg1 = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\3-1) add memo.txt"
    #     arg1 = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\\"3-1) add memo.txt\""
    #     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\\"3-1) add memo.txt\""
    #     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\'3-1) add memo.txt'"
    #     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\3-1) add memo.txt"
    #     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\test.bat"
    #     command = "'C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\test.bat'"
    #     command = "'C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\2-0) edit_memos.9-0.bat'"

    #     cmd_Full = [command]  #=>
    cmd_Full = [command, arg1]  #=>

    res = subprocess.call(cmd_Full)

    print("[%s:%d] result (subprocess) =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()

            ), file=sys.stderr)

    print(res)

    return None
コード例 #2
0
def _im_actions__Ops_11_1(action): # /im/im_action
    
    print("[%s:%d] _im_actions__Ops_11_1()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        
        ), file=sys.stderr)
    
    '''###################
        build : command string        
    ###################'''
    command = "%s\\%s" % (cons_im.FPath.DPATH_CMD_LIB_WS_CAKE_IFM11.value, action)

    print()
    print("[%s:%d] _im_actions__Ops_11_1()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        
        ), file=sys.stderr)
    
    cmd_Full = [command]  #=> 
#     cmd_Full = [command, arg1]  #=> 
    
    '''###################
        subprocess        
    ###################'''
    res = subprocess.call(cmd_Full)

    print("[%s:%d] result (subprocess) =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            
            ), file=sys.stderr)
    
    print(res)
    
    return None
コード例 #3
0
def task_1_ShowBase():

    strOf_FuncName = "task_1_ShowBase"

    '''###################
        step : 1
            opening, vars
    ###################'''
    print()
    
    print ("[%s:%d] starting : %s (time=%s)" % (
                os.path.basename(os.path.basename(libs.thisfile()))
                , libs.linenum()
                , strOf_FuncName
                , libs.get_TimeLabel_Now()
                )
    )
    
    '''###################
        step : 2
    ###################'''
#     class MyApp(ShowBase):
#     
#         def __init__(self):
#             ShowBase.__init__(self)
#             
#             # Load the environment model.
#             self.scene = self.loader.loadModel("models/environment")
#             # Reparent the model to render.
#             self.scene.reparentTo(self.render)
#             # Apply scale and position transforms on the model.
#             self.scene.setScale(0.25, 0.25, 0.25)
#             
#             #code:20210708_162726
# #             valOf_Pos_X, valOf_Pos_Y, valOf_Pos_Z     = -100, 42, 0
# #             valOf_Pos_X, valOf_Pos_Y, valOf_Pos_Z     = -400, 42, 0
# #             valOf_Pos_X, valOf_Pos_Y, valOf_Pos_Z     = -400, 420, 0
# #             valOf_Pos_X, valOf_Pos_Y, valOf_Pos_Z     = -400, 42, 100
#             valOf_Pos_X, valOf_Pos_Y, valOf_Pos_Z     = -800, 42, 0
# #             valOf_Pos_X     = -100
# # #             valOf_Pos_X     = -50
# #             valOf_Pos_Y     = 42
# #             valOf_Pos_Z     = 0
#             self.scene.setPos(valOf_Pos_Y, valOf_Pos_Y, valOf_Pos_Z)
# #             self.scene.setPos(-8, 42, 0)
    
    '''###################
        step : 3
    ###################'''
    app = MyApp()

    print()
    
    print ("[%s:%d] 'MyApp' ==> instantiated" % (
                os.path.basename(os.path.basename(libs.thisfile()))
                , libs.linenum()
                )
    )

    app.run()
コード例 #4
0
def test_2_Calc():

    #ref http://docs.sympy.org/latest/tutorial/matrices.html
    init_printing(use_unicode=True)
    '''###################
        vars        
    ###################'''
    var("a:z")
    '''###################
        ops        
    ###################'''
    #     x = 2
    #     y = 1

    a = Matrix([x, y])

    m = Matrix([[n + 1, -n], [n, -n + 1]])
    #     m = Matrix([[2,-1], [1,0]])

    #ref dot https://stackoverflow.com/questions/47839177/sympy-dot-product-results-in-a-list
    #     prod = a.dot(m) #=> Matrix size mismatch: (2, 1) * (2, 2).
    prod = m.dot(a)  #=> [2*x - y, x]
    #     prod = a * m

    print(prod)

    #ref expand https://stackoverflow.com/questions/34616170/how-to-expand-matrix-expression-in-sympy
    print(expand(prod[0]))
    print(expand(prod[1]))

    for i in range(5):

        prod = m.dot(prod)

        print()
        #         print ("[%s:%d] n = %d\nprod = %s\nprod[0] = '%s'" % \
        #                (os.path.basename(libs.thisfile()), libs.linenum()
        #                 , i + 2
        #                 , prod
        #                 , prod[0]
        #                 ))
        #         print ("[%s:%d] n = %d\nexpand(prod[0]) => %s\nexpand(prod[1]) => %s" % \
        print ("[%s:%d] m = %d\nexpand(prod[0]) => %s\nexpand(prod[1]) => %s" % \
               (os.path.basename(libs.thisfile()), libs.linenum()
                , i + 2
                , expand(prod[0])
                , expand(prod[1])

                ))

#     a = Matrix([1,2,3])
#
#     a
#     print(a)
    '''###################
        message        
    ###################'''
    print()
    print("[%s:%d] test_1 => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #5
0
def im_actions(request):  # /im/im_action
    '''###################
        get : params        
    ###################'''
    params = request.GET

    print("[%s:%d] params =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()

            ), file=sys.stderr)

    print(params)

    #ref get https://stackoverflow.com/questions/5895588/django-multivaluedictkeyerror-error-how-do-i-deal-with-it answered May 5 '11 at 9:47
    action = request.GET.get('action', False)
    #     action = request.GET['action']

    print("[%s:%d] action =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()

            ), file=sys.stderr)

    print(action)

    now = datetime.datetime.now()

    ### message
    #     message = ""

    if action == False:  #if action == False

        message = "no action param"

    else:  #if action == False

        message = "action is => %s" % (action)

        print()
        print("[%s:%d] %s" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
         , message
        ), file=sys.stderr)

        ### operations
        _im_actions__Ops(action)

    #/if action == False

    #debug
    print("[%s:%d] message => '%s'" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            , message
            ), file=sys.stderr)

    dic = {'action': action, "message": message}

    #     dic = {message : _message}

    return render(request, 'mm/im_actions.html', dic)
コード例 #6
0
ファイル: 1_1.py プロジェクト: iwabuchiken/WS_Others.JVEMV6
def test_13_Scale():

    strOf_FuncName = "test_13_Scale"


    '''###################
        step : 1
            opening, vars
    ###################'''
    print()
    
    print ("[%s:%d] starting : %s (time=%s)" % (
                os.path.basename(os.path.basename(libs.thisfile()))
                , libs.linenum()
                , strOf_FuncName
                , libs.get_TimeLabel_Now()
                )
    )
    
    '''###################
        step : 1.1
            load : data
    ###################'''
    '''###################
        step : 2
            prep
    ###################'''
    #ref https://www.w3schools.com/python/python_ml_multiple_regression.asp
    df = pandas.read_csv("cars2.csv")
    
    X = df[['Weight', 'Volume']]
    
    scale = StandardScaler()
    
    '''###################
        step : 3
            scale
    ###################'''
    scaledX = scale.fit_transform(X)

    '''###################
        step : 4
            report
    ###################'''
    #debug
    # message
    print ("[%s:%d] scaledX ==>" 
           % 
            (
             os.path.basename(libs.thisfile())
             , libs.linenum()
             )
             
             
           )
     
    print(scaledX)
コード例 #7
0
def build_History(tree):
    '''###################
        root        
    ###################'''
    root = tree.getroot()
    '''###################
        nodes : g-1        
    ###################'''
    g1 = root[0]

    ### add number
    #     num_Str = ""
    #     num_Str = "0"

    lo_Histories = build_History__Exec(g1)

    print()
    print("[%s:%d] len(lo_Histories) => %d" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        , len(lo_Histories)
        ), file=sys.stderr)
    print()

    #     print(lo_Histories)
    for item in lo_Histories:

        print(item.tag + " / " \
              + item.attrib['TEXT'] \
              + " / " + item.attrib['MODIFIED'] \
              + " / len = " + str(len(item)))
#         print(item.tag + " / " + item.attrib['TEXT'])

#/for item in lo_Histories :
    '''###################
        append : history        
    ###################'''
    ### remove subnodes

    print()
    print("[%s:%d] showing '%s' (TEXT = '%s' / len = %d) :" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            , lo_Histories[1].tag
            , lo_Histories[1].attrib['TEXT']
            , len(lo_Histories[1])
            ), file=sys.stderr)
    '''###################
        build : HISTORY branch        
    ###################'''
    build_HISTORY_Branch(g1, lo_Histories)
    '''###################
        return        
    ###################'''
    return tree
コード例 #8
0
def test_1():

    strOf_FuncName = "test_1"
    '''###################
        step : 1
            opening, vars
    ###################'''
    print()

    print("[%s:%d] starting : %s (time=%s)" %
          (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum(),
           strOf_FuncName, libs.get_TimeLabel_Now()))
    '''###################
        step : 2
            build : string
    ###################'''
    strOf_Coordinates = "(a_i^%d)*(a_j^%d)"
    #     strOf_Coordinates   = "(a_i^k)*(a_i^l)"
    #     strOf_Coordinates   = "a_i^k*a_i^l"
    strOf_Formula = ""
    #     strOf_Formula       = strOf_Coordinates

    # wedge
    #ref https://wiki.python.org/moin/ForLoop
    for x in range(1, 4):

        for y in range(1, 4):

            #ref https://stackoverflow.com/questions/5309978/sprintf-like-functionality-in-python
            strOf_Formula += strOf_Coordinates % (x, y)

            strOf_Formula += "("
            strOf_Formula += "e->_%d∧e->_%d" % (x, y)
            #             strOf_Formula += "e->_%d" % (x)
            strOf_Formula += ")"

            strOf_Formula += "+"

    #/for x in range(1, 4):

    print()

    print(
        "[%s:%d] strOf_Formula ==> " %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))

    print(strOf_Formula)
    print()
    '''###################
コード例 #9
0
def tsp(_aryOf_Numbers, _pointOf_Tsp):
    '''###################
        step : 1
            validate
    ###################'''
    #code:20210728_132355
    if _pointOf_Tsp < 1:  #if _pointOf_Tsp < 1

        print("[%s:%d] ****** ERROR *****" % (os.path.basename(
            os.path.basename(libs.thisfile())), libs.linenum()))

        print("[%s:%d] _pointOf_Tsp < 1 : %d" % (os.path.basename(
            os.path.basename(libs.thisfile())), libs.linenum(), _pointOf_Tsp))

        print()

        return _aryOf_Numbers

    #/if _pointOf_Tsp < 1
    '''###################
        step : 2
            tsp
    ###################'''
    '''###################
        step : 2 : 1
            show : elements
    ###################'''
    element_1 = _aryOf_Numbers[_pointOf_Tsp - 1]
    element_2 = _aryOf_Numbers[_pointOf_Tsp]

    print("[%s:%d] element_1 = %d, element_2 = %d" %
          (os.path.basename(os.path.basename(
              libs.thisfile())), libs.linenum(), element_1, element_2))

    print()
    '''###################
        step : 2 : 2
            tsp
    ###################'''
    _aryOf_Numbers[_pointOf_Tsp - 1] = element_2
    _aryOf_Numbers[_pointOf_Tsp] = element_1
    '''###################
        step : 3
            return
    ###################'''
    valOf_Ret = _aryOf_Numbers

    return valOf_Ret
コード例 #10
0
def importdata():

    #code:20210505_162927
    fpath_CSV = "C:\\WORKS_2\\WS\\WS_Others.JVEMV6\\JVEMV6\\73_ai\\1_start\\data\\s-19\\balance-scale.data"

    print("[%s:%d] loading csv file... : %s" % (os.path.basename(
        os.path.basename(libs.thisfile())), libs.linenum(), fpath_CSV))

    print()

    #ref https://datascienceparichay.com/article/read-csv-files-using-pandas-with-examples/
    balance_data = pd.read_csv(fpath_CSV)
    #     balance_data = pd.read_csv(
    # 'https://archive.ics.uci.edu/ml/machine-learning-'+
    # 'databases/balance-scale/balance-scale.data',
    #     sep= ',', header = None)

    # Printing the dataswet shape
    print("Dataset Length: ", len(balance_data))
    print("Dataset Shape: ", balance_data.shape)
    # (625, 5)
    # Printing the dataset obseravtions
    #ref https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.head.html
    #     print ("Dataset (first 3 rows): \n",balance_data.head(3))
    #     0  1  2  3  4
    # 0  B  1  1  1  1
    # 1  R  1  1  1  2
    # 2  R  1  1  1  3
    print("Dataset: ", balance_data.head())
    return balance_data
コード例 #11
0
def _exec_Numbering(dpath, fname):

    fpath = os.path.join(dpath, fname)

    tree = ET.parse(fpath)

    tree = libmt.add_Numbering__Through(tree)
    '''###################
        save xml        
    ###################'''
    label = "add-numbering-through"

    fpath_Out = os.path.join(
        dpath, fname
        #             fname + "." + libs.get_TimeLabel_Now() \
        #             + "." \
        #             + "mm"
    )
    #     fpath_Out = "new.%s.%s.mm" % (label, libs.get_TimeLabel_Now())

    tree.write(fpath_Out)

    print()
    print ("[%s:%d] mm => written : %s" % \
           (os.path.basename(libs.thisfile()), libs.linenum(), fpath_Out))

    return None
コード例 #12
0
def splitdataset(balance_data):

    #debug:20210502_170801
    print(
        "[%s:%d] balance_data.dtypes ==>" %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))
    #ref https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.values.html
    print(balance_data.dtypes)
    # 0    object
    # 1     int64
    # 2     int64
    # 3     int64
    # 4     int64

    print()

    # Separating the target variable
    X = balance_data.values[:, 1:
                            5]  #=> choose : all rows, columns of 1 thru 4 (index-wise, 5th not in)
    Y = balance_data.values[:, 0]

    # Splitting the dataset into train and test
    X_train, X_test, y_train, y_test = train_test_split(X,
                                                        Y,
                                                        test_size=0.3,
                                                        random_state=100)

    return X, Y, X_train, X_test, y_train, y_test
コード例 #13
0
def exec_Prog():

    #ref http://deeplearning.net/tutorial/gettingstarted.html
    # Load the dataset
    fname_In = "../data/mnist.pkl.gz"
    f = gzip.open(fname_In, 'rb')
    #     f = gzip.open('mnist.pkl.gz', 'rb')

    #ref https://stackoverflow.com/questions/42940851/unicodedecodeerror-ascii-codec-cant-decode-byte-0x8b "answered Mar 22 '17 at 0:58"
    train_set, valid_set, test_set = cPickle.load(f, encoding='latin1')

    #     train_set, valid_set, test_set = cPickle.load(f, encoding='utf-8')
    # UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 614: invali
    # d start byte
    #     train_set, valid_set, test_set = cPickle.load(f, encoding='utf-8')
    #     train_set, valid_set, test_set = cPickle.load(f)

    #d.4,#2
    test_set_x, test_set_y = shared_dataset(test_set)
    valid_set_x, valid_set_y = shared_dataset(valid_set)
    train_set_x, train_set_y = shared_dataset(train_set)

    batch_size = 500  # size of the minibatch

    # accessing the third minibatch of the training set

    data = train_set_x[2 * batch_size:3 * batch_size]
    label = train_set_y[2 * batch_size:3 * batch_size]

    f.close()

    print("[%s:%d] exec_Prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #14
0
ファイル: 1_1.py プロジェクト: iwabuchiken/WS_Others.JVEMV6
def exec_prog(): # from : 
    
    
    '''###################
        execute
    ###################'''
    #n:20210413_142903
    #n:20210412_151638
    #n:20210411_172354
    #n:20210415_174210
    #n:20210414_160053
    #n:20210416_153541
    #n:20210418_133238
    test_16_Tree()
#     test_15_Train_Test()
#     test_14_Scale_Predict()
#     test_13_Scale()
#     test_12_Coefficient()
#     test_11_Regresson_Multiple()
#     test_10_Predict()
#     test_9_R_Square()
#     test_8_Regression_Poly()
#     test_7_Linear_Regression()
#     test_6_plot_Scatter()
#     test_5_stats_Normal_Distribution()
#     test_4_stats_Distribution()
#     test_3_stats_Percentile()
#     test_2_statistics_StdDev()
#     test_1_statistics()
    
    '''###################
        Report        
    ###################'''
    print ("[%s:%d] exec_prog => done" % (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #15
0
ファイル: 1_1.py プロジェクト: iwabuchiken/WS_Others.JVEMV6
def test_1_statistics():

    strOf_FuncName = "test_1_statistics"

    print()
    
    print ("[%s:%d] starting : %s" % (
                os.path.basename(os.path.basename(libs.thisfile()))
                , libs.linenum()
                , strOf_FuncName
                )
    )
    
#     from scipy import stats
    
    speed = [99,86,87,88,111,86,103,87,94,78,77,85,86]
    
    x_mode  = stats.mode(speed)
    x_median  = numpy.median(speed)
    x_mean  = numpy.mean(speed)
    
    print()
    print("speed : ", speed)
    print()
    
    print(x_mode)
    print("x_median : ", x_median)
    print("x_mean : ", x_mean)
コード例 #16
0
ファイル: s_4.py プロジェクト: iwabuchiken/WS_Others.JVEMV6
def task_1_Bullet_Hello_World():

    strOf_FuncName = "task_1_Bullet_Hello_World"

    '''###################
        step : 1
            opening, vars
    ###################'''
    print()
    
    print ("[%s:%d] starting : %s (time=%s)" % (
                os.path.basename(os.path.basename(libs.thisfile()))
                , libs.linenum()
                , strOf_FuncName
                , libs.get_TimeLabel_Now()
                )
    )
    
    '''###################
        step : 2
    ###################'''
    base.cam.setPos(0, -10, 0)
    base.cam.lookAt(0, 0, 0)
    
    # World
    world = BulletWorld()
    world.setGravity(Vec3(0, 0, -9.81))
    
    # Plane
    shape = BulletPlaneShape(Vec3(0, 0, 1), 1)
    node = BulletRigidBodyNode('Ground')
    node.addShape(shape)
    np = render.attachNewNode(node)
    np.setPos(0, 0, -2)
    world.attachRigidBody(node)
    
    # Box
    shape = BulletBoxShape(Vec3(0.5, 0.5, 0.5))
    node = BulletRigidBodyNode('Box')
    node.setMass(1.0)
    node.addShape(shape)
    np = render.attachNewNode(node)
    np.setPos(0, 0, 2)
    world.attachRigidBody(node)
    model = loader.loadModel('models/box.egg')
    model.flattenLight()
    model.reparentTo(np)
    
    # Update
    def update(task):
        dt = globalClock.getDt()
        world.doPhysics(dt)
        return task.cont
    
    taskMgr.add(update, 'update')
    base.run()
    
    '''###################
コード例 #17
0
def _im_actions__Ops_2_0(action): # /im/im_action
    
    print("[%s:%d] _im_actions__Ops_2_0()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        
        ), file=sys.stderr)
    
    '''###################
        build : command string        
    ###################'''
    command = "%s\\%s" % (cons_im.FPath.DPATH_CMD_LIB_WS_CAKE_IFM11.value, action)
#     command = "C:\\WORKS_2\\Programs\\sakura\\sakura.exe"
#     arg1 = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\3-1) add memo.txt"
#     command = "C:\\WORKS_2\\Programs\\sakura\\sakura.exe"
#     arg1 = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\3-1) add memo.txt"
#     arg1 = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\\"3-1) add memo.txt\""
#     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\\"3-1) add memo.txt\""
#     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\'3-1) add memo.txt'"
#     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\3-1) add memo.txt"
#     command = "C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\test.bat"
#     command = "'C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\test.bat'"
#     command = "'C:\\WORKS_2\\WS\\WS_Cake_IFM11\\commands\\2-0) edit_memos.9-0.bat'"

    print()
    print("[%s:%d] _im_actions__Ops_2_0()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        
        ), file=sys.stderr)
    
    cmd_Full = [command]  #=> 
#     cmd_Full = [command, arg1]  #=> 
    
    '''###################
        subprocess        
    ###################'''
    res = subprocess.call(cmd_Full)

    print("[%s:%d] result (subprocess) =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            
            ), file=sys.stderr)
    
    print(res)
    
    return None
コード例 #18
0
def exec_prog():  # from : 20180116_103908

    ### tests
    test_1()
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #19
0
ファイル: s_143.py プロジェクト: iwabuchiken/WS_Others.JVEMV6
def exec_prog():  # from :
    '''###################
        execute
    ###################'''
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #20
0
def test_1_Init():

    #ref http://docs.sympy.org/latest/tutorial/matrices.html
    init_printing(use_unicode=True)
    '''###################
        vars        
    ###################'''
    var("a:z")
    '''###################
        ops        
    ###################'''
    a = Matrix([x, y])

    m = Matrix([[2, -1], [1, 0]])

    #ref dot https://stackoverflow.com/questions/47839177/sympy-dot-product-results-in-a-list
    #     prod = a.dot(m) #=> Matrix size mismatch: (2, 1) * (2, 2).
    prod = m.dot(a)  #=> [2*x - y, x]
    #     prod = a * m

    print(prod)

    for i in range(5):

        prod = m.dot(prod)

        print()
        print ("[%s:%d] n = %d\nprod = %s\nprod[0] = '%s'" % \
               (os.path.basename(libs.thisfile()), libs.linenum()
                , i + 2
                , prod
                , prod[0]
                ))

#     a = Matrix([1,2,3])
#
#     a
#     print(a)
    '''###################
        message        
    ###################'''
    print()
    print("[%s:%d] test_1 => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #21
0
def test_1():

    strOf_FuncName = "test_1"
    '''###################
        step : 1
            opening, vars
    ###################'''
    print()

    print("[%s:%d] starting : %s (time=%s)" %
          (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum(),
           strOf_FuncName, libs.get_TimeLabel_Now()))

    # path var
    print(
        "[%s:%d] PATH variable : " %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))

    print(sys.path)
    '''###################
        step : 2
            sys.argv
    ###################'''
    print()

    print(
        "[%s:%d] sys.argv ==>" %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))

    print(sys.argv)
    '''###################
        step : 2 : 1
            arg : 2nd arg
    ###################'''
    arg_2 = sys.argv[1]

    print()

    print(
        "[%s:%d] sys.argv[1] ==>" %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))

    print(arg_2)
    print("type(arg_2) => ", type(arg_2))
コード例 #22
0
def test_1():
    '''###################
        ops        
    ###################'''
    #ref https://nknon.blogspot.jp/2008/02/blog-post_12.html
    F = np.array([[1, 1], [2, 1], [3, 1], [4, 1], [5, 1]])
    y = np.array([[8.1], [2.5], [2.1], [3.4], [9.8]])

    tF = np.transpose(F)
    tFF = np.dot(tF, F)
    tFF_inv = la.inv(tFF)  #tFFの逆行列
    #     tFF_inv = la.inverse(tFF) #tFFの逆行列
    tFy = np.dot(tF, y)
    a = np.dot(tFF_inv, tFy)

    print(a)
    '''###################
        plot        
    ###################'''
    y_ = [x[0] for x in y]

    x2 = range(5)

    y2_ = [item * a[0] + a[1] for item in x2]
    #     y2_ = [item * a[0] for item in x2]

    print()
    print("[%s:%d] a[0][1] = %.4f" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            , a[0]
               #             , a[0][1]
            ), file=sys.stderr)
    print()
    #     y2_ =

    print()
    print(y_)

    plt.plot(y_, 'b^')
    plt.plot(y2_, 'r*')
    #     plt.plot(y2_, 'r-')
    #     plt.plot(y_)

    ax = plt.gca()

    #ref grid https://stackoverflow.com/questions/16074392/getting-vertical-gridlines-to-appear-in-line-plot-in-matplotlib
    #     ax.grid(True)
    ax.grid(True, which='both')
    #     ax.grid(which='major', axis='both', linestyle='--')
    #     ax.grid(which='minor', axis='both', linestyle='--')

    plt.show()
    '''###################
        return        
    ###################'''
    return None
コード例 #23
0
def test_Request(request):

    print("[%s:%d] %s" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
             , "=================== @ test_Request")
            , file=sys.stderr)

    print(request, file=sys.stderr)
    '''###################
        get params        
    ###################'''
    params = request.GET

    print("[%s:%d] params =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()

            ), file=sys.stderr)

    print(params)
コード例 #24
0
def test_1():

    strOf_FuncName = "test_1"
    '''###################
        step : 1
            opening, vars
    ###################'''
    print()

    print("[%s:%d] starting : %s (time=%s)" %
          (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum(),
           strOf_FuncName, libs.get_TimeLabel_Now()))

    # path var
    print(
        "[%s:%d] PATH variable : " %
        (os.path.basename(os.path.basename(libs.thisfile())), libs.linenum()))

    print(sys.path)
コード例 #25
0
def exec_prog():  # from :
    '''###################
        execute
    ###################'''
    test_2_Multiple_Tsp()
    #     test_1()
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #26
0
def exec_prog():  # from : 20180116_103908

    ### test 2
    test_3_N_Multiply()
    #     test_2_Calc()
    #     test_1_Init()
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #27
0
def exec_prog(): # from : 
     
    ### test 2
    test_2()
#     test_1()
     
    
    '''###################
        Report        
    ###################'''
    print ("[%s:%d] exec_prog => done" % (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #28
0
def _im_actions__Ops_9_1(action): # /im/im_action
    
    print("[%s:%d] _im_actions__Ops_9_1()" % \
        (os.path.basename(libs.thisfile()), libs.linenum()
        
        ), file=sys.stderr)
    
    #debug
    print()
    print("[%s:%d] action => '%s'" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            , action
            ), file=sys.stderr)
    
    command = "C:\\WORKS_2\\Programs\\sakura\\sakura.exe"
#     command = "%s\\%s" % (cons_im.FPath.DPATH_CMD_LIB_WS_CAKE_IFM11.value, action)
                # OSError: [WinError 193] %1 は有効な Win32 アプリケーションではありません。
#     command = action
    arg1 = "%s\\%s" % (cons_im.FPath.DPATH_CMD_LIB_WS_CAKE_IFM11.value, action)
    
#     cmd_Full = [command]  #=> 
    cmd_Full = [command, arg1]  #=> 

    #debug
    print()
    print("[%s:%d] cmd_Full =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            
            ), file=sys.stderr)
    print(cmd_Full)
    
    res = subprocess.call(cmd_Full)

    print("[%s:%d] result (subprocess) =>" % \
            (os.path.basename(libs.thisfile()), libs.linenum()
            
            ), file=sys.stderr)
    
    print(res)
    
    return None
コード例 #29
0
def exec_prog():  # from :

    #next:20201111_175546

    #     '''###################
    #         params
    #     ###################'''
    #     args = sys.argv
    #
    #     if len(args) < 2 : #if len(args) < 2
    #
    #         print()
    #         print ("[%s:%d] param needed : len(args) = %d" % \
    #                (os.path.basename(libs.thisfile()), libs.linenum(), len(args)))
    #
    #         print()
    #         print("<Usage> python 1_1.3.py <numbering|created>")
    #
    #         return
    #
    #     param = args[1]
    #
    #     print()
    #     print("param => %s" % (param))
    #
    #
    #     #/if len(args) < 2
    #
    #     '''###################
    #         dispatch
    #     ###################'''
    #     if param == "numbering" : #if param == "numbering"
    #
    #         test_5__Numbering()
    #
    #     elif param == "created" : #if param == "numbering"
    #
    #         test_4()
    #
    #     else : #if param == "numbering"
    #
    #         print()
    #         print ("[%s:%d] unknown param => '%s'" % \
    #                (os.path.basename(libs.thisfile()), libs.linenum(), param))
    #
    #         print()
    #
    #         return
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))
コード例 #30
0
def exec_prog():  # from :
    '''###################
        execute
    ###################'''
    #mark:20210709_160406
    task_1_ShowBase()
    #     test_1()
    '''###################
        Report        
    ###################'''
    print("[%s:%d] exec_prog => done" %
          (os.path.basename(libs.thisfile()), libs.linenum()))