File size: 2,062 Bytes
8a79f2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
###################
### ENVIRONMENT ###
###################
import git
import imp
import os

### SET DEFAULT PATHS
ROOT = '../..'

PATHS = {
    'root'             : ROOT,
    'lib'              : os.path.join(ROOT, 'lib'),
    'config'           : os.path.join(ROOT, 'config.yaml'),
    'config_user'      : os.path.join(ROOT, 'config_user.yaml'),
    'input_dir'        : 'input',
    'external_dir'     : 'external',
    'output_dir'       : 'output',
    'output_local_dir' : 'output_local',
    'makelog'          : 'log/make.log',
    'output_statslog'  : 'log/output_stats.log',
    'source_maplog'    : 'log/source_map.log',
    'source_statslog'  : 'log/source_stats.log',
}

### LOAD GSLAB MAKE
f, path, desc = imp.find_module('gslab_make', [PATHS['lib']])
gs = imp.load_module('gslab_make', f, path, desc)

### LOAD CONFIG USER
PATHS = gs.update_paths(PATHS)
gs.update_executables(PATHS)

############
### MAKE ###
############

### START MAKE
gs.remove_dir(['input', 'external'])
gs.clear_dir(['output', 'log', 'temp'])
gs.start_makelog(PATHS)

### GET INPUT FILES
inputs = gs.link_inputs(PATHS, ['input.txt'])
# gs.write_source_logs(PATHS, inputs + externals)
# gs.get_modified_sources(PATHS, inputs + externals)

### RUN SCRIPTS
"""
Critical
--------
Many of the Stata analysis scripts recode variables using
the `recode` command. Double-check all `recode` commands
to confirm recoding is correct, especially when reusing
code for a different experiment version.
"""

gs.run_stata(PATHS, program = 'code/Scalars.do')
#gs.run_stata(PATHS, program = 'code/SampleStatistics.do')
gs.run_stata(PATHS, program = 'code/DataDescriptives.do')
gs.run_stata(PATHS, program = 'code/QualitativeEvidence.do')
gs.run_stata(PATHS, program = 'code/CommitmentDemand.do')
gs.run_stata(PATHS, program = 'code/COVIDResponse.do')
gs.run_stata(PATHS, program = 'code/Temptation.do')

gs.run_r(PATHS,     program = 'code/HeatmapPlots.R')

### LOG OUTPUTS
gs.log_files_in_output(PATHS)

### CHECK FILE SIZES
#gs.check_module_size(PATHS)

### END MAKE
gs.end_makelog(PATHS)