Skip to content
Snippets Groups Projects
Commit 28023929 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Save plots.

parent e814c5c2
No related branches found
No related tags found
1 merge request!305Resolve L2SDP-846
Showing
with 25 additions and 2 deletions
libraries/base/common/python/plots/try_round_weight_r0_s_sigmas_ratio_qq_sq.jpg

159 KiB

libraries/base/common/python/plots/try_round_weight_r0_sw_sigmas_ratio_qq_sq.jpg

124 KiB

libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq.jpg

156 KiB

libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq_normalized.jpg

181 KiB

libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_qq_sq.jpg

172 KiB

libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_sq_input.jpg

166 KiB

libraries/base/common/python/plots/try_round_weight_r4_s_sigmas_ratio_qq_sq.jpg

206 KiB

libraries/base/common/python/plots/try_round_weight_r4_sw_sigmas_ratio_qq_sq.jpg

154 KiB

libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq.jpg

156 KiB

libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq_normalized.jpg

159 KiB

libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_qq_sq.jpg

239 KiB

libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_sq_input.jpg

166 KiB

libraries/base/common/python/plots/try_round_weight_r6_s_sigmas_ratio_qq_sq.jpg

210 KiB

libraries/base/common/python/plots/try_round_weight_r6_sw_sigmas_ratio_qq_sq.jpg

171 KiB

libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq.jpg

155 KiB

libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq_normalized.jpg

153 KiB

libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_qq_sq.jpg

264 KiB

libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_sq_input.jpg

166 KiB

