json_data = open(args[0])
	service_id = {'netflix':1,'gmail':1, 'background':1}
	settings = json.load(json_data)
	ts = time.time()
	print 'start time :%f' % ts
	max_levels = settings["max_levels"]  
	level_steps = settings["level_steps"]
	obj_LogReg = [{} for x in range(0, max_levels)]
	print "The maximum number of levels required by the filter %d" % (max_levels)
	SUT = "netflix"
	supervised_samples = {}
	PCA = [None for x in range(0, max_levels)]

	#session table, for known and unknown
	known_flow_table = Flow_table(max_levels)
	unknown_flow_table = Flow_table(max_levels)
	rt = time.time()
	pkt_filter = Pkt_len_filter()
	bkgnd_sess = 0


	#load the parameter file. the parameter file is expected to be a json file.
	#exit if the parameter file doesn't contain
	theta_params = {}
	if ("parameters" in settings["files"] and options.learn == False):
		for detail_coeff in level_steps:
			try:
				service_params_fd = open(settings["files"]["parameters"][detail_coeff], "r")
				service_params = json.load(service_params_fd) 
				print "creating logistic regression object  for level %d" % (detail_coeff)
				for service_key in service_params:
		parser.error("Incorrect number of arguments")
	print "Opening JSON file %s" %(args[0])
	json_data = open(args[0])
	#Learn the applications from the input JSON file
	service_id = {}#{'netflix':1,'gmail':1, 'background':1}
	org_settings = json.load(json_data)
	apps = org_settings["apps"];
	max_levels = org_settings["max_levels"]  
	level_steps = org_settings["level_steps"]
	SUT = None
	print "Analysing the application found in %s" % (args[0])
	for keys in apps:
		service_id[keys] = 1
		print "Found app:%s" % (keys)
	#Initialize the flow table
	pkt_flow_table = Flow_table(1)
	#the packet filter, used for feature extraction on a packet.
	pkt_filter = Pkt_len_filter()

	#Parse the PCAP files and generate the statistics of the packets within a
	#PCAP file.
	for pcap_file_key in org_settings["apps"]:
		for idx in range(0,len(org_settings["apps"][pcap_file_key])):
			pcap_file = open(org_settings["apps"][pcap_file_key][idx], "r")
			print "Processing PCAP file for service %s:%s" % (pcap_file_key, org_settings["apps"][pcap_file_key][idx])
			for tx, pkt in dpkt.pcap.Reader(pcap_file):
				#process the packet, generate coeffecients and update the flow 
				#table.
				pkt_flow_table.process_pkt(pkt=pkt, \
					pkt_filter=pkt_filter, service=pcap_file_key,\
					sample_idx=idx, max_levels=max_levels)