# Path: sfc_models/examples/Quick2DPlot.py
# class Quick2DPlot(object):
#     def __init__(self, x, y, title='', run_now=True, output_directory=None, filename=None):
#         self.X = x
#         self.Y = y
#         self.Title = title
#         self.XLabel = None
#         self.YLabel = None
#         self.Legend = None
#         self.FileName = filename
#         self.LegendPos = 'best'
#         self.OutputDirectory = output_directory
#         if run_now:
#             self.DoPlot()
# 
#     def DoPlot(self):  # pragma: no cover
#         if plt is None:
#             pprint('Attempted to plot the following data; cannot to do because cannot import matplotlib')
#             if type(self.X[0]) == list:
#                 pprint('Series 1')
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X[0])):
#                     pprint('%f %20f' % (self.X[0][i], self.Y[0][i]))
#                 pprint('Series 2')
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X[1])):
#                     pprint('%f %20f' % (self.X[1][i], self.Y[1][i]))
#             else:
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X)):
#                     pprint('%f %20f' % (self.X[i], self.Y[i]))
#             return
#         if type(self.X[0]) == list:
#             fig, ax = plt.subplots()
#             ax.plot(self.X[0], self.Y[0], marker='o', markersize=4)
#             ax.plot(self.X[1], self.Y[1], marker='^', markersize=4.5)
#             # plt.plot(self.X[0], self.Y[0], self.X[1], self.Y[1], marker='o')
#         else:
#             plt.plot(self.X, self.Y, marker='o')
#         params = Quick2DPlotParams()
#         params.ReadFile()
#         plt.rcParams.update({'font.size': params.FontSize})
#         figure = plt.gcf()
#         figure.set_size_inches(4.5, 3)
#         if len(self.Title) > 0:
#             plt.title(self.Title)
#         plt.grid()
#         if self.XLabel is not None:
#             plt.xlabel(self.XLabel)
#         if self.YLabel is not None:
#             plt.ylabel(self.YLabel)
#         if self.Legend is not None:
#             plt.legend(self.Legend, loc=self.LegendPos)
# 
#         if params.OutputDirectory is not None:
#             self.OutputDirectory = params.OutputDirectory
#         if (self.OutputDirectory is not None) and (self.FileName is not None):
#             fullname = os.path.join(self.OutputDirectory, self.FileName)
#             pprint('Saving File: {0} dpi={1}'.format(fullname, params.dpi))
#             plt.savefig(fullname, dpi=params.dpi)
#         plt.show()


from sfc_models.objects import *
from sfc_models.examples.Quick2DPlot import Quick2DPlot
        'alpha_fin': .3,
        'mu': '0.18761',
        'L0': '0.67',
        'L1': '6.',
        'L2': '.07',
    }
    build_country(model, paramz)
    generate_supply_allocation(model, 'N')
    generate_supply_allocation(model, 'S')
    # model.AddExogenous('N_GOV', 'DEM_GOOD', '[25.]*105')
    # model.AddExogenous('S_GOV', 'DEM_GOOD', '[25.]*105')
    model.AddExogenous('S_GOOD', 'MU', '[0.18761]*5 + [0.21] * 405')
    model.AddGlobalEquation('N_trade_balance', 'North trade balance',
                            'S_GOOD__SUP_N_BUS - N_GOOD__SUP_S_BUS')
    model.EquationSolver.MaxTime = 80
    model.EquationSolver.TraceStep = 5
    model.EquationSolver.ParameterSolveInitialSteadyState = True
    # model.EquationSolver.ParameterErrorTolerance = 1e-4
    return model


def main():
    register_standard_logs('output', __file__)
    mod = build_model()
    mod.main()
    k = mod.GetTimeSeries('k')
    gc = mod.GetTimeSeries('S_GOV__GOLDCOVER')
    g = mod.GetTimeSeries('S_GOV__DEM_GOOD')
    Yd = mod.GetTimeSeries('S_HH__AfterTax')
    N_Yd = mod.GetTimeSeries('N_HH__AfterTax')

