Ejemplo n.º 1
0
        ret = mc_set(ind, 0, "try_if_it_is_working", 1, time=10)
        val = mc_get(ind, 0, "try_if_it_is_working")
        if not (ret and val):
            print("memcache not working, exit")
            sys.exit(0)

MetaDir = get_conf(configfile, "metafolder")
DataDir = get_conf(configfile, "datafolder")
convertToSampleRate = get_conf_int(configfile, "convertToSampleRate")
mc_train_da_str = get_conf(configfile, "mc_train_da_str")
mc_train_lb_str = get_conf(configfile, "mc_train_lb_str")
mc_test_da_str = get_conf(configfile, "mc_test_da_str")
mc_test_lb_str = get_conf(configfile, "mc_test_lb_str")

batch_size = get_conf_int(configfile, "batch_size")
regularize_coef = get_conf_float(configfile, "regularize_coef")

scatter_mc = {}
numClasses = {}
nUseChannels = {}
for ind in useDataSets:
    conf = conff[ind]
    scatter_mc[ind] = get_conf_int(conf, "scatter_mc")
    numClasses[ind] = get_conf_int(conf, "numClasses")
    stateStep = get_conf_int(conf, "stateStep")
    nUseChannels[ind] = get_conf_int(conf, "nUseChannels")
    secondPerFrame = get_conf_float(conf, "secondPerFrame")
    width = int(convertToSampleRate * secondPerFrame)

lg.lg_list(["regularize_coef=", regularize_coef])
lg.lg_list(["batch_size=", batch_size])
Ejemplo n.º 2
0
STcut2oriTime = "%d-cut2ori-%d"
STori2cutTime = "%d-ori2cut-%d"

EXT = get_conf(configfile, "EXT")  # .gz
CUT = get_conf(configfile, "CUT")  # ~|
EQU = get_conf(configfile, "EQU", delimiter=":")
KeyUserEmail = get_conf(configfile, "KeyUserEmail")
KeyUserName = get_conf(configfile, "KeyUserName")
UnknownUserEmail = get_conf(configfile, "UnknownUserEmail")
KeySysMs = get_conf(configfile, "KeySysMs")
KeyGPSTime = get_conf(configfile, "KeyGPSTime")
KeyGPSLat = get_conf(configfile, "KeyGPSLat")
KeyGPSLng = get_conf(configfile, "KeyGPSLng")
KeyOriSysMs = get_conf(configfile, "KeyOriSysMs")
PrivacyDist = get_conf_float(configfile, "PrivacyDist")
KeyMAF = get_conf(configfile, "KeyMAF")

rawDirList = glob.glob(DirRaw + os.sep + "*")
emails = [tmp.split(os.sep)[-1] for tmp in rawDirList]

lock = AccessRestrictionContext(
    prefix=py_fname(__file__, False) + "~mr~",
    persistent_restriction=True,
    persist_seconds=100,
    print_str=False,
)


def find_time_diff(dl, ms):
    for dt in dl:
Ejemplo n.º 3
0
import random, time
import inspect
import collections
mypydir =os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
sys.path.append(mypydir)

from readconf import get_conf,get_conf_int,get_conf_float,get_list_startswith,get_dic_startswith

iprint=2
configfile = "conf.txt"
DirGreengps = get_conf(configfile,"DirGreengps")
assert(DirGreengps!="")
CUT = get_conf(configfile,"CUT")
pakFile=DirGreengps+os.sep+"champaign.extracted.geofabrik.sep2011.augmented.pak"
nodesAndStopsFile=DirGreengps+os.sep+"champaign.extracted.geofabrik.sep2011.augmented.nodesAndstops"
GramPerGallon = get_conf_float(configfile,"GramPerGallon")
Bound_N_lat=40.157605
Bound_S_lat=40.020233
Bound_W_lng=-88.314759
Bound_E_lng=-88.128484
def inBound(lat,lng):
	if (lat<Bound_N_lat and lat>Bound_S_lat and lng<Bound_E_lng and lng>Bound_W_lng):
		return True
	return False

