Commit 65934f52 authored by thomas.forbriger's avatar thomas.forbriger

croposp [WP]: produce test case time series with randomseries

parent 124a077e
......@@ -54,6 +54,7 @@
# 06/02/2019 V1.0 Thomas Forbriger
# 18/09/2019 V1.1 provide fixed seed value on request to reproduce
# publication example exactly
# 04/11/2019 V1.2 prefer randomseries to create time series
#
# ============================================================================
#
......@@ -105,91 +106,40 @@ cleanseed: ;
# set time series parameters
# --------------------------
CPSD_DT=0.01
CPSD_DUR=8640.065
#CPSD_DUR=8640.065
#CPSD_DUR=864.
CPSD_N=864007
# ----------------------------------------------------------------------
# create raw time series
# ----------------------
# Several time series of normally distributed random samples with zero mean
# are computed with siggenx. To make them incoherent, each run requires its
# own specific seed value for the random number generator. We use the
# nanosecond field of the system clock.
# are computed with randomseries.
#
CPSD_SIGGENOPT=-v -o -d $(CPSD_DT) -T $(CPSD_DUR) -ot bin
# set random number generator type
# --------------------------------
#
# Quotation from
# https://www.gnu.org/software/gsl/doc/html/index.html
# https://www.gnu.org/software/gsl/doc/html/rng.html#random-number-generator-algorithms
#
# The following generators are recommended for use in simulation. They have
# extremely long periods, low correlation and pass most statistical tests.
# For the most reliable source of uncorrelated numbers, the second-generation
# RANLUX generators have the strongest proof of randomness.
#
# gsl_rng_ranlxd1
# gsl_rng_ranlxd2
#
# These generators produce double precision output (48 bits) from the
# RANLXS generator. The library provides two luxury levels ranlxd1 and
# ranlxd2, in increasing order of strength.
#
# gsl_rng_ranlux
# gsl_rng_ranlux389
#
# The ranlux generator is an implementation of the original algorithm
# developed by Luscher. It uses a lagged-fibonacci-with-skipping
# algorithm to produce “luxury random numbers”. It is a 24-bit
# generator, originally designed for single-precision IEEE floating
# point numbers. This implementation is based on integer arithmetic,
# while the second-generation versions RANLXS and RANLXD described
# above provide floating-point implementations which will be faster
# on many platforms. The period of the generator is about 10^{171}.
# The algorithm has mathematically proven properties and it can
# provide truly decorrelated numbers at a known level of randomness.
# The default level of decorrelation recommended by Luscher is
# provided by gsl_rng_ranlux, while gsl_rng_ranlux389 gives the
# highest level of randomness, with all 24 bits decorrelated. Both
# types of generator use 24 words of state per generator.
#
# For more information see,
#
# * M. Luscher, “A portable high-quality random number generator for
# lattice field theory calculations”, Computer Physics Communications,
# 79 (1994) 100–110.
# * F. James, “RANLUX: A Fortran implementation of the high-quality
# pseudo-random number generator of Luscher”, Computer Physics
# Communications, 79 (1994) 111–114
# run
# randomseries -xhelp=gslrng
# to see comments
#
RNGTYPE=ranlux
# Choose:
RNGTYPE=ranlxd2
# allow to reproduce publication example exactly
ifdef FIXEDSEED
cpsd1raw.seed: ;printf "%s\n" 686293391 > $@
cpsd2raw.seed: ;printf "%s\n" 448546898 > $@
cpsd3raw.seed: ;printf "%s\n" 021371780 > $@
cpsd4raw.seed: ;printf "%s\n" 559720675 > $@
cpsdbgraw.seed: ;printf "%s\n" 137374844 > $@
else
cpsd1raw.seed: ;printf "%s\n" $$(date +"%N") > $@
cpsd2raw.seed: ;printf "%s\n" $$(date +"%N") > $@
cpsd3raw.seed: ;printf "%s\n" $$(date +"%N") > $@
cpsd4raw.seed: ;printf "%s\n" $$(date +"%N") > $@
cpsdbgraw.seed: ;printf "%s\n" $$(date +"%N") > $@
endif
cpsd1raw.bin cpsd2raw.bin cpsd3raw.bin cpsd4raw.bin cpsdbgraw.bin: \
%.bin: %.seed
/bin/bash -c 'export GSL_RNG_SEED=$$(cat $<); \
export GSL_RNG_TYPE=$(RNGTYPE); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED > $(patsubst %.bin,%seed.xxx,$@)'
# time series for common noise signal: cpsdbgraw.bin
RNGSEED=0
cpsdrawseries.bin:
randomseries -v -o -t bin -rngtype $(RNGTYPE) -nseries 5 \
-nsamples $(CPSD_N) -dt $(CPSD_DT) -seed $(RNGSEED) \
-std 1. -mean 0. $@
cpsd1raw.bin cpsd2raw.bin cpsd3raw.bin cpsd4raw.bin: \
%.bin: cpsdrawseries.bin
any2any --verb --over --itype bin --otype bin \
$@ $< t:$(patsubst cpsd%raw.bin,%,$@)
cpsdbgraw.bin: \
%.bin: cpsdrawseries.bin
any2any --verb --over --itype bin --otype bin \
$@ $< t:5
# provide a time series plot to confirm incoherence
rawsig.ps: cpsd1raw.bin cpsd2raw.bin cpsd3raw.bin cpsd4raw.bin cpsdbgraw.bin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment