skku_profiles Module

Principle

If one wishes to analytically generate a height series with the given statistical moments Sk and Ku, a means is to transform a Gaussian series with Johnson’s Translation System. But an alternative means is to use the tangent function:

  • in most of industrial cases, the surface heights can be fitted with a tangent function which limits are the parameters
  • it’s possible to cover a large (Sk, Ku) domain with these 2 parameters: the starting point and the ending point of the tangent height series. close to generates deep pits, and close to generates high pics.
  • the four first statistical moments can be analytically determined, as functions of and
  • the four first statistical moments can be linked to the analytical expressions so that the calculus are very fast
  • an optimization process is used to choose the tangent limits when Sk and Ku are given.

The i surface height is expressed as:

with and . As explained above the limits are and

Statistical moments

Transformation of a data set sum into an integral

The use of an analytical representation of the heights is of limited interest if the sums, as expressed above, cannot be avoided because it becomes time consuming for large .

So, how will be the statistical moments calculated in a discrete problem?

… recalling that Simpson’s method involves such sums and that it links it to the function integral.

NB : it is considered that is an even number, so

tangent integration

It can be deduced from the figure:

As for the borders:

As a result:

therefore:

Extension

A formula that links the mean of a sum to a function integral has been determined. The same goes for the standard deviation which is the mean of the sum of squares. The same process applies therefore to the four statistical moments, provided that one is able to analytically determine the integrals (Maxima and Mathematica are useful tools).

  • mu is calculated as explained above
  • when va is calculated, is replaced by with si=1
  • when Sk is calculated, is replaced by
  • when Ku is calculated, is replaced by

Uses

  • module~~skku_profiles~~UsesGraph module~skku_profiles skku_profiles data_arch data_arch module~skku_profiles->data_arch module~crest_param crest_param module~skku_profiles->module~crest_param pikaia_oop pikaia_oop module~skku_profiles->pikaia_oop sort_arrays sort_arrays module~skku_profiles->sort_arrays stat_mom stat_mom module~skku_profiles->stat_mom module~crest_param->data_arch module~crest_param->pikaia_oop module~crest_param->stat_mom

Used by

  • module~~skku_profiles~~UsedByGraph module~skku_profiles skku_profiles module~script script module~script->module~skku_profiles program~main main program~main->module~script

Functions

private function add_expo(n, deb, fin, alp, bet, mu, si)

Function that adds to the series mean the border integrals as explained in the modules presentation.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(in) :: n

statistical moment degree, n=3 for sk and n=4 for ku

integer(kind=I4), intent(in) :: deb

first integration point

integer(kind=I4), intent(in) :: fin

last integration point

real(kind=R8), intent(in) :: alp

offset so that points are in [b1,b2]

real(kind=R8), intent(in) :: bet

reduction so that points are in [b1,b2]

real(kind=R8), intent(in) :: mu

numerical mean

real(kind=R8), intent(in) :: si

numerical standard deviation

Return Value real(kind=r8)

private function add_tang(n, deb, fin, alp, bet, mu, si)

Function that adds to the series mean the border integrals as explained in the docs

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(in) :: n

statistical moment degree, n=3 for sk and n=4 for ku

integer(kind=I4), intent(in) :: deb

first integration point

integer(kind=I4), intent(in) :: fin

last integration point

real(kind=R8), intent(in) :: alp

offset so that points are in [b1,b2]

real(kind=R8), intent(in) :: bet

reduction so that points are in [b1,b2]

real(kind=R8), intent(in) :: mu

numerical mean

real(kind=R8), intent(in) :: si

numerical standard deviation

Return Value real(kind=r8)

private function expo(xi, n, alp, bet, mu, si)

Profile function based on the exponential function

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in) :: xi

abscissa

integer(kind=I4), intent(in) :: n

statistical moment degree, n=3 for sk and n=4 for ku

real(kind=R8), intent(in) :: alp

offset so that points are in [b1,b2]

real(kind=R8), intent(in) :: bet

reduction so that points are in [b1,b2]

real(kind=R8), intent(in) :: mu

numerical mean

real(kind=R8), intent(in) :: si

numerical standard deviation

Return Value real(kind=r8)

private function fitness_skku_anal(n, x)

Generic cost function: difference between the imposed statistical moments and those obtained. The optimization problem must be turned into a maximization problem (as often in the optimization routines).

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(in) :: n

