예제 #1
0
def test_ss_profiles_save_fig(tmpdir):
    path = os.path.join(tmpdir, 'test_plot.png')
    output_plots.ss_profiles(base_ss,
                             base_params,
                             reform_ss,
                             reform_params,
                             path=path)
    img = mpimg.imread(path)

    assert isinstance(img, np.ndarray)
예제 #2
0
파일: functions.py 프로젝트: rkasher/OG-USA
def comp_output(base_ss, base_params, reform_ss, reform_params, var='nssmat'):
    '''
    Function to create output for the COMP platform
    '''
    fig = op.ss_profiles(
        base_ss,
        base_params,
        reform_ss=reform_ss,
        reform_params=reform_params,
        by_j=True,
        var=var,
        plot_title='Labor Supply in Baseline and Reform Policy')
    in_memory_file = io.BytesIO()
    fig.savefig(in_memory_file, format="png")
    in_memory_file.seek(0)
    comp_dict = {
        "renderable": [{
            "media_type": "PNG",
            "title": 'Labor Supply in Baseline and Reform Policy',
            "data": in_memory_file.read()
        }],
        "downloadable": []
    }

    return comp_dict
예제 #3
0
def test_ss_profiles(by_j, plot_data):
    fig = output_plots.ss_profiles(base_ss,
                                   base_params,
                                   reform_ss,
                                   reform_params,
                                   by_j=by_j,
                                   plot_data=plot_data,
                                   plot_title=' Test Plot Title')
    assert fig
예제 #4
0
def test_ss_profiles():
    fig = output_plots.ss_profiles(base_ss, base_params, reform_ss,
                                   reform_params)
    assert fig