diff --git a/ANN_Data_Generator.py b/ANN_Data_Generator.py index 57061964b1a30815d1ba07f8d4fe808ec45d2fa0..e858ad33da207b361604d56d1236e01190c475ed 100644 --- a/ANN_Data_Generator.py +++ b/ANN_Data_Generator.py @@ -10,6 +10,7 @@ TODO: Change order of methods -> Done TODO: Fix bug in initialization of input matrix -> Done TODO: Improve function selection (more even distribution) -> Done TODO: Add documentation -> Done +TODO: Improve comments -> Done """ @@ -240,18 +241,18 @@ class TrainingDataGenerator(object): # Calculating Corresponding Legendre Basis Coefficients for given polynomial_degree # Create stencil and basis_coefficients for smooth_function mapped onto stencil - # Determining grid_spacing + # Select random cell length grid_spacing = 2 / (2 ** np.random.randint(3, high=9, size=1)) - # Pick a Random point between the left and right bound + # Pick random point between left and right bound point = np.random.random(1) * (self._right_bound-self._left_bound) + self._left_bound - # Ensure Bounds of x-point stencil are within the left and right bound + # Adjust grid spacing if necessary for stencil creation while point - self._stencil_length/2 * grid_spacing < self._left_bound\ or point + self._stencil_length/2 * grid_spacing > self._right_bound: grid_spacing = grid_spacing / 2 - # x-point stencil + # Build x-point stencil interval = np.array([point - self._stencil_length/2 * grid_spacing, point + self._stencil_length/2 * grid_spacing]) stencil = np.array([point + factor * grid_spacing