def run_pecube_map(faultParamsListFiltered):
	[initA, accelA, srA1, srA2, initB, srB] = faultParamsListFiltered
	
	netExtension = psc.calcNetExtension(initA, srA1, accelA, srA2, dipFaultA, initB, srB, dipFaultB)
#	test for amount of extension (maybe do this with a filter function
#	or something similar when making the variable list)

#	modify input files, 
	psc.modifyInputFiles(initA, srA1, accelA, srA2, initB, srB, inputFile, outputFile)
	
	#rename fault parameters
	psc.renameFaultParams(inputFile, outputFile)

#	run pecube
	pecube_print = psc.run_pecube_cloud()
	
#	save output
	out_name = psc.save_output(comparison_file, initA, srA1, accelA, srA2, initB, srB)
	
#	calculate chi square
	chi_square = psc.calc_chi_square(obs, out_name)
	
#	append results to results file(s)	
	out_array = psc.append_info(out_name, chi_square, initA, srA1, accelA, srA2, initB, srB, netExtension)

	#cloud.files.get(out_array, '/home/itchy/src/Pecube/picloud/results/nmtN5/{}'.format(out_array))
	
	return pecube_print
dipFaultA = [0.4]

dipFaultB = [0.88]

#	define list of variable lists
faultParamsList = [[j, k, l, m, n, o] for j in initFaultAs for k in accelFaultAs for l in slipRate1FaultAs for m in slipRate2FaultAs for n in initFaultBs for o in slipRateFaultBs]


faultParamsListFiltered = []

for faultParams in faultParamsList:

	[initA, accelA, srA1, srA2, initB, srB] = faultParams
	
	netExtension = psc.calcNetExtension(initA, srA1, accelA, srA2, dipFaultA, initB, srB, dipFaultB)

#print netExtension

	if netExtension < 20:
		if netExtension > 12:
			
			faultParamsListFiltered.append(faultParams)

print len(faultParamsListFiltered)

def run_pecube_map(faultParamsListFiltered):
	[initA, accelA, srA1, srA2, initB, srB] = faultParamsListFiltered
	
	netExtension = psc.calcNetExtension(initA, srA1, accelA, srA2, dipFaultA, initB, srB, dipFaultB)
#	test for amount of extension (maybe do this with a filter function