예제 #1
0
def main():
	b0 = [-53.86014283247338, -96.55148545680116, -209.56378728526175, -329.5285447843742, -276.1078577736731, -99.4682311472077, -74.60838257235906, 103.76931702628877, 199.59759885797695, 325.49387992076936, 294.9387516971606, 190.74077827555544, 95.99117577626988, 252.4851292030383, 410.3736616110993, 500, 500, 444.71357635367707, 326.35184433516275, 223.25791552817049, 98.55471776145947, 134.18167926051117, 30.336550811088184, -88.39136174706994, -121.36948314990242, -18.45822543176338, -66.01158355801323, 52.93628093781889, -92.66509252409524, 15.70587677548626, -22.132177754463765, 6.391541935525751, -68.42339808954196, 39.59640808291448, 53.464027842215515, 136.78502122848863, 254.14520471035019, 192.5665648106059, 65.30439277418417, 14.10079843084735, -114.02424000705798, -289.4634592194706, -303.0305745281302, -266.62019841090347, -198.4732468197231, -210.421471160374, -143.2408448139692, -66.7972463258127, -18.769521382966776, 46.9742033841991, 105.26603075720368, 164.98279637713722, -43.50064538327361, -79.11047511726842, -3.8891318593645394, 12.390579201231496, -59.56957705146683, 0]
	base = tools.load_nolan_bedrock()
	bed = map(operator.add, base, b0)
	gps_surf = tools.load_first_guess_surface()
	run = basic_model.isothermalISM(58, 1000, .0015,.0005,.00022, bed[:])
	ff = FitnessFunction()
	for n in range(1000):
		run.timestep(1)
	print ff.evaluate(bed, run.get_surface_elev())
예제 #2
0
	def run_models(self, parallelize = False, job_server = None): #defaults to running in serial, can make it parallel w/ params.
		if(parallelize):
			for i in range(self.n):
				#gotta do this in serial first, because it's an argument to isothermalISM, which needs to be created in serial (or so it seems. but it's working now so i'm not gonna mess with it)
				self.individuals[i].bed = map(operator.add, self.individuals[i].parameters, self.base)
			#creates list of tuples of i and job running i's model
			jobs = [(i, job_server.submit(run_model,(self.individuals[i].bed, basic_model.isothermalISM(58, 1000, .0015, .0005, .00022, self.individuals[i].bed[:]), self.fitness_function), (), ("operator", "basic_model", "tools"))) for i in range(self.n)]
			print 'jobs created'
			for i, job in jobs:
				self.individuals[i].fitness = job()
				print 'on individual', i, 'of', self.n
				print 'fitness', self.individuals[i].fitness
		else:
			for i in range(self.n):
				self.individuals[i].bed = map(operator.add, self.base, self.individuals[i].parameters)
				run = basic_model.isothermalISM(58, 1000, .0015, .0005, .00022, self.individuals[i].bed[:])
				for j in range(2000):
					run.timestep(1)				
				self.individuals[i].surface = run.get_surface_elev()
				self.individuals[i].fitness = self.fitness_function.evaluate(self.individuals[i].bed, self.individuals[i].surface)
				print 'on individual', i, 'of', self.n
				print 'fitness', self.individuals[i].fitness
예제 #3
0
def main():
    ff = evaluate.FitnessFunction()
    base = tools.load_nolan_bedrock()
    surf = tools.load_first_guess_surface()
    for i in range(9):
        mp.plot(range(58), base, "red")
        params = create(58, -500, 500)
        bed = map(operator.add, params, base)
        mp.plot(range(58), bed, "blue")
        run1 = basic_model.isothermalISM(
            58, 1000, 0.0015, 0.0005, 0.00022, bed[:]
        )  # 55 nodes, 1000-meter spacing,  basal slip was .0005

        for i in range(1500):  # 5000 years
            run1.timestep(1)
            if i % 100 == 0:
                print "on timestep", i
        mp.plot(range(58), run1.get_surface_elev()[:58])
        mp.plot(range(57), surf, "red")
        mp.scatter([1, 5, 12, 20, 32], [-70, -200, -500, -600, -250])
        print "surface difference:", tools.calculate_surface_difference(surf, run1.get_surface_elev()[:58])
        print "evaluate surface difference:", ff.evaluate(bed, run1.get_surface_elev())
        mp.show()
import basic_model
import tools
import numpy as np

possibilities1 = [ .0008, .00082, .00085, .0009, .00095, .00097, .00099, .001, .0012, .0015]
possibilities2 = [ .0005, .0006, .0007,.00072, .00075, .00077, .0008, .00082, .00085, .0009]
possibilities3 = [.0001, .0002, .00022, .00024, .00026, .00028, .0003, .0004, .0005, .00055]
results = np.zeros([1000, 4])
count = 0
b0 = tools.load_nolan_bedrock()
obs_surface = tools.load_first_guess_surface()
for i in possibilities1:
	for j in possibilities2:
		for k in possibilities3:
			run = basic_model.isothermalISM(58, 1000, i,j,k, b0[:])
			for n in range(1000):
				run.timestep(1)
			difference = tools.calculate_surface_difference(run.get_surface_elev(), obs_surface)
			results[count][0] = i
			results[count][1] = j
			results[count][2] = k
			results[count][3] = difference
			count =+ 1
			print i, j, k, difference

f = file("experiment_results.txt","wb")
np.save(f,results)
f.close()
#best for 2: .00095, .0002

#best for 3: 0.0015 0.0005 0.00022 564.84883375