diff options
author | Aaron LI <aly@aaronly.me> | 2017-11-04 20:39:52 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-11-04 20:39:52 +0800 |
commit | 30dad264ec305433dd661834addbb1e8b1345af8 (patch) | |
tree | e1223a4c2c969422264ba52773d3ca6291d7f2f6 | |
parent | 61eedee622e2f765ea14496d0158b4fed9be03be (diff) | |
download | atoolbox-30dad264ec305433dd661834addbb1e8b1345af8.tar.bz2 |
Fix the wrong use of IQR (interquartile range)
-rwxr-xr-x | astro/calc_psd.py | 6 | ||||
-rwxr-xr-x | astro/ps2d.py | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/astro/calc_psd.py b/astro/calc_psd.py index 1b9fea8..2b57fc9 100755 --- a/astro/calc_psd.py +++ b/astro/calc_psd.py @@ -49,7 +49,7 @@ class PSD: be used to do the azimuthal averages. Otherwise, a evenly pixel-by-pixel (along radial direction) is adopted. meanstd : bool, optional - By default, the median and 16% and 84% percentiles (i.e., 68% IQR) + By default, the median and 16% and 84% percentiles (i.e., 68% error) will be calculated for each averaged annulus. If this option is ``True`` then calculate the mean and standard deviation instead. """ @@ -251,7 +251,7 @@ class PSD: labelerr = "standard deviation" else: label = "median" - labelerr = "68% IQR" + labelerr = "68% percentile range" yerr = np.row_stack((self.psd1d_errl, self.psd1d_erru)) ax.errorbar(freqs, self.psd1d, yerr=yerr, fmt="none", label=labelerr) @@ -343,7 +343,7 @@ def main(): action="store_true", help="calculate the mean and standard deviation " + "for each averaged annulus instead of the median " + - "16%% and 84%% percentiles (i.e., 68%% IQR)") + "16%% and 84%% percentiles (i.e., 68%% error)") parser.add_argument("-P", "--plot", dest="plot", action="store_true", help="plot the PSD and save as a PNG image") parser.add_argument("-i", "--infile", dest="infile", nargs="+", diff --git a/astro/ps2d.py b/astro/ps2d.py index 9009826..b5b76dc 100755 --- a/astro/ps2d.py +++ b/astro/ps2d.py @@ -98,7 +98,7 @@ class PS2D: frequencies at each image slice [MHz] meanstd : bool, optional if ``True``, calculate the mean and standard deviation for each - power bin instead of the median and 68% IQR. + power bin instead of the median and 68% percentile range. unit : str, optional unit of the cube data; will be used to determine the power spectrum unit as well as the plot labels. @@ -195,7 +195,7 @@ class PS2D: ------- ps2d : 3D `~numpy.ndarray` 3D array of shape (3, n_k_los, n_k_perp) including the median - and lower and upper errors (68% IQR) at each power bin. + and lower and upper errors (68% percentile range). If ``self.meanstd=True`` then the mean and standard deviation are calculated instead. @@ -260,7 +260,7 @@ class PS2D: title_err = "Error (standard deviation)" else: title = "2D Power Spectrum (median)" - title_err = "Error (68% IQR)" + title_err = "Error (68% percentile range)" # median/mean mappable = ax.pcolormesh(x[1:], y[1:], @@ -274,7 +274,7 @@ class PS2D: cb = ax.figure.colorbar(mappable, ax=ax, pad=0.01, aspect=30) cb.ax.set_xlabel(r"[%s$^2$ Mpc$^3$]" % self.unit) - # error (68% IQR / standard deviation) + # error (68% percentile range / standard deviation) error = 0.5 * (self.ps2d[1, :, :] + self.ps2d[2, :, :]) mappable = ax_err.pcolormesh(x[1:], y[1:], np.log10(error[1:, 1:]), @@ -453,7 +453,7 @@ class PS2D: if self.meanstd: hdr["AvgType"] = ("mean + standard deviation", "average type") else: - hdr["AvgType"] = ("median + 68% IQR", "average type") + hdr["AvgType"] = ("median + 68% percentile range", "average type") hdr["WINDOW"] = (self.window_name, "window applied along LoS") hdr["WinWidth"] = (self.window_width, "window width") @@ -503,7 +503,7 @@ def main(): action="store_true", help="calculate the mean and standard deviation " + "for each averaged annulus instead of the median " + - "16%% and 84%% percentiles (i.e., 68%% IQR)") + "16%% and 84%% percentiles (i.e., 68%% error)") parser.add_argument("-P", "--plot", dest="plot", action="store_true", help="plot the 2D power spectrum and save") |