# Path: sfc_models/examples/Quick2DPlot.py
# class Quick2DPlot(object):
#     def __init__(self, x, y, title='', run_now=True, output_directory=None, filename=None):
#         self.X = x
#         self.Y = y
#         self.Title = title
#         self.XLabel = None
#         self.YLabel = None
#         self.Legend = None
#         self.FileName = filename
#         self.LegendPos = 'best'
#         self.OutputDirectory = output_directory
#         if run_now:
#             self.DoPlot()
# 
#     def DoPlot(self):  # pragma: no cover
#         if plt is None:
#             pprint('Attempted to plot the following data; cannot to do because cannot import matplotlib')
#             if type(self.X[0]) == list:
#                 pprint('Series 1')
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X[0])):
#                     pprint('%f %20f' % (self.X[0][i], self.Y[0][i]))
#                 pprint('Series 2')
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X[1])):
#                     pprint('%f %20f' % (self.X[1][i], self.Y[1][i]))
#             else:
#                 pprint('%s %20s' % ('X', 'Y'))
#                 for i in range(0, len(self.X)):
#                     pprint('%f %20f' % (self.X[i], self.Y[i]))
#             return
#         if type(self.X[0]) == list:
#             fig, ax = plt.subplots()
#             ax.plot(self.X[0], self.Y[0], marker='o', markersize=4)
#             ax.plot(self.X[1], self.Y[1], marker='^', markersize=4.5)
#             # plt.plot(self.X[0], self.Y[0], self.X[1], self.Y[1], marker='o')
#         else:
#             plt.plot(self.X, self.Y, marker='o')
#         params = Quick2DPlotParams()
#         params.ReadFile()
#         plt.rcParams.update({'font.size': params.FontSize})
#         figure = plt.gcf()
#         figure.set_size_inches(4.5, 3)
#         if len(self.Title) > 0:
#             plt.title(self.Title)
#         plt.grid()
#         if self.XLabel is not None:
#             plt.xlabel(self.XLabel)
#         if self.YLabel is not None:
#             plt.ylabel(self.YLabel)
#         if self.Legend is not None:
#             plt.legend(self.Legend, loc=self.LegendPos)
# 
#         if params.OutputDirectory is not None:
#             self.OutputDirectory = params.OutputDirectory
#         if (self.OutputDirectory is not None) and (self.FileName is not None):
#             fullname = os.path.join(self.OutputDirectory, self.FileName)
#             pprint('Saving File: {0} dpi={1}'.format(fullname, params.dpi))
#             plt.savefig(fullname, dpi=params.dpi)
#         plt.show()


# Path: sfc_models/examples/scripts/intro_6_06_gold_standard_G.py
from sfc_models.objects import *
from sfc_models.examples.Quick2DPlot import Quick2DPlot

        'alpha_fin': .3,
        'mu': '0.18761',
        'L0': '0.67',
        'L1': '6.',
        'L2': '.07',
    }
    build_country(model, paramz)
    generate_supply_allocation(model, 'N')
    generate_supply_allocation(model, 'S')
    # model.AddExogenous('N_GOV', 'DEM_GOOD', '[25.]*105')
    # model.AddExogenous('S_GOV', 'DEM_GOOD', '[25.]*105')
    model.AddExogenous('S_GOOD', 'MU', '[0.18761]*5 + [0.21] * 405')
    model.AddGlobalEquation('N_trade_balance', 'North trade balance',
                            'S_GOOD__SUP_N_BUS - N_GOOD__SUP_S_BUS')
    model.EquationSolver.MaxTime = 80
    model.EquationSolver.TraceStep = 5
    model.EquationSolver.ParameterSolveInitialSteadyState = True
    # model.EquationSolver.ParameterErrorTolerance = 1e-4
    return model


def main():
    register_standard_logs('output', __file__)
    mod = build_model()
    mod.main()
    k = mod.GetTimeSeries('k')
    gc = mod.GetTimeSeries('S_GOV__GOLDCOVER')
    g = mod.GetTimeSeries('S_GOV__DEM_GOOD')
    Yd = mod.GetTimeSeries('S_HH__AfterTax')
    N_Yd = mod.GetTimeSeries('N_HH__AfterTax')

    Quick2DPlot(k,gc,'Southern Government Gold Cover', filename='intro_gold_cover.png')