Exemple #1
0
    #### Initialize the FRED SIMS
    fred = FRED()

    key = opts.key

    run = opts.run

    try:
        int(run)
    except:
        if run != "ave" and run != "all":
            print "Invalid parameter for run, needs to be an integer, all or ave"
            sys.exit(1)

    fred_run = FRED_RUN(fred, key)
    numberDays = int(fred_run.get_param("days"))
    outputsAve = fred_run.outputsAve

    apolloDBs = [apollo.ApolloDB(host_=x) for x in DBHosts]
    for apolloDB in apolloDBs:
        apolloDB.connect()
        concString = ""
        m5hash = ""
        ### create a string of the concatenated input files
        exclusionList = ['dbfile.txt', 'defaults']
        fred_work_dir = fred_run.run_work_dir
        if os.path.exists(fred_work_dir) is True:
            workingFiles = glob.glob(fred_work_dir + "/*")
            ### concatenate params file first
            ### find it and add it to the exclusionList
Exemple #2
0
    #### Initialize the FRED SIMS
    fred = FRED()

    key = opts.key

    run = opts.run

    try:
        int(run)
    except:
        if run != "ave" and run != "all":
            print "Invalid parameter for run, needs to be an integer, all or ave"
            sys.exit(1)

    fred_run = FRED_RUN(fred, key)
    numberDays = int(fred_run.get_param("days"))
    outputsAve = fred_run.outputsAve

    apolloDB = apollo.ApolloDB()
    apolloDB.connect()

    #for day in outputsAve:
    #	print "Day = %d I = %d"%(day['Day'],day['I'])

    #ApolloConn = MySQLdb.connect(host="warhol-fred.psc.edu",
    #				 user="******",
    #				 db="apollo")
    #ApolloCursor = ApolloConn.cursor()

    ## Fill in the run table
    vizType = opts.type
    vizVariable = opts.variable
    vizOp = opts.op
    movFormat = opts.movformat

    imgFormat = "png"
    if vizType == "animated":
        imgFormat = "gif"

    percentsString = ""
    if opts.percents is True:
        percentsString = "_percents"

    ### Find the FRED run in this SIMS
    fred_run = FRED_RUN(fred, key)

    ### Find the Population File

    time1 = time.time()
    countyList = []
    #if fred_run.params_dict['city'] is not None:
    #	print fred_run.params_dict['city']
    #	countyList = [fred.cityDict[fred_run.params_dict['city']]]
    #    elif fred_run.params_dict['county'] is not None:
    #	countyList = [fred.countyDict[fred_run.params_dict['county']]]
    #    else:
    #synth_pop_dir = fred_run.get_param("synthetic_population_directory")
    #synth_pop_id = fred_run.get_param("synthetic_population_id")

    #synth_pop_prefix = os.path.expandvars(synth_pop_dir + "/" + synth_pop_id + "/" + synth_pop_id)
    #### Initialize the FRED SIMS
    fred = FRED()
    
    key = opts.key

    run = opts.run

    try:
        int(run)
    except:
        if run != "ave" and run != "all":
            print "Invalid parameter for run, needs to be an integer, all or ave"
            sys.exit(1)

    fred_run = FRED_RUN(fred,key)
    numberDays = int(fred_run.get_param("days"))
    outputsAve = fred_run.outputsAve

    apolloDBs = [ apollo.ApolloDB(host_=x) for x in DBHosts ]
    for apolloDB in apolloDBs:
	apolloDB.connect() 
	concString = ""
	m5hash = ""
    ### create a string of the concatenated input files
	exclusionList = ['dbfile.txt','defaults']
	fred_work_dir = fred_run.run_work_dir
	if os.path.exists(fred_work_dir) is True:
	    workingFiles = glob.glob(fred_work_dir + "/*")
	    ### concatenate params file first
	    ### find it and add it to the exclusionList
Exemple #5
0
    vizType = opts.type
    vizVariable = opts.variable
    vizOp = opts.op
    movFormat = opts.movformat


    imgFormat = "png"
    if vizType == "animated":
	imgFormat = "gif"

    percentsString = ""
    if opts.percents is True:
	percentsString = "_percents"

    ### Find the FRED run in this SIMS
    fred_run = FRED_RUN(fred,key)

    ### Find the Population File

    time1 = time.time()
    if opts.taiwan is True:
        countyList = None
    else:
        countyList = []
        #if fred_run.params_dict['city'] is not None:
    #	print fred_run.params_dict['city']
    #	countyList = [fred.cityDict[fred_run.params_dict['city']]]
    #    elif fred_run.params_dict['county'] is not None:
    #	countyList = [fred.countyDict[fred_run.params_dict['county']]]
    #    else:
            #synth_pop_dir = fred_run.get_param("synthetic_population_directory")
    DBHosts = ["warhol-fred.psc.edu"]
    ### This only currently works for allegheny county

    #### Initialize the FRED SIMS
    fred = FRED()    
    key = opts.key
    run = opts.run
    simulationRunId = opts.runId

    statusFile = "./starttime"

    if simulationRunId is None:
	    error_exit("Need to specify an Apollo SimulationRunId to use this program")

    try:
	    fred_run = FRED_RUN(fred,key)
	    numberDays = int(fred_run.get_param("days"))
	    outputsAve = fred_run.outputsAve
    except Exception as e:
	    error_exit(str(e))

    try:
	    apolloDBs = [ apollo.ApolloDB(host_=x) for x in DBHosts ]
	    
	    for apolloDB in apolloDBs:
		    print "working on DB: " + str(apolloDB._host)
		    apolloDB.connect() 
		    
		    ### Get the runId from the database 
		   
		    locationList = [fred_run.get_param('fips')]
Exemple #7
0
    ### This only currently works for allegheny county

    #### Initialize the FRED SIMS
    fred = FRED()
    key = opts.key
    run = opts.run
    simulationRunId = opts.runId

    statusFile = "./starttime"

    if simulationRunId is None:
        error_exit(
            "Need to specify an Apollo SimulationRunId to use this program")

    try:
        fred_run = FRED_RUN(fred, key)
        numberDays = int(fred_run.get_param("days"))
        outputsAve = fred_run.outputsAve
    except Exception as e:
        error_exit(str(e))

    try:
        apolloDBs = [apollo.ApolloDB(host_=x) for x in DBHosts]

        for apolloDB in apolloDBs:
            print "working on DB: " + str(apolloDB._host)
            apolloDB.connect()

            ### Get the runId from the database

            locationList = [fred_run.get_param('fips')]
    #### Initialize the FRED SIMS
    fred = FRED()
    
    key = opts.key

    run = opts.run

    try:
        int(run)
    except:
        if run != "ave" and run != "all":
            print "Invalid parameter for run, needs to be an integer, all or ave"
            sys.exit(1)

    fred_run = FRED_RUN(fred,key)
    numberDays = int(fred_run.get_param("days"))
    outputsAve = fred_run.outputsAve

    apolloDB = apollo.ApolloDB()
    apolloDB.connect()
    

    ## Fill in the run table
    SQLString = 'INSERT INTO run set label = "' + key + '"'
    apolloDB.query(SQLString)
    runInsertID = apolloDB.insertID()

    stateList = {'S':'susceptible','E':'exposed','I':'infectious','R':'recovered'}
    locationList = ['42003'] # need to replace with an automatic way of getting this info
    stateInsertIDDict = {}