def addWell(self, name, seed, persistence=0.2, octaves=8, divergence_scale=1.0): oil_div = OilSimulator.O_DIVERGENCE.scaledCopy(divergence_scale) gas_div = OilSimulator.G_DIVERGENCE.scaledCopy(divergence_scale) water_div = OilSimulator.W_DIVERGENCE.scaledCopy(divergence_scale) self.__oprFunc[name] = ShapeCreator.createNoiseFunction(OilSimulator.OPR_SHAPE, oil_div, seed, persistence=persistence, octaves=octaves, cutoff=0.0) self.__gprFunc[name] = ShapeCreator.createNoiseFunction(OilSimulator.GPR_SHAPE, gas_div, seed * 7, persistence=persistence * 3.5, octaves=octaves / 2, cutoff=0.0) self.__wprFunc[name] = ShapeCreator.createNoiseFunction(OilSimulator.WPR_SHAPE, water_div, seed * 11, persistence=persistence, octaves=octaves, cutoff=0.0) self.__wells[name] = {"opr": 0.0, "opt": 0.0, "gpr": 0.0, "gpt": 0.0, "wpr": 0.0, "wpt": 0.0}
def addBlock(self, name, seed, persistence=0.2): self.__bprFunc[name] = ShapeCreator.createNoiseFunction( OilSimulator.BPR_SHAPE, OilSimulator.B_DIVERGENCE, seed, persistence=persistence, cutoff=0.0) self.__bpr[name] = 0.0
def addWell(self, name, seed, persistence=0.2, octaves=8, divergence_scale=1.0): oil_div = OilSimulator.O_DIVERGENCE.scaledCopy(divergence_scale) gas_div = OilSimulator.G_DIVERGENCE.scaledCopy(divergence_scale) water_div = OilSimulator.W_DIVERGENCE.scaledCopy(divergence_scale) self.__oprFunc[name] = ShapeCreator.createNoiseFunction( OilSimulator.OPR_SHAPE, oil_div, seed, persistence=persistence, octaves=octaves, cutoff=0.0) self.__gprFunc[name] = ShapeCreator.createNoiseFunction( OilSimulator.GPR_SHAPE, gas_div, seed * 7, persistence=persistence * 3.5, octaves=octaves / 2, cutoff=0.0) self.__wprFunc[name] = ShapeCreator.createNoiseFunction( OilSimulator.WPR_SHAPE, water_div, seed * 11, persistence=persistence, octaves=octaves, cutoff=0.0) self.__wells[name] = { "opr": 0.0, "opt": 0.0, "gpr": 0.0, "gpt": 0.0, "wpr": 0.0, "wpt": 0.0 }
def addBlock(self, name, seed, persistence=0.2): self.__bprFunc[name] = ShapeCreator.createNoiseFunction(OilSimulator.BPR_SHAPE, OilSimulator.B_DIVERGENCE, seed, persistence=persistence, cutoff=0.0) self.__bpr[name] = 0.0
import matplotlib.pyplot as plt from synthesizer import PerlinNoise, PrimeGenerator, ShapedNoise, ShapeFunction, ShapeCreator if __name__ == '__main__': realization_count = 10 # shape = {"x": [0.0, 0.5, 1.0], "y": [1.0, 0.5, 0.0]} # shapeFunction = ShapeFunction(shape["x"], shape["y"]) shapeFunction = ShapeCreator.createShapeFunction(seed=2) divergence = { "x": [0.0, 0.3, 0.4, 0.6, 1.0], "y": [0.01, 0.1, 0.2, 0.2, 0.5] } # divergence = {"x": [0.0, 1.0], "y": [0.1, 0.1]} divergenceFunction = ShapeFunction(divergence["x"], divergence["y"]) prime_generators = { realization: PrimeGenerator(seed=realization) for realization in range(realization_count) } for persistence in [0.1, 0.5]: plt.figure() octaves = 8 for realization in range(realization_count): prime_generator = prime_generators[realization] noise = PerlinNoise(persistence=persistence, number_of_octaves=octaves, prime_generator=prime_generator)
import matplotlib.pyplot as plt from synthesizer import PerlinNoise, PrimeGenerator, ShapedNoise, ShapeFunction, ShapeCreator if __name__ == '__main__': realization_count = 10 # shape = {"x": [0.0, 0.5, 1.0], "y": [1.0, 0.5, 0.0]} # shapeFunction = ShapeFunction(shape["x"], shape["y"]) shapeFunction = ShapeCreator.createShapeFunction(seed=2) divergence = {"x": [0.0, 0.3, 0.4, 0.6, 1.0], "y": [0.01, 0.1, 0.2, 0.2, 0.5]} # divergence = {"x": [0.0, 1.0], "y": [0.1, 0.1]} divergenceFunction = ShapeFunction(divergence["x"], divergence["y"]) prime_generators = {realization : PrimeGenerator(seed=realization) for realization in range(realization_count)} for persistence in [0.1, 0.5]: plt.figure() octaves = 8 for realization in range(realization_count): prime_generator = prime_generators[realization] noise = PerlinNoise(persistence=persistence, number_of_octaves=octaves, prime_generator=prime_generator) shaper = ShapedNoise(noise, shapeFunction, divergenceFunction, scale=0.1) values = [shaper(x / 100.0) for x in range(1000)] line = plt.plot(values, label="R: %s" % realization) plt.legend() plt.title("Persistence: %s" % persistence)