SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rangetypes.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # EB 04/05/2019
5 # Plot range types
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': 14})
13 
14 import matplotlib.pyplot as plt
15 
16 f, ax = plt.subplots(1,2, figsize=(12,5), dpi=150)
17 plt.subplots_adjust(left=0.08, right=0.99, bottom=0.11, top=0.98, wspace=0.3, hspace=0.4)
18 Qmin = -10.0
19 Qmax = 10.0
20 Q = np.linspace(Qmin, Qmax, 100)
21 qmin = -1.0
22 qmax = 1.0
23 q = (qmax - qmin) / (1 + np.exp(-Q)) + qmin
24 #ax[0].set_xlim(qmin, qmax)
25 ax[0].plot(q,Q)
26 ax[0].set_xlabel(r"$q_{x}(\textsf{model})$", fontsize=16)
27 ax[0].set_ylabel(r"$Q_{x}(\textsf{engine})$", fontsize=16)
28 ax[0].grid(linewidth=0.5, linestyle=':')
29 
30 qmin = 0.01
31 qmax = 100.0
32 q = qmin * np.exp((np.log(qmax) - np.log(qmin)) / (1 + np.exp(-Q)))
33 ax[1].set_xscale("log")
34 ax[1].xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(lambda f, _: '{:.16g}'.format(f)))
35 #ax[1].set_xlim(qmin, qmax)
36 ax[1].plot(q,Q)
37 ax[1].set_xlabel(r"$q_\textsf{aspect}(\textsf{model})$", fontsize=16)
38 ax[1].set_ylabel(r"$Q_\textsf{aspect}(\textsf{engine})$", fontsize=16)
39 ax[1].grid(linewidth=0.5, linestyle=':')
40 plt.savefig("rangetypes.svg")
41 plt.savefig("rangetypes.pdf")
42