示例#1
0
def config_varfunc():

    if cm.getConfig('TEST_MODE'):
        PRE_DAY = cm.getConfig('PRE_DAY')
    else:
        PRE_DAY = 0
    
    varname = cm.getConfig('varname')
    
    varfunc = [lambda dl, sfid: sfid,                                                   \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 5, PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 10,PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 15,PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 1,PRE_DAY),          \
            lambda dl, sfid: float('%.2f'%watterson_lib.average(dl, 20, PRE_DAY)),      \
            lambda dl, sfid: dl[-1-PRE_DAY].cl,                                         \
            lambda dl, sfid: 'LV2 ratio',                                               \
            lambda dl, sfid: get_rd1(dl, sfid),                                         \
            lambda dl, sfid: watterson_lib.get_last_dline_ftime(dl,PRE_DAY),            \
            lambda dl, sfid: watterson_lib.get_stname(sfid),                            \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 30, PRE_DAY),        \
            lambda dl, sfid: watterson_lib.variance(dl, 30, PRE_DAY),                   \
            #lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 180, PRE_DAY),      \
            lambda dl, sfid: 0,                                                         \
            lambda dl, sfid: watterson_lib.fast_grow(dl, 30, PRE_DAY),                  \
            lambda dl, sfid: watterson_lib.fast_fall(dl, 30, PRE_DAY),                  \
            lambda dl, sfid: watterson_lib.tdx_delta(sfid, PRE_DAY),\
            lambda dl, sfid: watterson_lib.delta_d1(dl,4,PRE_DAY)]
    
    cm.setConfig('varname', varname)
    cm.setConfig('varfunc', varfunc)
