From 17dec720f1ffcdcac094d70f5b6edddb5195d789 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 26 Jun 2023 16:26:14 +0200 Subject: [PATCH] Support non-integer harmonics --- priorConditionedAnnealing/noise.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/priorConditionedAnnealing/noise.py b/priorConditionedAnnealing/noise.py index 2e9d0de..a87cfd7 100644 --- a/priorConditionedAnnealing/noise.py +++ b/priorConditionedAnnealing/noise.py @@ -114,8 +114,11 @@ class Harmonic_Perlin_Noise(): def __init__(self, known_shape=None, scale=0.1, octaves=8): self.known_shape = known_shape self.scale = scale - if type(octaves) == int: - octaves = [1/(i+1) for i in range(octaves)] + if type(octaves) in [int, float]: + int_octaves = int(octaves) + octaves = [1/(i+1) for i in range(int_octaves)] + if type(octaves) == float: + octaves += [1/(int_octaves+2)*(octaves-int_octaves)] octaves = np.array(octaves) self.octaves = octaves / np.linalg.norm(octaves) self.reset()