项目作者: eaydin

项目描述 :
Weighted Wavelet Z-Transform Code for Python
高级语言: Python
项目地址: git://github.com/eaydin/WWZ.git
创建时间: 2014-09-11T10:08:51Z
项目社区:https://github.com/eaydin/WWZ

开源协议:MIT License

下载


WWZ Transform Code for Python

This is a Python code for timeseries analysis using WWZ transformations. It uses Foster’s abbreviated Morlet Wavelet to analyse timeseries using a WWZ (Weighted Wavelet-Z) transform. (Foster, G., 1996, http://adsabs.harvard.edu/full/1996AJ....112.1709F)

The algoritm is mostly translated from Templeton’s Fortran code (Templeton, M., 2004, http://adsabs.harvard.edu/full/2004JAVSO..32...41T).

Details of the mathematics, coding and fundamental time series analysis (especially in astronomy) is available in my thesis (Turkish): http://eayd.in/msc

Citing This Code

You can cite this code with its DOI and citing my thesis:

DOI

Aydin, M. E., 2017. eaydin/WWZ: v1.0.0, Zenodo, http://doi.org/10.5281/zenodo.375648

Aydin, M. E., 2014, Dynamic Power Spectra On The Basis Of Wavelet Transform, M.S. Thesis, Ankara University

Usage

It can either be used as a module import in another Python script or used as a standalone program. It supports paralellization, yet only in standalone mode.

Dependencies: Python 2.6+ (not Python 3 ready) and NumPy

There is also a Lomb-Scargle script in the repo for ease of use and comparison.

  1. usage: wwz.py [-h] -f FILE -o OUTPUT -l FREQ_LOW -hi FREQ_HIGH -d FREQ_STEP -c
  2. DCON [-g] [-m] [-t TIME_DIVISIONS] [--time] [--no-headers]
  3. [-p PARALLEL]
  4. Input arguments can be read from a file. The file descriptor
  5. prefix is '@'.
  6. In order to read argument from a file named args.txt,
  7. the argument @args.txt should be passed.
  8. An example for args.txt:
  9. -f=myinputfile.txt
  10. -o=theoutputfile.output
  11. -m
  12. --freq-step=0.001
  13. -l=0.001
  14. -hi=0.01
  15. -c=0.001
  16. -p=0
  17. You can pass arguments from file and commandline at the same time.
  18. If two same arguments passed by this method, the latter will be
  19. used. So if you want to override some arguments in a an argument
  20. file, specify the file first.
  21. An example usage for our earlier @args.txt is as:
  22. python wwz.py @args.txt -c=0.0125
  23. The above command will use the settings in args.txt but will
  24. use c=0.0125 instead of c=0.001
  25. Comments and blank lines are NOT allowed in argument files.
  26. Import this script via Python to use it as a module, rather than
  27. a standalone script. (import wwz)
  28. optional arguments:
  29. -h, --help show this help message and exit
  30. -f FILE, --file FILE the Input File, Raw Lightcurve
  31. -o OUTPUT, --output OUTPUT
  32. the Output File Name
  33. -l FREQ_LOW, --freq-low FREQ_LOW
  34. the Low Frequency Value
  35. -hi FREQ_HIGH, --freq-high FREQ_HIGH
  36. the High Frequency Value
  37. -d FREQ_STEP, --freq-step FREQ_STEP
  38. the dF value, incremental step for Frequency
  39. -c DCON, --dcon DCON the C constant for the Window Function
  40. -g, --gnuplot-compatible
  41. the Output file is GNUPlot compatible, which means the
  42. tau's will be grouped so that pm3d can easily map.
  43. Default value is 'False'.
  44. -m, --max-periods Creates a secondary output with the maximum Periods
  45. for each single tau. This can be drawn in 2D. The
  46. output filename is derived from the -o option, added
  47. 'max_periods'. Default value is 'False'.
  48. -t TIME_DIVISIONS, --time-divisions TIME_DIVISIONS
  49. The Time Divisions value. Templeton assumes this as
  50. 50. VStars from AAVSO leaves this optional contrary to
  51. Templeton, yet it's default value is also 50.
  52. --time Calculate the time of operation in seconds and print
  53. to standard output.
  54. --no-headers Doesn't print headers to output files if set. Default
  55. is 'False'.
  56. -p PARALLEL, --parallel PARALLEL
  57. Created threads to speed up the process. Default value
  58. is '1', which means single thread. '0' means number of
  59. detected CPUs, can be overridden.

Example Outputs

Below is an example of the X-Ray source (observed by the RXTE Satellite) with data, Lomb-Scargle and WWZ output.

Example Graph

The example below shows the main advantage of WWZ over LS. There is periodicity that LS failed to detect, with a period of about 166 days. Also note the change in frequency.

Sco X-1

The SMCX-1 graph below shows how peak frequency detected by LS can be misleading, since that frequency value actually changes (very low at 51500 and 54500 MJD) and the alias of the detected LS peak (at around 29 days period) is not detected by the WWZ algorithm (which is a good thing).

SMCX-1