
Import('*')
import pandas as pd
import numpy as np

papers_repo = ['Reimers_Waldfogel_2021', 'Finkelstein_Gentzkow_Williams_2021',
               'Goodman-Bacon_2021', 'Abebe_Caria_Ortiz-Ospina_2021',
	           'Mueller_Spinnewijn_Topa_2021', 'Kostol_Myhre_2021',
               'Bailey_Sun_Timpe_2021', 'Seibold_2021', 'Dinerstein_Smith_2021',
               'Adermon_Lindahl_Palme_2021', 'Bourreau_Sun_Verboven_2021', 'Weaver_2021',
               'Braguinsky_Ohyama_Okazaki_Syverson_2021']
    
df_objects = pd.read_csv('../../../source/raw/bootstrap_census/source/raw/orig/objects_of_interest.csv')
df_objects = df_objects[np.invert((df_objects['can_produce_replicates'] != 'X').values ^ (df_objects['can_produce_replicates'] != 'N').values)]

bayes_papers = ['Braguinsky_Ohyama_Okazaki_Syverson_2021', 'Abebe_Caria_Ortiz-Ospina_2021', 'Mueller_Spinnewijn_Topa_2021']
df_index = pd.read_csv('../../../source/derived/bayes_bootstrap/infrm_index.csv')
indices = df_index['index'].unique()

target = ['#output/analysis/bayes_bootstrap/bayes_scatter.eps',
          '#output/analysis/bayes_bootstrap/bayes_scatter.png',
          '#output/analysis/bayes_bootstrap/bayes_scatter.csv']
source = ['#source/analysis/bayes_bootstrap/bayes_scatter.py',
          '#source/raw/bootstrap_census/source/raw/orig/objects_of_interest.csv',
          '#output/analysis/bootstrap_census/bootstrap_census.csv']

for paper in bayes_papers:
    source += [f'#output/derived/bayes_bootstrap/{paper}_Marginal.csv']
    indir = '#source/raw/bootstrap_census/output/derived'            
    source += [f'{indir}/{paper}_Replicates.csv']
env.Python(target, source)