示例#2
0
def config_varfunc():

    if cm.getConfig('TEST_MODE'):
        PRE_DAY = cm.getConfig('PRE_DAY')
    else:
        PRE_DAY = 0

    varname = cm.getConfig('varname')

    varfunc = [lambda dl, sfid: sfid,                                                   \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 5, PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 10,PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 15,PRE_DAY),         \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 1,PRE_DAY),          \
            lambda dl, sfid: float('%.2f'%watterson_lib.average(dl, 20, PRE_DAY)),      \
            lambda dl, sfid: dl[-1-PRE_DAY].cl,                                         \
            lambda dl, sfid: 'LV2 ratio',                                               \
            lambda dl, sfid: get_rd1(dl, sfid),                                         \
            lambda dl, sfid: watterson_lib.get_last_dline_ftime(dl,PRE_DAY),            \
            lambda dl, sfid: watterson_lib.get_stname(sfid),                            \
            lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 30, PRE_DAY),        \
            lambda dl, sfid: watterson_lib.variance(dl, 30, PRE_DAY),                   \
            #lambda dl, sfid: watterson_lib.delta_ratio_reverse(dl, 180, PRE_DAY),      \
            lambda dl, sfid: 0,                                                         \
            lambda dl, sfid: watterson_lib.fast_grow(dl, 30, PRE_DAY),                  \
            lambda dl, sfid: watterson_lib.fast_fall(dl, 30, PRE_DAY),                  \
            lambda dl, sfid: watterson_lib.tdx_delta(sfid, PRE_DAY),\
            lambda dl, sfid: watterson_lib.delta_d1(dl,4,PRE_DAY)]

    cm.setConfig('varname', varname)
    cm.setConfig('varfunc', varfunc)
 def __init__(self):
     wx.Frame.__init__(self, None, -1, 'Watterson the Manager', 
             size=(1900, 1000),
             style = wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX  |wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
     panel = wx.Panel(self, -1)
     
     MVW = 100
     MTH = 0
     lc = wx.ListCtrl(panel, -1, size=(1000 + MVW,900), pos=(30,20),style=wx.LC_REPORT)
     self.pageScroll     = wx.ScrollBar(panel, -1, size = (300, 30), pos=(1060 + MVW, 20))
     self.pageLabel      = wx.StaticText(panel, -1, "PAGE=",  size=(300,30), pos=(1060 + MVW,60))
     self.sText          = wx.TextCtrl(panel, -1, "", size=(600,400 + MTH), pos=(1060 + MVW, 100), style = wx.TE_MULTILINE)
     self.btnAnalysis    = wx.Button(panel, -1, "PLOT", size=(120,40), pos = (1060+MVW, 520+MTH))
     self.btnExportData    = wx.Button(panel, -1, "EXPORT_FORM", size=(120,40), pos = (1200+MVW, 520+MTH))
     
     self.btnApply       = wx.Button(panel, -1, "ApplyPow", size=(120,40), pos=(1060+MVW+200, 580+MTH))
     self.textPow        = wx.TextCtrl(panel, -1, str(INIT_POW), size=(180, 40), pos=(1060+MVW, 580+MTH))
     
     self.btnAnalysis.Bind(wx.EVT_BUTTON, self.OnAnalysisClick)
     self.btnExportData.Bind(wx.EVT_BUTTON, self.OnExportClick)
     self.btnApply.Bind(wx.EVT_BUTTON, self.OnApplyPowClick)
     
     self.pageScroll.SetScrollbar(0,100,1100,50)
     self.pageScroll.Bind(wx.EVT_SCROLL_CHANGED, self.OnScrollMove)
     
     tdx2.SetPath('Z:\\vipdoc', 'tdxpath')
     
     extendColumn('lastCL' ,lambda dline: dline[-1].cl)
     extendColumn('wattIndex' ,lambda dl: watterson_lib.wattIndex(dl))
     extendColumn('lastTime' ,lambda dl: watterson_lib.get_last_dline_ftime(dl))
     
     if TESTMODE:
         extendColumn('rd1' ,lambda dl: watterson_lib.delta_ratio(dl,-2,-1))
     
     lc.InsertColumn(9999, "ID");
     for i in varlist:
         lc.InsertColumn(9999, i);
     
     lc.SetColumnWidth(0, 140)
     lc.SetColumnWidth(lc.GetColumnCount()-2, 140)
     lc.SetColumnWidth(lc.GetColumnCount()-1, 140)
         
     lc.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick)
     lc.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.OnItemClick)
     
     self.lc = lc
     
     self.powConfig = INIT_POW
     self.isReverse = True
     
     self.LoadFile()
     self.ListControlRefresh()
     self.Center()
    def __init__(self):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          'Watterson the Manager',
                          size=(1900, 1000),
                          style=wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX
                          | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
        panel = wx.Panel(self, -1)

        MVW = 100
        MTH = 0
        lc = wx.ListCtrl(panel,
                         -1,
                         size=(1000 + MVW, 900),
                         pos=(30, 20),
                         style=wx.LC_REPORT)
        self.pageScroll = wx.ScrollBar(panel,
                                       -1,
                                       size=(300, 30),
                                       pos=(1060 + MVW, 20))
        self.pageLabel = wx.StaticText(panel,
                                       -1,
                                       "PAGE=",
                                       size=(300, 30),
                                       pos=(1060 + MVW, 60))
        self.sText = wx.TextCtrl(panel,
                                 -1,
                                 "",
                                 size=(600, 400 + MTH),
                                 pos=(1060 + MVW, 100),
                                 style=wx.TE_MULTILINE)
        self.btnAnalysis = wx.Button(panel,
                                     -1,
                                     "PLOT",
                                     size=(120, 40),
                                     pos=(1060 + MVW, 520 + MTH))
        self.btnExportData = wx.Button(panel,
                                       -1,
                                       "EXPORT_FORM",
                                       size=(120, 40),
                                       pos=(1200 + MVW, 520 + MTH))

        self.btnApply = wx.Button(panel,
                                  -1,
                                  "ApplyPow",
                                  size=(120, 40),
                                  pos=(1060 + MVW + 200, 580 + MTH))
        self.textPow = wx.TextCtrl(panel,
                                   -1,
                                   str(INIT_POW),
                                   size=(180, 40),
                                   pos=(1060 + MVW, 580 + MTH))

        self.btnAnalysis.Bind(wx.EVT_BUTTON, self.OnAnalysisClick)
        self.btnExportData.Bind(wx.EVT_BUTTON, self.OnExportClick)
        self.btnApply.Bind(wx.EVT_BUTTON, self.OnApplyPowClick)

        self.pageScroll.SetScrollbar(0, 100, 1100, 50)
        self.pageScroll.Bind(wx.EVT_SCROLL_CHANGED, self.OnScrollMove)

        tdx2.SetPath('Z:\\vipdoc', 'tdxpath')

        extendColumn('lastCL', lambda dline: dline[-1].cl)
        extendColumn('wattIndex', lambda dl: watterson_lib.wattIndex(dl))
        extendColumn('lastTime',
                     lambda dl: watterson_lib.get_last_dline_ftime(dl))

        if TESTMODE:
            extendColumn('rd1',
                         lambda dl: watterson_lib.delta_ratio(dl, -2, -1))

        lc.InsertColumn(9999, "ID")
        for i in varlist:
            lc.InsertColumn(9999, i)

        lc.SetColumnWidth(0, 140)
        lc.SetColumnWidth(lc.GetColumnCount() - 2, 140)
        lc.SetColumnWidth(lc.GetColumnCount() - 1, 140)

        lc.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick)
        lc.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.OnItemClick)

        self.lc = lc

        self.powConfig = INIT_POW
        self.isReverse = True

        self.LoadFile()
        self.ListControlRefresh()
        self.Center()