# install necessary packages
import pip
import json, pickle, requests, os, datedelta, sys, time
import datetime
import seaborn as sns
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.iolib.table import SimpleTable, default_txt_fmt
from scipy import stats
import numpy as np
import pandas as pd
from pathlib import Path
pd.options.display.max_rows = None
pd.options.display.max_columns = None
from cif import cif
from dateutil.relativedelta import relativedelta
from pathlib import Path
from scipy.optimize import brentq, fsolve, minimize
from scipy.integrate import trapz
from datetime import datetime, date
from IPython.display import clear_output,Math
from os.path import exists
import copy

# Paths
package_dir = Path(os.getcwd())
data_dir = package_dir / "@ImportExport/data"
raw_data_dir = data_dir / "raw"
output_data_dir = data_dir / "output"
fig_dir = package_dir / "@ImportExport/figures"
results_table_dir = package_dir / "@ImportExport/results/tables"
results_fig_dir = package_dir / "@ImportExport/results/figures"

# Plots
import matplotlib.pyplot as plt
from matplotlib import cycler
import matplotlib.gridspec as gridspec
from matplotlib.lines import Line2D  # for legend handle
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.transforms

# Options for figures
for i in range(2):
    plt.rcParams['axes.xmargin'] = 0
    greenslide='#008C00'
    redslide='#A00000'
    blueslide='#0000A0'
    plt.rcParams.update({
    "text.usetex": True,
    "font.family": "serif",
    "font.serif": ["Palatino"],
    })
    plt.rc('text.latex', preamble=r'\usepackage{mathpazo}')
    cpalette=sns.color_palette("cubehelix", 5)
colors = cycler('color',
                ['#EE6666', '#3388BB', '#9988DD',
                 '#EECC55', '#88BB44', '#FFBBBB'])
plt.rc('axes',  grid=True, prop_cycle=colors)
plt.rc('lines', linewidth=2)
plt.rc('grid', linewidth=1)
