parser=argparse.ArgumentParser(description='Tranfer the unit from cm to m and add header for .txt file')
parser=argparse.ArgumentParser(description='Tranfer the unit from cm to m and add header for .txt file')
parser.add_argument("--filename",help='give the name of the source file')
parser.add_argument("-m","--metric",action='store',choices=['m','cm'],default='m',help='give the original metric of trajectories (default m)')
parser.add_argument("-m","--metric",action='store',choices=['m','cm'],default='m',help='give the original metric of trajectories (default m)')
parser.add_argument("-f","--fps",default="16",type=float,help='give the frame rate of data')
parser.add_argument("-f","--fps",default="16",type=float,help='give the frame rate of data')
parser.add_argument("-p","--path",default="./",help='give the path of source file')
parser.add_argument("-p","--path",default="./",help='give the path of source file')
parser.add_argument("-d","--description",help='give some description',default='Transfer with JPSreport')
parser.add_argument("-g","--geometry",help="give the name of the geometry file",default='geometry.xml')
args=parser.parse_args()
args=parser.parse_args()
returnargs
returnargs
if__name__=='__main__':
if__name__=='__main__':
args=getParserArgs()
args=getParserArgs()
path=args.path
filename=args.filename
isTrajCm=args.metric# 1 means trajectories are in cm. Otherwise they are in m
isTrajCm=args.metric# 1 means trajectories are in cm. Otherwise they are in m
print(path)
sys.path.append(path)
fps=args.fps
fps=args.fps
files=glob.glob("%s/*.txt"%(path))
path=args.path
print(files)
description=args.description
forfileinfiles:
geometry=args.geometry
description="experiment"
geometry="geometry.xml"
sys.path.append(path)
print(os.path.splitext(file)[0])
fname=(os.path.splitext(file)[0])+"_traj.txt"
print(file)
print(fname)
header="# description: %s\n# framerate: %d\n# geometry: %s\n# ID: the agent ID\n# FR: the current frame\n# X,Y,Z: the agents coordinates (in metres)\n\n# ID\tFR\tX\tY\tZ"%(description,fps,geometry)
header="# description: %s\n# framerate: %d\n# geometry: %s\n# ID: the agent ID\n# FR: the current frame\n# X,Y,Z: the agents coordinates (in metres)\n\n# ID\tFR\tX\tY\tZ"%(description,fps,geometry)