def query_coef_str(make ,model ,year ,vclass):
	cmd=DirGreengps+os.sep+"query "+DirGreengps+os.sep+"2014-1-30_u44_[CoeffsOrdered]_model_db_LS_wok7.txt "+make+" "+model+" "+year+" "+vclass
	pp = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
	pout = pp.communicate()[0].rstrip() 
	k15=["0",'1.531e-06', '4.286e-04', '8.625e-06', '-6.668e-07', "0","0",'0', '0', '0', '0', '4.385e-09', '-1.351e-09', '4.815e-11', '1.107e-09']
	try:
Ejemplo n.º 4
0
    def mc_get(subj, key, pref=cache_prefix):
        return mc.get(pref + "s%d" % subj + key)

    def mc_set(subj, key, val, time=CACHE_TIME, pref=cache_prefix):
        return mc.set(pref + "s%d" % subj + key, val, time=time)

    ret = mc_set(0, "try_if_it_is_working", 1, time=10)
    val = mc_get(0, "try_if_it_is_working")
    if not (ret and val):
        print("memcache not working, exit")
        sys.exit(0)

MetaDir = get_conf(configfile, "metafolder")
DataDir = get_conf(configfile, "datafolder")
regularize_coef = get_conf_float(configfile, "regularize_coef")
convertToSampleRate = get_conf_int(configfile, "convertToSampleRate")
mc_train_da_str = get_conf(configfile, "mc_train_da_str")
mc_train_lb_str = get_conf(configfile, "mc_train_lb_str")
mc_test_da_str = get_conf(configfile, "mc_test_da_str")
mc_test_lb_str = get_conf(configfile, "mc_test_lb_str")

batch_size = get_conf_int(conf, "batch_size")
scatter_mc = get_conf_int(conf, "scatter_mc")
numClasses = get_conf_int(conf, "numClasses")
stateStep = get_conf_int(conf, "stateStep")
nUseChannels = get_conf_int(conf, "nUseChannels")
secondPerFrame = get_conf_float(conf, "secondPerFrame")
height = nUseChannels
width = int(convertToSampleRate * secondPerFrame)
Ejemplo n.º 5
0
        4: [0.0, 0.0, 0.0, 1.0],
    },
}
params = {}

dataSetsDir = get_conf(configfile,
                       "dataSetsDir" + User)  #dataSetsDir = WORKDIR+/bci/
params["dataProcDir"] = get_conf(configfile, "dataProcDir" + User)
params["MetaDir"] = get_conf(configfile, "metafolder")
params["DataDir"] = get_conf(configfile, "datafolder")
params["dataSetsDir"] = dataSetsDir
params["convertToSampleRate"] = get_conf_int(configfile, "convertToSampleRate")

trainlist = get_conf(conf, "trainfiles").split(",")
testlist = get_conf(conf, "testfiles").split(",")
params["secondPerFrame"] = get_conf_float(conf, "secondPerFrame")
params["sampleRate"] = get_conf_float(conf, "sampleRate")
params["label2softmax"] = label_dict[dataname]
params["numRawChannels"] = get_conf_int(conf, "numRawChannels")
params["shiftRatio"] = get_conf_float(conf, "shiftRatio")
params["augmentTimes"] = get_conf_int(conf, "augmentTimes")
params["init_window_size"] = min(375, get_conf_int(conf, "init_window_size"))
params["dataname"] = dataname
params["stateStep"] = stateStep
params["scatter_mc"] = get_conf_int(conf, "scatter_mc")
num_subj = get_conf_int(conf, "num_subj")

for s in range(num_subj):
    skey = "s%d" % s
    trainlist = get_list_startswith(conf, skey, ",")
    testlist = get_list_startswith(conf, skey + "-t", ",")