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

sim_r = env['CONFIG']['global']['release_large']['simulation']
est_r = env['CONFIG']['global']['release_large']['estimation']
sim_s = env['CONFIG']['global']['source']['simulation']
est_s = env['CONFIG']['global']['source']['estimation']
lib   = env['CONFIG']['global']['source']['lib']
plt_r = env['CONFIG']['global']['release']['plot']

target = []
source = [
    '#%s/simulation.m'                      % sim_s,
    '#%s/GetSimulatedData.m'                % sim_s,
    '#%s/GetParams.m'                       % sim_s,
    '#%s/matlab/simulation/gen_data0.m'     % lib,
    '#%s/matlab/simulation/gen_f.m'         % lib,
    '#%s/matlab/simulation/gen_confound.m'  % lib,
    '#%s/matlab/simulation/gen_x.m'         % lib,
    '#%s/matlab/simulation/gen_z_stagger.m' % lib,
    '#%s/matlab/simulation/gen_y_cte.m'     % lib,
    '#%s/matlab/simulation/gen_y_hte.m'     % lib,
    '#%s/matlab/simulation/gen_b_hte.m'     % lib,
    '#%s/matlab/simulation/gen_headers.m'   % lib,
    '#%s/matlab/misc/loadparam.m'           % lib,
    '#%s/designs_main.csv'                  % lib
]

for design in env['designs_main']:
    source += ['#%s/designs/%s.txt' % (sim_s, design)]
    target += [
        '#%s/%s_ep0.csv'      % (sim_r, design),
        '#%s/%s.csv'          % (sim_r, design)
    ]

env.BuildMatlab(target = target,
                source = source,
                log_ext = 'simulation')

