Import('env')
import gslab_scons as gs
from os import path

ex_s  = env['CONFIG']['global']['source']['exampleplots']
plt_r = env['CONFIG']['global']['release']['plot']

source = ['#%s/exampledata.do' % ex_s]
target = ['#release/exampleplots/simulation_data_dynamic.dta',
          '#release/exampleplots/simulation_data_static.dta']
env.BuildStata(target = target,
               source = source,
               log_ext = 'exampleplots')

# ----------------------------------------------------------------------

source = ['#%s/illustrations.do' % ex_s] + target
target = ['#%s/exampleplots/value_label_jump_m.txt'   % plt_r,
          '#%s/exampleplots/value_coef_jump_m.txt'    % plt_r,
          '#%s/exampleplots/value_label_smooth_m.txt' % plt_r,
          '#%s/exampleplots/value_coef_smooth_m.txt'  % plt_r]

plots = [
    '#%s/exampleplots/multiple_paths_outcome'  % plt_r,
    '#%s/exampleplots/static_overlay'          % plt_r
]

for plot in plots:
    target += [plot + '.png', plot + '.eps']

plots = [
    '#%s/exampleplots/base_plot_'          % plt_r,
    '#%s/exampleplots/add_label_average_'  % plt_r,
    '#%s/exampleplots/add_supt_ci_'        % plt_r,
    '#%s/exampleplots/add_smoothest_line_' % plt_r,
    '#%s/exampleplots/add_pval_pretrend_'  % plt_r
]
for stub in ["smooth_m", "jump_m"]:
    for plot in plots:
        target += [plot + stub + '.png', plot + stub + '.eps']

plots = [
    '#%s/exampleplots/pval_noline_'             % plt_r,
    '#%s/exampleplots/trend_'                   % plt_r,
    '#%s/exampleplots/trend_extrapolation_'     % plt_r,
    '#%s/exampleplots/fhs_outcome_'             % plt_r,
    '#%s/exampleplots/fhs_proxy_'               % plt_r,
    '#%s/exampleplots/fhs_align_proxy_outcome_' % plt_r,
    '#%s/exampleplots/fhs_iv_'                  % plt_r
]

for stub in ["jump_m", "r"]:
    for plot in plots:
        target += [plot + stub + '.png', plot + stub + '.eps']

env.BuildStata(target = target,
               source = source,
               log_ext = 'exampleplots')
