diff --git a/libraries/base/common/python/plots/try_round_weight_r0_s_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r0_s_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b402703fce463ff59a807cbe371e0deb756c37ff Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_s_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r0_sw_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r0_sw_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3476b1ece27be5642c671d508ada54f3bcf2c26f Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_sw_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq.jpg b/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e6e1029b6ee09ebd8262657e3f9bf4d36481291e Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq_normalized.jpg b/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq_normalized.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1e739ea3070be8fbd819797af978db39db859312 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_w_sigma_qq_normalized.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..be3973703661ba63e259ce440a32b40e30d3a9ef Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_sq_input.jpg b/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_sq_input.jpg new file mode 100644 index 0000000000000000000000000000000000000000..629a06e64e46dc84fcd2d12908f0706f7ebfde94 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r0_w_sigmas_ratio_sq_input.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_s_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r4_s_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..92a1474d29067e473392adca9c25022ba8b9ce53 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_s_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_sw_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r4_sw_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7999a29c8cba88d40f8f00bde95bb481a427d086 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_sw_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq.jpg b/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0452af2d4dfdd4bcb3250eb069a99f57f46955bf Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq_normalized.jpg b/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq_normalized.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5dc61d5786cfbdcead52e2b507a64794eec2777b Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_w_sigma_qq_normalized.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b3cd666cc0ec4b909b1b7e11c8b07696c6f6f2d2 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_sq_input.jpg b/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_sq_input.jpg new file mode 100644 index 0000000000000000000000000000000000000000..629a06e64e46dc84fcd2d12908f0706f7ebfde94 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r4_w_sigmas_ratio_sq_input.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_s_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r6_s_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..07cfab6c4aaa157ed4a56b6c808a0067cf4ecb25 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_s_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_sw_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r6_sw_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..52ef112595fcc163ddeb935d55296cb0a98c02ce Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_sw_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq.jpg b/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2700d2e5099268345c659f98b1512114e886a17b Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq_normalized.jpg b/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq_normalized.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ba9646c8fd5aa8fa55dde6b594caab6347651dde Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_w_sigma_qq_normalized.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_qq_sq.jpg b/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_qq_sq.jpg new file mode 100644 index 0000000000000000000000000000000000000000..72ae4dfcc45a64f92906980da29e9e461686523b Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_qq_sq.jpg differ diff --git a/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_sq_input.jpg b/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_sq_input.jpg new file mode 100644 index 0000000000000000000000000000000000000000..629a06e64e46dc84fcd2d12908f0706f7ebfde94 Binary files /dev/null and b/libraries/base/common/python/plots/try_round_weight_r6_w_sigmas_ratio_sq_input.jpg differ diff --git a/libraries/base/common/python/try_round_weight.py b/libraries/base/common/python/try_round_weight.py index ca3879be50f082a1f46b84cb50e15b1bd0217848..32809f3afc2613d74f79fbc6671b89f050218ffa 100644 --- a/libraries/base/common/python/try_round_weight.py +++ b/libraries/base/common/python/try_round_weight.py @@ -45,10 +45,12 @@ # . Choose sigmas_ratio_qq_sq_T < 10% ==> -r 3 # . Choose sigmas_ratio_qq_sq_T < 1% ==> -r 6 # . 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: # . 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, -# -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: # > python3 try_round_weight.py -N 195312 @@ -87,6 +89,11 @@ _parser = argparse.ArgumentParser( # 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.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""")), formatter_class=argparse.RawTextHelpFormatter) _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') _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_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() np.random.seed(args.S) @@ -167,6 +176,7 @@ sigmas_sq_T = sigmas_sq.transpose() # Plot results figNr = 0 +dpi = 254 # 10 dots per mm s_colors = plt.cm.jet(np.linspace(0, 1, N_sigmas)) w_colors = plt.cm.jet(np.linspace(0, 1, N_weights)) @@ -181,6 +191,8 @@ plt.xlabel("Weight") plt.ylabel("Sigma_qq") plt.legend(loc='upper right') plt.grid() +if args.save: + plt.savefig('plots/try_round_weight_r%d_w_sigma_qq.jpg' % resolution, dpi=dpi) figNr += 1 plt.figure(figNr) @@ -196,6 +208,8 @@ plt.xlabel("Weight") plt.ylabel("Sigma_qq") plt.legend(loc='upper right') plt.grid() +if args.save: + plt.savefig('plots/try_round_weight_r%d_w_sigma_qq_normalized.jpg' % resolution, dpi=dpi) figNr += 1 plt.figure(figNr) @@ -210,6 +224,8 @@ plt.xlabel("Weight") plt.ylabel("Relative sigma difference") plt.legend(loc='upper right') plt.grid() +if args.save: + plt.savefig('plots/try_round_weight_r%d_w_sigmas_ratio_sq_input.jpg' % resolution, dpi=dpi) figNr += 1 plt.figure(figNr) @@ -224,6 +240,8 @@ plt.xlabel("Weight") plt.ylabel("Relative sigma difference") plt.legend(loc='upper right') plt.grid() +if args.save: + plt.savefig('plots/try_round_weight_r%d_w_sigmas_ratio_qq_sq.jpg' % resolution, dpi=dpi) figNr += 1 plt.figure(figNr) @@ -236,6 +254,8 @@ plt.xlabel("Sigma") plt.ylabel("Relative sigma difference (s_qq / s_sq)") plt.legend(loc='upper right') plt.grid() +if args.save: + plt.savefig('plots/try_round_weight_r%d_s_sigmas_ratio_qq_sq.jpg' % resolution, dpi=dpi) figNr += 1 plt.figure(figNr) @@ -245,5 +265,8 @@ plt.title("Relative sigma difference of weighting after / before quantisation") plt.xlabel("Sigma") plt.ylabel("Weight") 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()