I am using tamaas to generate a self-affine fractal surface with the required rms surface slope. The tutorial on the documentation page was quite helpful in this regard. However, I have two questions related to rms surface slope calculation. (1) the value given by "spectrum.rmsSlopes()" function has an extra factor of (2*pi) when compared with the analytical relation given for instance in Persson, B. N. J. (2014). Perhaps this is probably due to the difference in definitions of q0 and q1. (2) when the surface slope is calculated in python using the gradient function, the calculated value is smaller by a factor of sqrt(2). To be clear, consider for instance the following:
q0 = 1 q1 = 1 q2 = 128 H = 0.5 spectrum = tamaas.Isopowerlaw2D() spectrum.q0 = q0 spectrum.q1 = q1 spectrum.q2 = q2 spectrum.hurst = H rms_heights = spectrum.rmsHeights() rms_slopes = spectrum.rmsSlopes() #This value has an extra factor of 2*pi #For this case, rms_slopes=177 N = 256 #Number of points (should be at least 2 * q2) generator = tamaas.SurfaceGeneratorRandomPhase2D([N, N]) generator.spectrum = spectrum generator.random_seed = 42 surface = generator.buildSurface() grad = numpy.gradient(surface,1/(N-1),1/(N-1)) rms_slope_cal = numpy.sqrt(numpy.mean(grad**2+grad**2)) #this value is off by a factor of sqrt(2) from rms_slopes. #For this case, rms_slope_cal=129.1 and rms_slopes/rms_slope_cal=1.3699991200892385
Therefore, I request you to please clarify these two things.
Thanks and regards,