number of unknowns

real(kind=R8), intent(in), dimension(1:n) :: x

vector of unknowns

Return Value real(kind=r8)

private function tang(xi, n, alp, bet, mu, si)

Profile function based on the tangent function

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in) :: xi

abscissa

integer(kind=I4), intent(in) :: n

statistical moment degree, n=3 for sk and n=4 for ku

real(kind=R8), intent(in) :: alp

offset so that points are in [b1,b2]

real(kind=R8), intent(in) :: bet

reduction so that points are in [b1,b2]

real(kind=R8), intent(in) :: mu

numerical mean

real(kind=R8), intent(in) :: si

numerical standard deviation

Return Value real(kind=r8)


Subroutines

public subroutine build_heights(vec_out, use_fct_expo, stats_in, lg)

Function that returns a set of heights that matches desired statistical moments.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(out), dimension(1:lg) :: vec_out

height vector

logical(kind=I4), intent(in) :: use_fct_expo

should exponential function rather than tangent function be used?

type(moment_stat), intent(in) :: stats_in

input statistical moments

integer(kind=I4), intent(in) :: lg

length of the height vector

private subroutine calculs_skku_exp(bounds, lg, ssk, sku)

Function to calculate the skewness and kurtosis of an exponential series.
The principle is the same as calculs_skku_tan, however it fits better some particular series quite binary (roughly two heights).

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:2) :: bounds

interval limits [-(1/bounds(1)-1), +(1/bounds(2)-1)]

integer(kind=I4), intent(in) :: lg

vec size

real(kind=R8), intent(out) :: ssk

theoretical Ssk

real(kind=R8), intent(out) :: sku

theoretical Sku

public subroutine calculs_skku_generique(bounds, lg, ssk, sku)

Function that calls the right series generator.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(:) :: bounds

interval limits

integer(kind=I4), intent(in) :: lg

vec size

real(kind=R8), intent(out) :: ssk

theoretical Ssk

real(kind=R8), intent(out) :: sku

theoretical Sku

private subroutine calculs_skku_tan(bounds, lg, ssk, sku)

Function to calculate the skewness and kurtosis of a tangent series

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:2) :: bounds

defines the function limits [-pi/2.(1-bounds(1)), +pi/2.(1-bounds(2)]

integer(kind=I4), intent(in) :: lg

vec size

real(kind=R8), intent(out) :: ssk

theoretical Ssk

real(kind=R8), intent(out) :: sku

theoretical Sku

private subroutine cost_func_skku(me, x, f)

Quantify de distance between desired moments and calculated moments

Arguments

Type IntentOptional Attributes Name
class(pikaia_class), intent(inout) :: me
real(kind=R8), intent(in), dimension(:) :: x
real(kind=R8), intent(out) :: f

private subroutine pikaia_skku_solver(pik_class, step, xl, xu, nparam, cost, istat, f, xx)

This is a refactoring of the PIKAIA unconstrained optimization code from the High Altitude Observatory. The original code is public domain and was written by Paul Charbonneau & Barry Knapp.

Read more…

Arguments

Type IntentOptional Attributes Name
type(pikaia_class), intent(inout) :: pik_class

PIKAIA class instanciation

character(len=4), intent(in) :: step

init or solv

real(kind=R8), intent(in), dimension(1:nparam) :: xl

lower bonds of xx

real(kind=R8), intent(in), dimension(1:nparam) :: xu

upper bonds of xx

integer(kind=I4), intent(in) :: nparam

number of parameters

private subroutine cost(me, x, f)
Arguments
Type IntentOptional Attributes Name
class(pikaia_class), intent(inout) :: me
real(kind=R8), intent(in), dimension(:) :: x
real(kind=R8), intent(out) :: f
integer(kind=I4), intent(out) :: istat
real(kind=R8), intent(out) :: f
real(kind=R8), intent(out), dimension(1:nparam) :: xx

chromosom for PIKAIA

private subroutine profil_theo_trie_1D(tab, lg, x, mx)

Function that generates the heights when the function limits have been determined.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(out), dimension(1:lg) :: tab

height vector

integer(kind=I4), intent(in) :: lg

height vector size

real(kind=R8), intent(in), dimension( : ) :: x

unknowns: height function limits

type(moment_stat), intent(out) :: mx

resulting statistical moments