import os
def  parameterize(md,parametername):
	#PARAMETERIZE - parameterize a model
	#
	#   from a parameter matlab file, start filling in all the model fields that were not 
	#   filled in by the mesh.py and setmask.py model methods.
	#   Warning: the parameter file must be able to be run in Python
	#
	#   Usage:
	#      md=parameterize(md,parametername)
	#
	#   Example:
	#      md=parameterize(md,'Square.par');

	#some checks
	if not os.path.isfile(parametername):
		print 'parameterize error message: file '+parametername+' not found.'
		return []

	#Try and run parameter file.
	execfile(parametername)
	
	#ame and notes
	if len(md.miscellaneous.name)==0:
		md.miscellaneous.name=os.path.basename(parametername)
	
	md=addnote(md,'Model created by using parameter file: '+parametername+' on: '+str(datetime.datetime.now()))
