aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-16 10:57:51 +0800
committerAaron LI <aly@aaronly.me>2017-10-16 10:57:51 +0800
commit2a4f07ece389ab3454afeeeced8480a1c958f8f9 (patch)
treeca32b58802dab05715ca76465a0d6cd040ba87d1
parenta11a34e451bc50a6a4856c6869ef2a9c9efbe038 (diff)
downloadatoolbox-2a4f07ece389ab3454afeeeced8480a1c958f8f9.tar.bz2
Move python/calc_radial_psd.py to astro/calc_psd.py with some cleanup
-rwxr-xr-xastro/calc_psd.py (renamed from python/calc_radial_psd.py)52
1 files changed, 15 insertions, 37 deletions
diff --git a/python/calc_radial_psd.py b/astro/calc_psd.py
index b7d1743..fe02b02 100755
--- a/python/calc_radial_psd.py
+++ b/astro/calc_psd.py
@@ -1,44 +1,22 @@
#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
#
-# Credit:
-# [1] Radially averaged power spectrum of 2D real-valued matrix
-# Evan Ruzanski
-# 'raPsd2d.m'
-# https://www.mathworks.com/matlabcentral/fileexchange/23636-radially-averaged-power-spectrum-of-2d-real-valued-matrix
-#
-# XXX:
-# * If the input image is NOT SQUARE; then are the horizontal frequencies
-# the same as the vertical frequencies ??
-#
-# Aaron LI <aaronly.me@gmail.com>
-# Created: 2015-04-22
-# Updated: 2016-04-28
-#
-# Changelog:
-# 2016-04-28:
-# * Fix wrong meshgrid with respect to the shift zero-frequency component
-# * Use "numpy.fft" instead of "scipy.fftpack"
-# * Split method "pad_square()" from "calc_radial_psd()"
-# * Hide numpy warning when dividing by zero
-# * Add method "AstroImage.fix_shapes()"
-# * Add support for background subtraction and exposure correction
-# * Show verbose information during calculation
-# * Add class "AstroImage"
-# * Set default value for 'args.png'
-# * Rename from 'radialPSD2d.py' to 'calc_radial_psd.py'
-# 2016-04-26:
-# * Adjust plot function
-# * Update normalize argument; Add pixel argument
-# 2016-04-25:
-# * Update plot function
-# * Add command line scripting support
-# * Encapsulate the functions within class 'PSD'
-# * Update docs/comments
+# Copyright (c) 2015-2017 Aaron LI
+# MIT License
#
"""
-Compute the radially averaged power spectral density (i.e., power spectrum).
+Compute the radially averaged power spectral density (i.e., power spectrum)
+of a 2D image.
+
+XXX: If the input image is NOT SQUARE; then are the horizontal frequencies
+ the same as the vertical frequencies ??
+
+Credit
+------
+* Radially averaged power spectrum of 2D real-valued matrix
+ Evan Ruzanski
+ 'raPsd2d.m'
+ https://www.mathworks.com/matlabcentral/fileexchange/23636-radially-averaged-power-spectrum-of-2d-real-valued-matrix
"""
__version__ = "0.5.0"
@@ -450,7 +428,7 @@ def main():
# Make and save a plot
fig = Figure(figsize=(10, 8))
- canvas = FigureCanvas(fig)
+ FigureCanvas(fig)
ax = fig.add_subplot(111)
psd.plot(ax=ax, fig=fig)
fig.savefig(args.png, format="png", dpi=150)