/*****************************************************************************/ /******************** EPSIM: Error Propagation SIMulator *********************/ /*****************************************************************************/ This program takes time values from an input file, generates a set of sinusoidal waves of amplitudes, frequencies and phases given in a parameter file, using the time values from the input file. Then random Gaussian noise is added to the dataset. A least squares algorithm computes the parameters amplitude, frequency and phase of the noisy dataset. Wrapping a loop around this procedure allows to analyze a vast number of noisy datasets. The output is an expectation and rms for the three parameters of the trigonometric fit. The parameter file shall contain the frequencies, amplitudes and phases (in this order) of all sinusoidal waves. For convenience, a set of noise levels may be given. They are stored in a noise file. The phase angle has to be given in units of period, i.e. it attains values between 0 and 1. The formula to generate the sinusoidal waves is f(t) = amplitude * sin [2 * pi * (frequency * time + phase)]. The output file is updated after each cycle of the loop, so that the user may savely stop the computation by hitting Ctrl+C at any time. The maximum number of processes is the maximum number of noise datasets to be generated and analyzed by the program. If this maximum number is set zero, an infinite loop is processed, waiting for the user to stop the program manually, i.e. by pressing Ctrl+C. An additional parameter is the Gaussian quality. The program uses the random number generator to produce Gaussian random numbers by means of the central limit theorem. The number of iterations is the argument. For the computation of the least-squares fit, a step width for each parameter has to be specified. It is a measure for the tolerance of the computations. Since EPSIM is supposed to maintain the quality of approximations for a variety of amplitudes and noise levels within a single run, these parameters are scaled to signal and noise according to the following relations: freq_spacing = freq_spacing_param * noise / (last_time - first_time) / amp amp_spacing = amp_spacing_param * noise phase_spacing = phase_spacing_param * noise / amp In these relations, "noise" denotes the current value from the noise file, "(last_time - first_time)" is the total time interval, and "amp" is the amplitude of the component under consideration, as specified in the parameters file. Please be sure that your time values are sorted in ascending order, otherwise the evaluation of the frequency grid will not work properly! Finally, the user may set the -L parameter. It causes the program to create a file epsim.log where detailed information is stored during the process. This makes the code slower. The user is free to pass all arguments via command line. The command line syntax is ./epsim [-I ] [-L] [-N ] [-O ] [-P ] [-# ] [-a ] [-f frequency grid] [-g ] If the command line arguments -INOP# are not passed to the program, the user is asked to enter the rest of the specification at runtime. For the arguments -afgp the following defaults are used: -a 0.01 -f 0.0001 -g 10 -p 0.001 If different values are desired, they have to be passed to the program via command line. /*****************************************************************************/ /******************************** Compilation ********************************/ /*****************************************************************************/ The file epsim.c contains ANSI C code, which should easily compile on every platform and every C compiler. Please make sure to include math capabilities manually, if necessary. E.g. for the GNU C compiler, use gcc -lm -o epsim epsim.c Then the program is launched by typing ./epsim plus the parameters as specified above. /*****************************************************************************/ Thank you for using EPSIM. Please send requests or bug reports to Peter Reegen (reegen@astro.univie.ac.at)