From d61498cdaabff16fa86046c872209ef232df6d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=C3=B9=20Marcer?= Date: Thu, 11 Jun 2020 18:31:28 +0200 Subject: [PATCH] ex-1: add the possibility of plotting a Cauchy PDF and create the plot --- ex-1/plots/misc.py | 30 +++++++++++++++++++++++------- slides/images/cauchy-pdf.pdf | Bin 0 -> 9623 bytes 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 slides/images/cauchy-pdf.pdf diff --git a/ex-1/plots/misc.py b/ex-1/plots/misc.py index 85710dd..c313daf 100755 --- a/ex-1/plots/misc.py +++ b/ex-1/plots/misc.py @@ -6,12 +6,13 @@ import argparse import sys -# -i → agrs.show → open plot in interactive mode -# -s → args.save → save plot +# -i → agrs.show → open plot in interactive mode +# -s → args.save → save plot # -# -n → agrs.note → do the Landau plot with the notes -# -b → args.both → do the Landau-Moyal plot -# -m → args.area → do the Landau median plot +# -n → agrs.note → do the Landau plot with the notes +# -b → args.both → do the Landau-Moyal plot +# -m → args.area → do the Landau median plot +# -c → args.cauchy → do the Cauchy PDF plot def moyal(x, μ, σ): @@ -19,20 +20,24 @@ def moyal(x, μ, σ): return N * np.exp(- 0.5 * ((x - μ)/σ + np.exp(- (x - μ)/σ))) +def cauchy(x): + return 1/(np.pi*(1 + x**2)) + + def main(args): # prepare figure if args.show: plt.figure() - elif args.save: plt.rcParams['font.size'] = 8 if (args.both or args.area): plt.figure(figsize=(3, 2)) elif args.note: plt.figure(figsize=(5, 3)) + elif args.cauchy: + plt.figure(figsize=(3, 2)) if args.note: - # useful coordinates y_min = -0.0086 # y min axes y_max = 0.1895 # y max axes @@ -85,6 +90,12 @@ def main(args): plt.plot(x, moyal(x, μ, σ), color='gray', label='Moyal') plt.legend() + # do Cauchy plot + if args.cauchy: + x = np.arange(-10, 10, 0.01) + plt.plot(x, cauchy(x), color='gray', label='Cauchy') + plt.legend() + # save figure plt.tight_layout() if args.show: @@ -96,6 +107,8 @@ def main(args): plt.savefig('slides/images/both-pdf.pdf', transparent=True) if args.area: plt.savefig('slides/images/median.pdf', transparent=True) + if args.cauchy: + plt.savefig('slides/images/cauchy-pdf.pdf') if __name__ == '__main__': @@ -116,5 +129,8 @@ if __name__ == '__main__': parser.add_argument('-a', '--area', action='store_true', default=False, help='do the area plot') + parser.add_argument('-c', '--cauchy', + action='store_true', default=False, + help='do the cauchy plot') args = parser.parse_args() main(args) diff --git a/slides/images/cauchy-pdf.pdf b/slides/images/cauchy-pdf.pdf new file mode 100644 index 0000000000000000000000000000000000000000..809a82f186e47bf48e82feace3e1f5675123f543 GIT binary patch literal 9623 zcmb_C2{@Ep)C$GevM1DwY>C;8vF}TgeM^?XV91QdSRzu1PpA|sYegchNF`CpmaSCE z*P>*}URhh@zwby%J>TE+KmT}+`_8$`S?-y0&U??5wK6nTMyucuvgcnw#T5uNgo0?E z{s>J?2x&#~B?m(ofU$v)b~}T}5Ym9eAZ@4lLfYC0GSwR%sJ3W=Q8>fImO)~WA>8~V zV;YqKVdtN%NDKyerh;$8`2|eqw2&YO z7Sq5MLK>1oDPCk76F?e#v!j!!!9gTCnd-H3LGt`fu*)55{JFfj~T6++{1 zFbyks3S&WIHsoMh2;B>)5Z2KT6~bCwq(7LQ1%8bw+kuK8r15s3LqoC`%^RqEGnwkk z@Pp9s&e*^cgBf%(DG(8!b>?`>!ENoz5lQ=`?v%#X?!R-UqKl(^ zuG+~6*Qv>>wRYXfN;XLU!&Y52FUIY5SwLBz>)4KJIj^;FnU6c3i zB5?O^YnP6F66${Sk@3$(#W4O8=~pGCdakT0JuI;S)h0EnY#D#~#J#vFwDCoge?B^K z+@VRfe^#r%j?$7eJaA37s5G?btiq&F@6%Zue?w&pxBPs!som9`b5*;aHGP{^Dau<% z3{k$7a*J5G&Szg|UJ;8!T=MA)P2Xw~v!`a-kk@F@;U9KY&tAWAt}rR1-@dj{AoA&H zUa7FmJ{L{_i;y_+>$RTyO69k%&**yh1Y^K)r4^GWo^=uv;gryEp#HY{1r4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