Exemple #1
0
def format(pars,logger=None):
	my_methods = pars.formatters
	infile = pars.inputfile
	inputfileroot = infile.split(".")[0]
	
	#Get a list of all directories beneath DPLSim/analysisMethods
	allAnalysisMethods,methodNames = DPLSim.analysisMethods.myModList()
	
	#Read in the binary simupop population
	inputMethodName=	'DPLSim.analysisMethods.simupop.input'
	inputmethod = my_import(inputMethodName)
	pop = inputmethod.inRead(infile)
	if logger:
		logger.info("Loading %s file %s successful!" %(inputMethodName.split('.')[2],infile))
	
	
	#select the correct parsing method for each analysis method chosen.  
	filenames = []
	for m in my_methods:
		if m.upper() in methodNames:
 			for a in allAnalysisMethods:
 				if a.name.upper() == m.upper(): 
					if a.hasFormatFunction():
					
						filenames.append(a.formatter.createFiles(pop,inputfileroot))
						if logger:
							logger.info("Formatting to type %s done!" % a.name)
					else:
						logger.info("Parsing for method %s not supported!" % m)
	return filenames	
Exemple #2
0
    def getClineFunction(self):
        """
		Get the cline function for an analysis method, if available.
		Uses the dynamic import function to return the cline function as a variable.
		"""
        if self.cline:
            return my_import("DPLSim.analysisMethods.%s.cline" % self.name.lower())
Exemple #3
0
    def getFormatter(self):
        """
		Get the formatting function for an analysis method, if available. 
		Uses the dynamic import function to return the formatter as a variable. 
		"""
        if self.format:
            return my_import("DPLSim.analysisMethods.%s.formatter" % self.name.lower())
        else:
            print "not importing formatter!"