The mirror distribution of a data set was defined in Appendix C of Akhlaghi and Ichikawa (2015). It is best visualized by mentally placing a mirror on the histogram of a distribution at any point within the distribution (which we call the mirror point).
Through the --mirrorquant in ImageStatistics, you can check the mirror of a distribution when the mirror is placed on any given quantile. The mirror distribution is plotted along with the input distribution both as histograms and cumulative frequency plots, see Histogram and Cumulative Frequency Plot. Unlike the rest of the histograms and cumulative frequency plots in ImageStatistics, the text files created with the --mirrorquant and --checkmode will contain 3 columns. The first is the horizontal axis similar to all other histograms and cumulative frequency plots. The second column shows the respective value for the actual data distribution and the third shows the value for the mirror distribution.
The value for each bin of both histogram is divided by the maximum of both. For the cumulative frequency plot, the value in each bin is divided by the maximum number of elements. So one of the cumulative frequency plots reaches the maximum vertical axis of 1. The outputs will have the _mirrorhist.txt and _mirrorcfp.txt suffixes respectively. You can use a simple Python script like the one below to display the histograms and cumulative frequency plots in one plot:
#! /usr/bin/env python3 # Import the necessary modules: import sys import numpy as np import matplotlib.pyplot as plt # Load the two files: a=np.loadtxt(sys.argv+"_mirrorhist.txt") b=np.loadtxt(sys.argv+"_mirrorcfp.txt") # Calculate the bin width: w=a[1,0]-a[0,0] # Plot the two histograms and cumulative frequency plots: plt.bar(a[:,0], a[:,1], width=w, color="blue", linewidth=0, alpha=0.6) plt.bar(a[:,0], a[:,2], width=w, color="green", linewidth=0, alpha=0.4) plt.plot(b[:,0], b[:,1], linewidth=2, color="blue") plt.plot(b[:,0], b[:,2], linewidth=2, color="green") # Write the axis labels: plt.ylim([0,np.amax(a[:,1])]) plt.xlim([np.amin(a[:,0]),np.amax(a[:,0])]) # Save the output to any name from the command-line: plt.savefig(sys.argv+"_plot.pdf")
The output format can be anything that Python’s Matplotlib recognizes (for example png or jpg are also acceptable). So, if your input data file name was input.fits, and you want to see how its mirror distribution would look like if the mirror was placed at the 0.8 quantile (or the value which is above 80 percent of your data) you can run the following sequence of commands to see the combined cumulative frequency plot and histogram together in one PDF file. Let’s assume you have put the Python script above into the file mirrorplot.py. The second command makes the Python script an executable file.
$ ls input.fits mirrorplot.py $ chmod +x mirrorplot.py $ astimgstat input.fits --nohist --nocfp --mirrorquant=0.8 $ ls input.fits input_mirrorcfp.txt input_mirrorhist.txt mirrorplot.py $ ./mirrorplot.py input
By default, the range of the mirror distribution is set to the 0.01 quantile of the image to 2 times the distance of the mode to that point. This is done so that the mode (which will have a value of zero in this plot) is positioned exactly on 1/3rd point of the x axis plot. The number of bins is the same value as the --histnumbins option. Alternatively, through the option --histrangeformirror, the histogram properties set with the --histmin and --histmax can be used. In these mirror plots, the mirror value is going to have the value of zero and one of the bins is going to start at zero (if --histrangeformirror is called, the given ranges will also shift accordingly).