-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoPlots.py
65 lines (49 loc) · 1.48 KB
/
doPlots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import numpy as np
from tqdm import tqdm
import pandas as pd
import _pickle as pickle
from pprint import pprint
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.cm as cm
import seaborn as sns
plt.style.use("./files/paper.mplstyle")
from model import *
from utils import *
np.random.seed(12345)
# Define the parameters
state = {"n_f" : 492, "n_p" : 4, "n_m" : 4, "p_f" : 10, "p" : 10,}
params = {"sigma_eps" : 0.005, "sigma_mu" : 0.05, "t_c": 0.001, "gamma" : 0.01,
"beta": 4, "R": 0.0004, "s": 0.75, "alpha_1": 0.6, "alpha_2": 1.5,
"alpha_3": 1, "v_1": 2, "v_2": 0.6, "dt": 0.002}
# Load the data from simul0
with open("./files/simul0.pkl", "rb") as f:
history = pickle.load(f)
totalT = len(history["prices"])
time = np.arange(0, totalT, 1)
args = state, params, time
# Plot for simul0
plots = [
plotTS(history, args),
plotLogReturns(history, args),
plotPopulation(history, args),
animateXZ(history, args)
]
for i in range(len(plots)):
plots[i]
# Load the data from simul1 (longer)
with open("./files/simul1.pkl", "rb") as f:
history = pickle.load(f)
totalT = len(history["prices"])
time = np.arange(0, totalT, 1)
args = state, params, time
# Plot for simul1
plots = [
plotACF(history, args),
plotECDF(history, args),
plotDFA(history, args),
]
for i in range(len(plots)):
plots[i]