SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sersicprior.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # EB 24/07/2019
5 # Plot the Sérsic prior as defined in the documentation
6 
7 import numpy as np
8 import matplotlib
9 matplotlib.rcParams['text.usetex'] = True
10 matplotlib.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}",r"\usepackage{sansmath}", r"\sansmath"]
11 matplotlib.rcParams['font.family'] = ['sans-serif']
12 matplotlib.rcParams.update({'font.size': 20})
13 
14 import matplotlib.pyplot as plt
15 
16 
17 f, ax = plt.subplots(1,1, figsize=(12,9), dpi=150)
18 plt.subplots_adjust(left=0.08, right=0.99, bottom=0.11, top=0.98, wspace=0.3, hspace=0.4)
19 xmin = 0.3
20 xmax = 8.0
21 npoints = 400
22 x = np.linspace(xmin, xmax, npoints)
23 s0 = 4
24 s2 = np.exp(x - s0)
25 y = np.exp(-s2*s2 / 2.0)
26 norm = sum(y) * (xmax - xmin) / npoints
27 y /= norm
28 ax.set_xlim(0, 8.3)
29 ax.plot(x,y,linewidth=3)
30 ax.set_xlabel("Sérsic index", fontsize=24)
31 ax.set_ylabel("prior", fontsize=24)
32 ax.grid(linewidth=0.5, linestyle=':')
33 plt.savefig("sersicprior.svg")
34 plt.savefig("sersicprior.pdf")
35