Beispiel #1
0
#!/usr/bin/env python
# -*- coding: latin-1 -*-


import sys, os
import glob
import ci_library as cil
from argparse import ArgumentParser

# Input parameters definition 
if __name__ == '__main__':
	parser = ArgumentParser(
				description='Perform the cluster index analysis on one trajectory.'
				, epilog='''The analysis depends on several files available only on Cesena server. ''') 
	parser.add_argument('-f', '--trajFile', help='trajectory file handle', default='')
	parser.add_argument('-e', '--sampleType', type=int, help='Sampling method, normal or GA', default=0)
	args = parser.parse_args()

	print "|- Sampling Method: ", args.sampleType	
	print "|- File to analyse: ", args.trajFile
	strPath = os.path.abspath(os.path.dirname(args.trajFile))
	print "|- File Path: ", strPath
	cil.clusterIndexComputation(tmpStrPath=strPath,tmpTrajFile=args.trajFile,tmpSamplingMethod=args.sampleType)
Beispiel #2
0
	
	# Go into the folder containing the trajectories
	# Convert path in absolute path
	strPath = os.path.abspath(args.strPath)
	os.chdir(strPath)

	# Explore the subtree starting from strPath
	count = 0
	for root, dirs, files in os.walk(strPath):
		# If a trajectory file is found 
		trajFiles = glob.glob(os.path.join(root,args.trajsubStr))
		if len(trajFiles) > 0:
			for trajFile in trajFiles: # For each file
				count += 1
				# File name extraction and extension removing 
				cil.clusterIndexComputation(tmpStrPath='',tmpTrajFile=trajFile,tmpFilesNumber=args.filesNumber,tmpSamplingMethod=args.sampleType, tmpCount=count)
				# filname = os.path.basename(trajFile)
# 				filnameNoExt = os.path.splitext(filname)[0]
# 				# Compute the analysis progress 
# 				percentage = count / args.filesNumber * 100
# 				print "|- ANALYSING TRAJECTORY ", filname, ' ', percentage, '% completed'
# 				# create file names according to the different steps of the analysis
# 				randomHypFileName = filnameNoExt + '.rnd'
# 				clusterFileName = filnameNoExt + '.clusters'
# 				clusterNullFileName = filnameNoExt + '.rnd.clusters'
# 				final_ci_fileName = filnameNoExt + '.ci.final'
# 				final_nci_fileName = filnameNoExt + '.nci.final'
# 				final_tci_fileName = filnameNoExt + '.tci.final'
# 				final_z_fileName = filnameNoExt + '.z.final'
# 				#### GO INTO THE FOLDER
# 				os.chdir(os.path.dirname(os.path.abspath(trajFile)))