...@@ -45,10 +45,12 @@ ...@@ -45,10 +45,12 @@
# . Choose sigmas_ratio_qq_sq_T < 10% ==> -r 3 # . Choose sigmas_ratio_qq_sq_T < 10% ==> -r 3
# . Choose sigmas_ratio_qq_sq_T < 1% ==> -r 6 # . Choose sigmas_ratio_qq_sq_T < 1% ==> -r 6
# . Choose sigmas_ratio_qq_sq_T < 0.1% ==> -r 9 # . Choose sigmas_ratio_qq_sq_T < 0.1% ==> -r 9
# . Hence the disturbance (jumps) on the sigma is about proportional
# to 1/2**r
# Note: # Note:
# . For values exactly halfway between rounded decimal values, NumPy of # . For values exactly halfway between rounded decimal values, NumPy of
# Python3 rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, # Python3 rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0,
# -0.5 and 0.5 round to 0.0, etc. (Python2 rounds half away from zero). # -0.5 and 0.5 round to 0.0, etc. Python2 rounds half away from zero.
# Usage: # Usage:
# > python3 try_round_weight.py -N 195312 # > python3 try_round_weight.py -N 195312
...@@ -87,6 +89,11 @@ _parser = argparse.ArgumentParser( ...@@ -87,6 +89,11 @@ _parser = argparse.ArgumentParser(
# resolution before rounding # resolution before rounding
> python try_round_weight.py --w_lo 0.7 --w_hi 0.8 --w_step 0.0001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 6 > python try_round_weight.py --w_lo 0.7 --w_hi 0.8 --w_step 0.0001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 6
> python try_round_weight.py --w_lo 0.3 --w_hi 1.1 --w_step 0.001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 6 > python try_round_weight.py --w_lo 0.3 --w_hi 1.1 --w_step 0.001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 6
# Reproduce plots/
> python try_round_weight.py --w_lo 0.3 --w_hi 1.1 --w_step 0.001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 0 --noplot --save
> python try_round_weight.py --w_lo 0.3 --w_hi 1.1 --w_step 0.001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 4 --noplot --save
> python try_round_weight.py --w_lo 0.3 --w_hi 1.1 --w_step 0.001 --s_lo 1 --s_hi 10 --s_step 1 -N 195312 -S 0 -r 6 --noplot --save
\n""")), \n""")),
formatter_class=argparse.RawTextHelpFormatter) formatter_class=argparse.RawTextHelpFormatter)
_parser.add_argument('-S', default=0, type=int, help='Random number seed') _parser.add_argument('-S', default=0, type=int, help='Random number seed')
...@@ -99,6 +106,8 @@ _parser.add_argument('--s_step', default=0.1, type=float, help='Step sigma') ...@@ -99,6 +106,8 @@ _parser.add_argument('--s_step', default=0.1, type=float, help='Step sigma')
_parser.add_argument('--w_lo', default=0.3, type=float, help='Lowest weight') _parser.add_argument('--w_lo', default=0.3, type=float, help='Lowest weight')
_parser.add_argument('--w_hi', default=2.0, type=float, help='Highest weight') _parser.add_argument('--w_hi', default=2.0, type=float, help='Highest weight')
_parser.add_argument('--w_step', default=0.1, type=float, help='Step weight') _parser.add_argument('--w_step', default=0.1, type=float, help='Step weight')
_parser.add_argument('--noplot', action="store_true", help='Do not show plots')
_parser.add_argument('--save', action="store_true", help='Do save plots')
args = _parser.parse_args() args = _parser.parse_args()
np.random.seed(args.S) np.random.seed(args.S)
...@@ -167,6 +176,7 @@ sigmas_sq_T = sigmas_sq.transpose() ...@@ -167,6 +176,7 @@ sigmas_sq_T = sigmas_sq.transpose()
# Plot results # Plot results
figNr = 0 figNr = 0
dpi = 254 # 10 dots per mm
s_colors = plt.cm.jet(np.linspace(0, 1, N_sigmas)) s_colors = plt.cm.jet(np.linspace(0, 1, N_sigmas))
w_colors = plt.cm.jet(np.linspace(0, 1, N_weights)) w_colors = plt.cm.jet(np.linspace(0, 1, N_weights))
...@@ -181,6 +191,8 @@ plt.xlabel("Weight") ...@@ -181,6 +191,8 @@ plt.xlabel("Weight")
plt.ylabel("Sigma_qq") plt.ylabel("Sigma_qq")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_w_sigma_qq.jpg' % resolution, dpi=dpi)
figNr += 1 figNr += 1
plt.figure(figNr) plt.figure(figNr)
...@@ -196,6 +208,8 @@ plt.xlabel("Weight") ...@@ -196,6 +208,8 @@ plt.xlabel("Weight")
plt.ylabel("Sigma_qq") plt.ylabel("Sigma_qq")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_w_sigma_qq_normalized.jpg' % resolution, dpi=dpi)
figNr += 1 figNr += 1
plt.figure(figNr) plt.figure(figNr)
...@@ -210,6 +224,8 @@ plt.xlabel("Weight") ...@@ -210,6 +224,8 @@ plt.xlabel("Weight")
plt.ylabel("Relative sigma difference") plt.ylabel("Relative sigma difference")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_w_sigmas_ratio_sq_input.jpg' % resolution, dpi=dpi)
figNr += 1 figNr += 1
plt.figure(figNr) plt.figure(figNr)
...@@ -224,6 +240,8 @@ plt.xlabel("Weight") ...@@ -224,6 +240,8 @@ plt.xlabel("Weight")
plt.ylabel("Relative sigma difference") plt.ylabel("Relative sigma difference")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_w_sigmas_ratio_qq_sq.jpg' % resolution, dpi=dpi)
figNr += 1 figNr += 1
plt.figure(figNr) plt.figure(figNr)
...@@ -236,6 +254,8 @@ plt.xlabel("Sigma") ...@@ -236,6 +254,8 @@ plt.xlabel("Sigma")
plt.ylabel("Relative sigma difference (s_qq / s_sq)") plt.ylabel("Relative sigma difference (s_qq / s_sq)")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_s_sigmas_ratio_qq_sq.jpg' % resolution, dpi=dpi)
figNr += 1 figNr += 1
plt.figure(figNr) plt.figure(figNr)
...@@ -245,5 +265,8 @@ plt.title("Relative sigma difference of weighting after / before quantisation") ...@@ -245,5 +265,8 @@ plt.title("Relative sigma difference of weighting after / before quantisation")
plt.xlabel("Sigma") plt.xlabel("Sigma")
plt.ylabel("Weight") plt.ylabel("Weight")
plt.grid() plt.grid()
if args.save:
plt.savefig('plots/try_round_weight_r%d_sw_sigmas_ratio_qq_sq.jpg' % resolution, dpi=dpi)
plt.show() if not args.noplot:
plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment