Skip to content

Commit

Permalink
#21: Standardize formatting and rebuild template from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
Zong Huang committed Jun 6, 2019
1 parent d4e02d2 commit 0e95dc0
Show file tree
Hide file tree
Showing 31 changed files with 241 additions and 146 deletions.
14 changes: 7 additions & 7 deletions analysis/log/make.log
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
--------------------------------------------------------------------------------
Makelog started: 2019-05-08 12:19:30
Working directory: /Users/zong/template/analysis
Makelog started: 2019-06-06 15:09:33
Working directory: C:\Users\Zong\template\analysis
--------------------------------------------------------------------------------
Input links successfully created!
External links successfully created!
Source logs successfully written!
WARNING! The following target files have been modified according to git status:
/Users/zong/template/data/output/data_graph.csv
/Users/zong/template/data/output/data_table.csv
Executing command: `python "/Users/zong/template/analysis/code/descriptive.py" `
C:\Users\Zong\template\data\output\data_graph.csv
C:\Users\Zong\template\data\output\data_table.csv
Executing command: `python "C:\Users\Zong\template\analysis\code\descriptive.py" `
Output logs successfully written!
--------------------------------------------------------------------------------
Makelog ended: 2019-05-08 12:19:33
Working directory: /Users/zong/template/analysis
Makelog ended: 2019-06-06 15:09:36
Working directory: C:\Users\Zong\template\analysis
--------------------------------------------------------------------------------
8 changes: 4 additions & 4 deletions analysis/log/output_heads.log
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
File headers
--------------------------------------------------------------------------------
/Users/zong/template/analysis/output/plot.eps
C:\Users\Zong\template\analysis\output\plot.eps
--------------------------------------------------------------------------------
%!PS-Adobe-3.0 EPSF-3.0
%%Title: output/plot.eps
%%Creator: matplotlib version 2.2.3, http://matplotlib.org/
%%CreationDate: Wed May 8 12:19:32 2019
%%Creator: matplotlib version 2.0.2, http://matplotlib.org/
%%CreationDate: Thu Jun 6 15:09:35 2019
%%Orientation: portrait
%%BoundingBox: 75 223 536 568
%%EndComments
%%BeginProlog
/mpldict 8 dict def
mpldict begin
--------------------------------------------------------------------------------
/Users/zong/template/analysis/output/tables.txt
C:\Users\Zong\template\analysis\output\tables.txt
--------------------------------------------------------------------------------
<tab:table>
300001.0
Expand Down
6 changes: 3 additions & 3 deletions analysis/log/output_stats.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
file name last modified file size
/Users/zong/template/analysis/output/plot.eps 2019-05-08 19:19:32 13305
/Users/zong/template/analysis/output/tables.txt 2019-05-08 19:19:33 40
file name | last modified | file size
C:\Users\Zong\template\analysis\output\plot.eps | 2019-06-06 22:09:36 | 14084
C:\Users\Zong\template\analysis\output\tables.txt | 2019-06-06 22:09:36 | 44
4 changes: 2 additions & 2 deletions analysis/log/source_heads.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
File headers
--------------------------------------------------------------------------------
/Users/zong/template/data/output/data_graph.csv
C:\Users\Zong\template\data\output\data_graph.csv
--------------------------------------------------------------------------------
x
2
Expand All @@ -13,7 +13,7 @@ x
16
18
--------------------------------------------------------------------------------
/Users/zong/template/data/output/data_table.csv
C:\Users\Zong\template\data\output\data_table.csv
--------------------------------------------------------------------------------
"x"
2
Expand Down
4 changes: 2 additions & 2 deletions analysis/log/source_map.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
destination | source
input/data_table.csv | /Users/zong/template/data/output/data_table.csv
input/data_graph.csv | /Users/zong/template/data/output/data_graph.csv
input\data_table.csv | C:\Users\Zong\template\data\output\data_table.csv
input\data_graph.csv | C:\Users\Zong\template\data\output\data_graph.csv
6 changes: 3 additions & 3 deletions analysis/log/source_stats.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
file name last modified file size
/Users/zong/template/data/output/data_graph.csv 2019-05-08 19:17:55 2044452
/Users/zong/template/data/output/data_table.csv 2019-05-08 19:17:54 2044448
file name | last modified | file size
C:\Users\Zong\template\data\output\data_graph.csv | 2019-06-06 22:09:19 | 2344453
C:\Users\Zong\template\data\output\data_table.csv | 2019-06-06 22:09:16 | 2344449
7 changes: 3 additions & 4 deletions analysis/output/plot.eps

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 18 additions & 17 deletions data/log/make.log
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
--------------------------------------------------------------------------------
Makelog started: 2019-05-08 12:17:53
Working directory: /Users/zong/template/data
Makelog started: 2019-06-06 15:09:14
Working directory: C:\Users\Zong\template\data
--------------------------------------------------------------------------------
Input links successfully created!
External links successfully created!
Source logs successfully written!
Executing command: `Rscript --no-save "/Users/zong/template/data/code/create_table_data.r"`
Executing command: `Rscript --no-save "C:\Users\Zong\template\data\code\create_table_data.r"`
Warning message:
package 'yaml' was built under R version 3.5.2


___ ____ ____ ____ ____ (R)
/__ / ____/ / ____/
___/ / /___/ / /___/ 15.1 Copyright 1985-2017 StataCorp LLC
___/ / /___/ / /___/ 13.1 Copyright 1985-2013 StataCorp LP
Statistics/Data Analysis StataCorp
4905 Lakeway Drive
MP - Parallel Edition College Station, Texas 77845 USA
800-STATA-PC http://www.stata.com
979-696-4600 stata@stata.com
979-696-4601 (fax)

Unlimited-user 4-core Stata network license expires 21 Jul 2019:
Serial number: 501509201134
Licensed to: Zong Huang
Stanford University
3-user 8-core Stata network perpetual license:
Serial number: 501306208483
Licensed to: IDRE-UCLA
IDRE-UCLA

Notes:
1. Stata is running in batch mode.
2. Unicode is supported; see help unicode_advice.
3. More than 2 billion observations are allowed; see help obs_advice.
4. Maximum number of variables is set to 5000; see help set_maxvar.
1. (/v# option or -set maxvar-) 5000 maximum variables
2. Stata running in batch mode

. do "/Users/zong/template/data/code/create_graph_data.do"
. do "C:\Users\Zong\template\data\code\create_graph_data.do"

. clear all

Expand All @@ -44,8 +45,8 @@ Notes:
.
. * EXECUTE
. main
(1 var, 300,000 obs)
(300,000 real changes made)
(1 var, 300000 obs)
(300000 real changes made)
(note: file output/data_graph.csv not found)
file output/data_graph.csv saved

Expand All @@ -54,6 +55,6 @@ end of do-file

Output logs successfully written!
--------------------------------------------------------------------------------
Makelog ended: 2019-05-08 12:17:55
Working directory: /Users/zong/template/data
Makelog ended: 2019-06-06 15:09:18
Working directory: C:\Users\Zong\template\data
--------------------------------------------------------------------------------
8 changes: 4 additions & 4 deletions data/log/output_heads.log
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
File headers
--------------------------------------------------------------------------------
/Users/zong/template/data/output/data_graph.csv
C:\Users\Zong\template\data\output\data_table.csv
--------------------------------------------------------------------------------
x
"x"
2
4
6
Expand All @@ -13,9 +13,9 @@ x
16
18
--------------------------------------------------------------------------------
/Users/zong/template/data/output/data_table.csv
C:\Users\Zong\template\data\output\data_graph.csv
--------------------------------------------------------------------------------
"x"
x
2
4
6
Expand Down
6 changes: 3 additions & 3 deletions data/log/output_stats.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
file name last modified file size
/Users/zong/template/data/output/data_graph.csv 2019-05-08 19:17:55 2044452
/Users/zong/template/data/output/data_table.csv 2019-05-08 19:17:54 2044448
file name | last modified | file size
C:\Users\Zong\template\data\output\data_table.csv | 2019-06-06 22:09:16 | 2344449
C:\Users\Zong\template\data\output\data_graph.csv | 2019-06-06 22:09:19 | 2344453
2 changes: 1 addition & 1 deletion data/log/source_heads.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
File headers
--------------------------------------------------------------------------------
/Users/zong/template/raw/data.csv
C:\Users\Zong\template\raw\data.csv
--------------------------------------------------------------------------------
x
1
Expand Down
2 changes: 1 addition & 1 deletion data/log/source_map.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
destination | source
input/data.csv | /Users/zong/template/raw/data.csv
input\data.csv | C:\Users\Zong\template\raw\data.csv
4 changes: 2 additions & 2 deletions data/log/source_stats.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
file name last modified file size
/Users/zong/template/raw/data.csv 2019-05-07 19:45:55 1988897
file name | last modified | file size
C:\Users\Zong\template\raw\data.csv | 2019-05-09 23:44:32 | 1988897
4 changes: 2 additions & 2 deletions data/output/data_graph.csv
Git LFS file not shown
4 changes: 2 additions & 2 deletions data/output/data_table.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions lib/gslab_make/private/exceptionclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class CritError(Exception):
pass

class ColoredError(Exception):
""" Colorized error messages. """

def __init__(self, message, trace = ''):
message = '\n\n' + colored(message, color = 'red')
if trace:
Expand All @@ -20,4 +22,5 @@ def __init__(self, message, trace = ''):
super(ColoredError, self).__init__(message)

class ProgramError(ColoredError):
""" Program execution exception. """
pass
16 changes: 8 additions & 8 deletions lib/gslab_make/private/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)

######################################################
# Define Messages
######################################################
# ~~~~~~~~~~~~~~~ #
# Define messages #
# ~~~~~~~~~~~~~~~ #

# 1) Critical Errors
# Critical errors
crit_error_unknown_system = '\nERROR! `gslab_make` only supports the following operating systems: `POSIX`, `NT`.'
crit_error_no_makelog = '\nERROR! Makelog `%s` not found. Makelog either not started (via `start_makelog`) or deleted after started.'
crit_error_no_program_output = '\nERROR! Certain applications (`matlab`, `sas`, `stata`) automatically create program outputs when ran using system command. Program output `%s` is expected from `%s` but cannot be not found or opened. Traceback can be found below.'
Expand All @@ -23,15 +23,15 @@
crit_error_path_mapping = '\nERROR! `{%s}` found in linking/copying instructions but not in path mapping. Traceback can be found below.'
crit_error_no_repo = '\nERROR! Current working directory is not part of a git repository.'

# 2) Syntax Errors
# Syntax errors
syn_error_wildcard = '\nERROR! Destination and source must have same number of wildcards (`*`).'

# 3) Type errors
# Type errors
type_error_file_list = '\nERROR! Files `%s` must be specified in a list.'
type_error_dir_list = '\nERROR! Directories `%s` must be specified in a list.'
type_error_not_dir = '\nERROR! Path `%s` is not a directory.'

# 4) Warnings
# Warnings
warning_glob = 'WARNING! No files were returned by `glob_recursive` for path `%s` when walking to a depth of `%s`.'
warning_lyx_type = 'WARNING! Document type `%s` unrecognized. Reverting to default of no special document type.'
warning_modified_files = "WARNING! The following target files have been modified according to git status:\n%s"
Expand All @@ -42,7 +42,7 @@
warning_git_lfs_file_log = "\nWARNING! Certain files tracked by git lfs exceed config limit (%s MB). See below for list of files."
warning_git_lfs_repo = "\nWARNING! Total size of files tracked by git lfs exceed config limitt (%s MB)."

# 5) Notes
# Notes
note_makelog_start = 'Makelog started: '
note_makelog_end = 'Makelog ended: '
note_working_directory = 'Working directory: '
Expand Down
7 changes: 3 additions & 4 deletions lib/gslab_make/private/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)

######################################################
# Define metadata
######################################################
# ~~~~~~~~~~~~~~~ #
# Define metadata #
# ~~~~~~~~~~~~~~~ #

makelog_started = False

# Commands
commands = {
'posix':
{'makelink' : 'ln -s \"%s\" \"%s\"',
Expand Down
26 changes: 21 additions & 5 deletions lib/gslab_make/private/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,22 @@ def file_to_array(file_name):


def format_traceback(trace = ''):
""" Format error message. """
""" Format traceback message.
Parameters
----------
trace : str
Traceback to format. Defaults to `traceback.format_exc()`.
Notes
-----
Format trackback for readability to pass into user messages.
Returns
-------
formatted : str
Formatted traceback.
"""

if not trace:
trace = traceback.format_exc()
Expand Down Expand Up @@ -134,7 +149,7 @@ def format_list(list):
Notes
-----
Format list for readability to pass into user messages
Format list for readability to pass into user messages.
Returns
-------
Expand All @@ -147,9 +162,10 @@ def format_list(list):

return(formatted)


# Following functions are not currently actively used in code base

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# Following functions are not currently actively used in code base #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #

def check_duplicate(original, copy):
""" Check duplicate.
Expand Down
7 changes: 3 additions & 4 deletions paper_slides/input/plot.eps

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0e95dc0

Please sign in to comment.