Ejemplo n.º 1
0
    def tunit(verbose):
        ConciseMonitor.enable(False)
        app = Application(None,"TestTimeSeries",verbose,True)
        db = Database(app.dbFilePath)
        if verbose: print >>sys.stderr,'TimeSeriesSet.uniqueid for %s is %s' % (db.basename(),TimeSeriesSet.uniqueid(db))
        tssids = TimeSeriesSet.seriessetids(db)
        if not len(tssids): raise Exception, "there are no TimeSeriesSets in %s" % db.filepath()
        tss = TimeSeriesSet(db,tssids[0])
        tss.lastreldelta_quintiles()
        evs = tss.events()

        print "TimeSeries and TimeSeriesSet okay"
        print "EventSeries and EventSeriesSet okay"
Ejemplo n.º 2
0
 def main():
     clargs = dict(debug=False, norm=True, real=True, dbfile=None, n=None, coeff=False, intensities=False, RFORMAT=False, all=False, listindex=False, seriessetid=None, orphan=False, brief=False);
     ai = 1
     while ai < len(sys.argv):
         arg = sys.argv[ai]
         ai += 1
         if arg == "-?" or arg == "--help":
             Showxy.help()
             sys.exit(1)
         elif arg == "-A" or arg == "--all":
             clargs['all'] = True
             clargs['n'] = 1000000
         elif arg == "-C" or arg == "--coeff":
             clargs['coeff'] = True
         elif arg == "-D" or arg == "--debug":
             clargs['debug'] = True
         elif arg == "-E" or arg == "--export":
             clargs['export'] = True
         elif arg == "-i" or arg == "--index":
             clargs['listindex'] = True
         elif arg == "-I" or arg == "--intensities":
             clargs['intensities'] = True
         elif arg == "-t" or arg == "--tssid":
             if ai >= len(sys.argv): raise Exception("%s missing n: try --index to see an index of the database and a list of the tssids" % arg)
             clargs['seriessetid'] = int(sys.argv[ai])
             ai += 1
         elif arg == "-M" or arg == "--monitor":
             ConciseMonitor.enable(True)
         elif arg == "--n" or arg == "--nonorm":
             clargs['norm'] = False
         elif arg == "-o" or arg == "--brieforphan":
             clargs['orphan'] = True
             clargs['brief'] = True
         elif arg == "-O" or arg == "--orphan":
             clargs['orphan'] = True
             clargs['brief'] = False
         elif arg == "--RFORMAT":
             clargs['RFORMAT'] = True
         elif arg == "--r" or arg == "--noreal":
             clargs['real'] = False
         elif clargs['dbfile'] == None:
             clargs['dbfile'] = arg
         elif clargs['n'] == None:
             clargs['n'] = int(arg)
         else:
             raise Exception, "unrecognised arg: %s" % arg
     showxy = Showxy(**clargs)
Ejemplo n.º 3
0
def utility():
    ConciseMonitor.enable(False)
    brief = False
    debug = False
    update = False
    default_dbfile = Application(None,"CoefficientMatrix Utility",False,True).dbFilePath
    dbfiles = [ ]
    for arg in sys.argv[1:]:
        if arg == '--help' or arg == '-?':
            print '%s: display coefficient matrix metrics in one or more BC database files, optionally installing post-import coefficient matrices as well' % sys.argv[0]
            print
            print 'use: %s [ option ]... [ databasefile ]...'
            print
            print '      databasefile    path to a BC databasefile; default is the dbfile found in .bc_profile:'
            print '                      %s' % default_dbfile
            print
            print 'options:'
            print ' -? --help            print the help information and exit'
            print ' -D --debug           turn on debugging'
            print ' -B --brief           brief display'
            print ' -M --monitor         turn on resource monitoring'
            print ' -U --update          update databases with any missing post-import coefficient matrices'
            sys.exit(1)
        elif arg == '-B' or arg == '--brief':
            brief = True
        elif arg == '-D' or arg == '--debug':
            debug = True
        elif arg == '-M' or arg == '--monitor':
            ConciseMonitor.enable(True)
        elif arg == '-U' or arg == '--update':
            update = True
        elif arg == '-D' or arg == '--debug':
            debug = True
        else:
            Database(arg)   # raise exception now if not a valid db file
            dbfiles.append(arg)
    if not dbfiles:
        dbfiles.append(default_dbfile)
    for dbfile in dbfiles:
        resuse = ConciseMonitor()
        db = Database(dbfile)
        report_coefficients(db,brief,update)
        resuse.report('%s finished' % db.basename())
Ejemplo n.º 4
0
#!/usr/bin/env python

import re,sys
from application import *
from timeseries import *
from coefficient import *       # problems arise if you import coefficient before timeseries :(
from monitor import ConciseMonitor
from util import *


ConciseMonitor.enable(False)


class Showxy:

    DEFAULT_DATAPOINTS = TimeSeries.maxStringisedDatapoints

    def __init__(self,**args):

        debugpatt = re.compile('debug_')
        app = Application(None,"Showxy",args['debug'],False)

        if args['debug']:
            for k in args.keys():
                if debugpatt.search(k):
                    app.params.params[k] = True

        dbfile = args['dbfile'] or app.dbFilePath
        db = args['db'] = Database(dbfile)
        tssids = TimeSeriesSet.seriessetids(db)
        index = TimeSeriesSet.index(db)