mergeron 2024.739125.0__tar.gz → 2024.739125.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mergeron might be problematic. Click here for more details.
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/PKG-INFO +1 -1
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/pyproject.toml +1 -1
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/__init__.py +1 -1
- mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tabularray.tex.jinja2 +81 -0
- mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.sty +129 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/enforcement_stats.py +44 -43
- mergeron-2024.739125.0/src/mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +0 -96
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/README.rst +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/License.txt +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/__init__.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/damodaran_margin_data.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/ftc_merger_investigations_data.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/guidelines_boundaries.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/guidelines_boundary_functions.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/guidelines_boundary_functions_extra.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/pseudorandom_numbers.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/__init__.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/damodaran_margin_data.xls +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/damodaran_margin_data_dict.msgpack +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/ftc_invdata.msgpack +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2 +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2 +0 -0
- /mergeron-2024.739125.0/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 → /mergeron-2024.739125.3/src/mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tikz.tex.jinja2 +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/jinja2_LaTeX_templates/mergeron.cls +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2 +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/demo/__init__.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/demo/visualize_empirical_margin_distribution.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/__init__.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/data_generation.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/data_generation_functions.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/upp_tests.py +0 -0
- {mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.739125.
|
|
3
|
+
Version: 2024.739125.3
|
|
4
4
|
Summary: Merger Policy Analysis using Python
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: merger policy analysis,merger guidelines,merger screening,policy presumptions,concentration standards,upward pricing pressure,GUPPI
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
\begin{table}[t]
|
|
2
|
+
|
|
3
|
+
((* if tmpl_data.obs_merger_class_0 == 'All Markets' *))
|
|
4
|
+
((* set obs_merger_class_0 = "All Markets" *))
|
|
5
|
+
((* else *))
|
|
6
|
+
((* set obs_merger_class_0 = "Markets with, ``" + tmpl_data.obs_merger_class_0 + "''" *))
|
|
7
|
+
((* endif *))
|
|
8
|
+
|
|
9
|
+
((* set obs_merger_class_1 = "Markets with, ``" + tmpl_data.obs_merger_class_1 + "''" *))
|
|
10
|
+
|
|
11
|
+
\centering
|
|
12
|
+
\caption{FTC Merger Investigations Data}\label{tbl:FTCInvData_\JINVAR{- tmpl_data.obs_summary_type }_alt}
|
|
13
|
+
{\footnotesize
|
|
14
|
+
\JINVAR{ tmpl_data.obs_summary_type_title } \\
|
|
15
|
+
Grouped by Entry Conditions and Reporting Period \\[0.5\baselineskip]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
\sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}}
|
|
19
|
+
\SetTblrInner{stretch=0, rowsep=3pt, colsep=3pt, hspan=even}
|
|
20
|
+
\begin{tikzpicture}[auto, font = \sffamily]
|
|
21
|
+
\begin{tblr}{
|
|
22
|
+
baseline=T,
|
|
23
|
+
width=\textwidth,
|
|
24
|
+
colspec = {%
|
|
25
|
+
Q[c,m,wd=\JINVAR{ tmpl_data.hdrcol_width }]%
|
|
26
|
+
Q[r,m]%
|
|
27
|
+
Q[r,m]%
|
|
28
|
+
Q[r,m]%
|
|
29
|
+
Q[r,m]%
|
|
30
|
+
Q[r,m]%
|
|
31
|
+
Q[r,m]%
|
|
32
|
+
Q[r,m]%
|
|
33
|
+
Q[r,m]%
|
|
34
|
+
},
|
|
35
|
+
row{odd[6]} = {bg=table_bar_green},
|
|
36
|
+
row{1-5} = {fg=white, bg=OBSHDRFill},
|
|
37
|
+
column{1} = {fg=white, bg=OBSHDRFill},
|
|
38
|
+
cell{1}{1} = {r=5, c=1}{c, f},
|
|
39
|
+
cell{1}{2} = {r=1, c=8}{c},
|
|
40
|
+
cell{2}{2,6} = {r=1, c=4}{c},
|
|
41
|
+
cell{3,4}{2,4,6,8} = {r=1, c=2}{c},
|
|
42
|
+
cell{5}{2-9} = {r, m, cmd=\rothead},
|
|
43
|
+
vline{4,8} = {3-5}{1pt, white},
|
|
44
|
+
vline{6} = {2-5}{1pt, white},
|
|
45
|
+
vline{4,6,8} = {6-Z}{1pt, OBSHDRFill},
|
|
46
|
+
hline{Y} = {1-Z}{1pt, OBSHDRFill},
|
|
47
|
+
}
|
|
48
|
+
{ \JINVAR{- tmpl_data.hdrcol_desc_text } } &
|
|
49
|
+
Observed Data & & & & & & & \\
|
|
50
|
+
sp0 &
|
|
51
|
+
\JINVAR{ obs_merger_class_0 } & sp0 & sp0 & sp0 &
|
|
52
|
+
\JINVAR{ obs_merger_class_1 } & sp0 & sp0 & sp0 \\
|
|
53
|
+
sp0 &
|
|
54
|
+
\JINVAR{ tmpl_data.obs_periods_str|replace(" & ", " & sp0 & ") } & sp0 &
|
|
55
|
+
\JINVAR{ tmpl_data.obs_periods_str|replace(" & ", " & sp0 & ") } & sp0 \\
|
|
56
|
+
sp0 &
|
|
57
|
+
\JINVAR{ tmpl_data.mkt_counts_str_class_0|replace(" & ", " & sp0 & ") } & sp0 &
|
|
58
|
+
\JINVAR{ tmpl_data.mkt_counts_str_class_0|replace(" & ", " & sp0 & ") } & sp0 \\
|
|
59
|
+
sp0 &
|
|
60
|
+
{Relative \\ Frequency} &
|
|
61
|
+
{Proportion \\ Enforced} &
|
|
62
|
+
{Relative \\ Frequency} &
|
|
63
|
+
{Proportion \\ Enforced} &
|
|
64
|
+
{Relative\\ Frequency} &
|
|
65
|
+
{Proportion \\ Enforced} &
|
|
66
|
+
{Relative \\ Frequency} &
|
|
67
|
+
{Proportion \\ Enforced} \\
|
|
68
|
+
%
|
|
69
|
+
\JINVAR{ tmpl_data.invdata_datstr -}
|
|
70
|
+
\end{tblr}
|
|
71
|
+
\end{tikzpicture}
|
|
72
|
+
|
|
73
|
+
\setlist{nosep}
|
|
74
|
+
\vspace{\baselineskip}
|
|
75
|
+
{\raggedright\sffamily\tiny
|
|
76
|
+
\JINVAR{ tmpl_data.invdata_notestr }
|
|
77
|
+
\vspace{\baselineskip}
|
|
78
|
+
\JINVAR{ tmpl_data.invdata_sourcestr }
|
|
79
|
+
}
|
|
80
|
+
\vspace{\baselineskip}
|
|
81
|
+
\end{table}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
% Tables in tikz, but first we need to define some colors for nonwhite text backgrounds
|
|
2
|
+
\definecolor{OBSHDRFill}{HTML}{0a6c97}
|
|
3
|
+
\definecolor{SIMHDRFill}{HTML}{646464}
|
|
4
|
+
\definecolor{DataFill}{HTML}{dfeadf}
|
|
5
|
+
% The below are definition's from Paul Tol's website, https://personal.sron.nl/~pault/
|
|
6
|
+
\definecolor{VibrBlue}{HTML}{0077bb}
|
|
7
|
+
\definecolor{BrightGreen}{HTML}{228833}
|
|
8
|
+
\definecolor{HiCoYellow}{HTML}{ddaa33}
|
|
9
|
+
\definecolor{VibrRed}{HTML}{cc3311}
|
|
10
|
+
|
|
11
|
+
%% Rotating text in a tabularray cell
|
|
12
|
+
%% https://tex.stackexchange.com/questions/101686/rotating-text-in-a-cell
|
|
13
|
+
%%https://tex.stackexchange.com/questions/464170/how-to-rotate-text-in-table
|
|
14
|
+
\usepackage{rotating}
|
|
15
|
+
\usepackage{makecell}
|
|
16
|
+
|
|
17
|
+
%% https://github.com/lvjr/tabularray/discussions/85#discussioncomment-3397197
|
|
18
|
+
\setlength\rotheadsize{1.5cm}
|
|
19
|
+
\renewcommand\theadfont{}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
\newcount\tnr
|
|
24
|
+
\newcount\tnc
|
|
25
|
+
% \makeatletter
|
|
26
|
+
% \tikzset{record matrix dimensions/.style={execute at end matrix={
|
|
27
|
+
% \global\tnc=\pgf@matrix@numberofcolumns
|
|
28
|
+
% \global\tnr=\pgfmatrixcurrentrow
|
|
29
|
+
% }}}
|
|
30
|
+
% \makeatother
|
|
31
|
+
|
|
32
|
+
% Some useful documents from grokking various options used below
|
|
33
|
+
% https://courses.helsinki.fi/sites/default/files/course-material/4611024/LaTeXandFriendsCourseInHelsinki_9_v2.pdf
|
|
34
|
+
% https://tug.org/TUGboat/tb39-1/tb121duck-tikz.pdf
|
|
35
|
+
% https://tug.org/TUGboat/tb41-1/tb127duck-matrix.pdf
|
|
36
|
+
% https://tex.stackexchange.com/questions/22286/coloring-every-other-row-of-a-table-with-vertical-lines
|
|
37
|
+
% https://tex.stackexchange.com/questions/354043/swot-matrix-with-multicolumn-and-multirow
|
|
38
|
+
% https://tex.stackexchange.com/questions/20599/horizontal-row-separation-line-in-tikz-matrix-like-hline-in-tabular
|
|
39
|
+
% https://tex.stackexchange.com/questions/63560/how-to-use-x-coordinate-of-a-point-and-y-coordinate-of-other-point
|
|
40
|
+
% https://tex.stackexchange.com/questions/167944/auto-word-wrapping-in-a-node-in-tikz
|
|
41
|
+
% https://tex.stackexchange.com/questions/132741/typewriter-in-tikz-node
|
|
42
|
+
\tikzset{
|
|
43
|
+
green_bar_filler/.code={
|
|
44
|
+
\pgfmathtruncatemacro{\itest}{ifthenelse(%
|
|
45
|
+
\pgfmatrixcurrentcolumn==1,0,%
|
|
46
|
+
ifthenelse(iseven(\pgfmatrixcurrentrow),1,3))}
|
|
47
|
+
%\typeout{\the\pgfmatrixcurrentcolumn,\pgfmatrixcurrentrow->\itest}
|
|
48
|
+
\ifcase\itest
|
|
49
|
+
\tikzset{fill=none}%
|
|
50
|
+
\or
|
|
51
|
+
\tikzset{fill=DataFill}%
|
|
52
|
+
\else
|
|
53
|
+
\tikzset{fill=white}%
|
|
54
|
+
\fi
|
|
55
|
+
},
|
|
56
|
+
get_matrix_dims/.code={
|
|
57
|
+
\global\tnc=\pgf@matrix@numberofcolumns
|
|
58
|
+
\global\tnr=\pgfmatrixcurrentrow
|
|
59
|
+
},
|
|
60
|
+
record matrix dimensions/.style={
|
|
61
|
+
execute at end matrix={get_matrix_dims},
|
|
62
|
+
% execute at end matrix={
|
|
63
|
+
% \global\tnc=\pgf@matrix@numberofcolumns
|
|
64
|
+
% \global\tnr=\pgfmatrixcurrentrow
|
|
65
|
+
% }
|
|
66
|
+
},
|
|
67
|
+
% If you only have numbers, text depth = 0ex; if text, text depth = 0.25ex, (may need tweaking for alignment across cells)
|
|
68
|
+
anytext/.style = {
|
|
69
|
+
font = \sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}},
|
|
70
|
+
align = center,
|
|
71
|
+
inner sep = 3pt,
|
|
72
|
+
text depth = 0pt,
|
|
73
|
+
},
|
|
74
|
+
hdrtext/.style = {
|
|
75
|
+
anytext,
|
|
76
|
+
text = white,
|
|
77
|
+
fill = OBSHDRFill,
|
|
78
|
+
},
|
|
79
|
+
notetext/.style = {
|
|
80
|
+
anytext,
|
|
81
|
+
font = \sffamily\tiny,
|
|
82
|
+
align = left,
|
|
83
|
+
},
|
|
84
|
+
anytable/.style = {
|
|
85
|
+
matrix of nodes,
|
|
86
|
+
nodes in empty cells,
|
|
87
|
+
column sep = -1.0\pgflinewidth,
|
|
88
|
+
row sep = -1.0\pgflinewidth,
|
|
89
|
+
inner sep = -0.25\pgflinewidth,
|
|
90
|
+
outer sep = -0.25\pgflinewidth,
|
|
91
|
+
nodes = {anchor = center, minimum height = 12.5pt,}
|
|
92
|
+
},
|
|
93
|
+
datatable/.style = {
|
|
94
|
+
anytable,
|
|
95
|
+
nodes = {
|
|
96
|
+
anytext,
|
|
97
|
+
align = right,
|
|
98
|
+
draw = none,
|
|
99
|
+
fill = none,
|
|
100
|
+
green_bar_filler,
|
|
101
|
+
},
|
|
102
|
+
% execute at end matrix={
|
|
103
|
+
% \global\tnc=\pgf@matrix@numberofcolumns
|
|
104
|
+
% \global\tnr=\pgfmatrixcurrentrow
|
|
105
|
+
% },
|
|
106
|
+
},
|
|
107
|
+
hdrtable/.style = {
|
|
108
|
+
anytable,
|
|
109
|
+
nodes = {
|
|
110
|
+
hdrtext,
|
|
111
|
+
draw = none,
|
|
112
|
+
fill = OBSHDRFill,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
hrow/.style = {
|
|
116
|
+
hdrtable,
|
|
117
|
+
nodes = {text width = 40pt,},
|
|
118
|
+
},
|
|
119
|
+
hcol/.style = {
|
|
120
|
+
hdrtable,
|
|
121
|
+
nodes = {text width = 60pt,},
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
% Define layers for later reference
|
|
125
|
+
% https://tex.stackexchange.com/questions/40840/put-a-node-behind-another-in-a-tikz-diagram
|
|
126
|
+
\pgfdeclarelayer{background}
|
|
127
|
+
\pgfsetlayers{background,main}
|
|
128
|
+
|
|
129
|
+
|
|
@@ -107,8 +107,8 @@ if not (_out_path := DATA_DIR.joinpath(f"{_PKG_NAME}.cls")).is_file():
|
|
|
107
107
|
shutil.move(_template_folder / _out_path.name, _out_path)
|
|
108
108
|
|
|
109
109
|
# Write to LaTeX table settings file
|
|
110
|
-
if not (_DOTTEX := DATA_DIR / Rf"{_PKG_NAME}_TikZTableSettings.
|
|
111
|
-
shutil.move(_template_folder / "setup_tikz_tables.
|
|
110
|
+
if not (_DOTTEX := DATA_DIR / Rf"{_PKG_NAME}_TikZTableSettings.sty").is_file():
|
|
111
|
+
shutil.move(_template_folder / "setup_tikz_tables.sty", _DOTTEX)
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
def create_jinja_env(_tmpl_folder: Path = _template_folder, /) -> Environment:
|
|
@@ -144,17 +144,6 @@ def create_jinja_env(_tmpl_folder: Path = _template_folder, /) -> Environment:
|
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
LTX_ARRAY_LINEEND = "\\\\\n"
|
|
147
|
-
LaTeX_hrdcoldesc_format_str = "{}\n{}\n{}".format(
|
|
148
|
-
"".join((
|
|
149
|
-
R"\matrix[hcol, above=0pt of {}, nodes = {{",
|
|
150
|
-
R"text width={}, text depth=10pt, inner sep=3pt, minimum height=25pt,",
|
|
151
|
-
R"}},] ",
|
|
152
|
-
R"({}) ",
|
|
153
|
-
R"{{",
|
|
154
|
-
)),
|
|
155
|
-
R"\node[align = {},] {{ {} }}; \\",
|
|
156
|
-
R"}};",
|
|
157
|
-
)
|
|
158
147
|
|
|
159
148
|
|
|
160
149
|
class StatsContainer(SimpleNamespace):
|
|
@@ -224,11 +213,18 @@ ZONE_DETAIL_STRINGS_DELTA = {
|
|
|
224
213
|
4: Rf"ΔHHI ⩾ {HHI_DELTA_KNOTS[2]} pts.",
|
|
225
214
|
}
|
|
226
215
|
|
|
227
|
-
|
|
228
|
-
0: R"\node[align
|
|
229
|
-
1: R"\node[align
|
|
230
|
-
2: R"\node[align
|
|
231
|
-
fid.TTL_KEY: R"\node[align
|
|
216
|
+
ZONE_STRINGS_LATEX_TIKZ = {
|
|
217
|
+
0: R"\node[align=left, fill=BrightGreen] {Green Zone (Safeharbor)};",
|
|
218
|
+
1: R"\node[align=left, fill=HiCoYellow] {Yellow Zone};",
|
|
219
|
+
2: R"\node[align=left, fill=VibrRed] {Red Zone (SLC Presumption)};",
|
|
220
|
+
fid.TTL_KEY: R"\node[align=left, fill=OBSHDRFill] {TOTAL};",
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
ZONE_STRINGS_LATEX_TBLR = {
|
|
224
|
+
0: R"\SetCell{l, bg=BrightGreen} {Green Zone (Safeharbor)}",
|
|
225
|
+
1: R"\SetCell{l, bg=HiCoYellow} {Yellow Zone}",
|
|
226
|
+
2: R"\SetCell{l, bg=VibrRed} {Red Zone (SLC Presumption)}",
|
|
227
|
+
fid.TTL_KEY: R"\SetCell{l, bg=OBSHDRFill} {TOTAL}",
|
|
232
228
|
}
|
|
233
229
|
|
|
234
230
|
ZONE_DETAIL_STRINGS_HHI_LATEX = {
|
|
@@ -248,7 +244,7 @@ ZONE_DETAIL_STRINGS_DELTA_LATEX = {
|
|
|
248
244
|
}
|
|
249
245
|
|
|
250
246
|
|
|
251
|
-
def
|
|
247
|
+
def enf_stats_obs(
|
|
252
248
|
_data_array_dict: fid.INVData,
|
|
253
249
|
_data_period: str = "1996-2003",
|
|
254
250
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -259,6 +255,7 @@ def enf_stats_output(
|
|
|
259
255
|
*,
|
|
260
256
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.RPT,
|
|
261
257
|
sort_order: SortSelector = SortSelector.UCH,
|
|
258
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
262
259
|
print_to_screen: bool = True,
|
|
263
260
|
) -> tuple[list[str], list[list[str]]]:
|
|
264
261
|
if _data_period not in _data_array_dict:
|
|
@@ -279,7 +276,7 @@ def enf_stats_output(
|
|
|
279
276
|
'Statistics formatted, "{_stats_group}" not available here.'
|
|
280
277
|
)
|
|
281
278
|
|
|
282
|
-
_enf_stats_cnts =
|
|
279
|
+
_enf_stats_cnts = enf_cnts_obs_by_group(
|
|
283
280
|
_data_array_dict,
|
|
284
281
|
_data_period,
|
|
285
282
|
_table_ind_group,
|
|
@@ -288,13 +285,12 @@ def enf_stats_output(
|
|
|
288
285
|
_enf_spec,
|
|
289
286
|
)
|
|
290
287
|
|
|
291
|
-
_print_format: Literal["text", "LaTeX"] = "text" if print_to_screen else "LaTeX"
|
|
292
288
|
_enf_stats_hdr_list, _enf_stats_dat_list = _enf_stats_table_func(
|
|
293
289
|
_enf_stats_cnts,
|
|
294
290
|
None,
|
|
295
291
|
return_type_sel=return_type_sel,
|
|
296
292
|
sort_order=sort_order,
|
|
297
|
-
print_format=
|
|
293
|
+
print_format=print_format,
|
|
298
294
|
)
|
|
299
295
|
|
|
300
296
|
if print_to_screen:
|
|
@@ -306,13 +302,13 @@ def enf_stats_output(
|
|
|
306
302
|
_table_evid_cond,
|
|
307
303
|
)
|
|
308
304
|
stats_print_rows(
|
|
309
|
-
_enf_stats_hdr_list, _enf_stats_dat_list, print_format=
|
|
305
|
+
_enf_stats_hdr_list, _enf_stats_dat_list, print_format=print_format
|
|
310
306
|
)
|
|
311
307
|
|
|
312
308
|
return _enf_stats_hdr_list, _enf_stats_dat_list
|
|
313
309
|
|
|
314
310
|
|
|
315
|
-
def
|
|
311
|
+
def enf_cnts_obs_by_group(
|
|
316
312
|
_invdata_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
317
313
|
_study_period: str,
|
|
318
314
|
_table_ind_grp: IndustryGroup,
|
|
@@ -329,13 +325,13 @@ def enf_stats_listing_by_group(
|
|
|
329
325
|
match _stats_group:
|
|
330
326
|
case StatsGrpSelector.FC:
|
|
331
327
|
_cnts_func = enf_cnts_byfirmcount
|
|
332
|
-
_cnts_listing_func =
|
|
328
|
+
_cnts_listing_func = enf_cnts_obs_byfirmcount
|
|
333
329
|
case StatsGrpSelector.DL:
|
|
334
330
|
_cnts_func = enf_cnts_bydelta
|
|
335
|
-
_cnts_listing_func =
|
|
331
|
+
_cnts_listing_func = enf_cnts_obs_byhhianddelta
|
|
336
332
|
case StatsGrpSelector.ZN:
|
|
337
333
|
_cnts_func = enf_cnts_byconczone
|
|
338
|
-
_cnts_listing_func =
|
|
334
|
+
_cnts_listing_func = enf_cnts_obs_byhhianddelta
|
|
339
335
|
|
|
340
336
|
return _cnts_func(
|
|
341
337
|
_cnts_listing_func(
|
|
@@ -348,7 +344,7 @@ def enf_stats_listing_by_group(
|
|
|
348
344
|
)
|
|
349
345
|
|
|
350
346
|
|
|
351
|
-
def
|
|
347
|
+
def enf_cnts_obs_byfirmcount(
|
|
352
348
|
_data_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
353
349
|
_data_period: str = "1996-2003",
|
|
354
350
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -384,7 +380,7 @@ def enf_cnts_listing_byfirmcount(
|
|
|
384
380
|
])
|
|
385
381
|
|
|
386
382
|
|
|
387
|
-
def
|
|
383
|
+
def enf_cnts_obs_byhhianddelta(
|
|
388
384
|
_data_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
389
385
|
_data_period: str = "1996-2003",
|
|
390
386
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -546,7 +542,7 @@ def enf_stats_table_onedim(
|
|
|
546
542
|
*,
|
|
547
543
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
548
544
|
sort_order: SortSelector = SortSelector.UCH,
|
|
549
|
-
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
545
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
550
546
|
) -> tuple[list[str], list[list[str]]]:
|
|
551
547
|
_ndim_in: int = 1
|
|
552
548
|
_dim_hdr_dict = {_v: _k for _k, _v in fid.CNT_FCOUNT_DICT.items()} | {
|
|
@@ -579,7 +575,9 @@ def enf_stats_table_onedim(
|
|
|
579
575
|
for _stats_row in _inparr:
|
|
580
576
|
_stats_hdr_str = _dim_hdr_dict[_stats_row[0]]
|
|
581
577
|
_stats_hdr_list += [
|
|
582
|
-
f"{{{_stats_hdr_str}}}"
|
|
578
|
+
f"{{{_stats_hdr_str}}}"
|
|
579
|
+
if print_format in ("LaTeX", "LaTeX+TikZ")
|
|
580
|
+
else _stats_hdr_str
|
|
583
581
|
]
|
|
584
582
|
|
|
585
583
|
_stats_cnt = _stats_row[_ndim_in:]
|
|
@@ -599,11 +597,15 @@ def enf_stats_table_byzone(
|
|
|
599
597
|
*,
|
|
600
598
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
601
599
|
sort_order: SortSelector = SortSelector.UCH,
|
|
602
|
-
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
600
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
603
601
|
) -> tuple[list[str], list[list[str]]]:
|
|
604
602
|
_ndim_in: int = ZONE_VALS.shape[1]
|
|
605
603
|
|
|
606
|
-
_zone_str_dict =
|
|
604
|
+
_zone_str_dict = (
|
|
605
|
+
ZONE_STRINGS_LATEX_TIKZ
|
|
606
|
+
if print_format == "LaTeX+TikZ"
|
|
607
|
+
else (ZONE_STRINGS_LATEX_TBLR if print_format == "LaTeX" else ZONE_STRINGS)
|
|
608
|
+
)
|
|
607
609
|
_zone_str_keys = list(_zone_str_dict)
|
|
608
610
|
|
|
609
611
|
if sort_order == SortSelector.REV:
|
|
@@ -637,17 +639,20 @@ def enf_stats_table_byzone(
|
|
|
637
639
|
for _stats_byzone_detail in _stats_byzone_it:
|
|
638
640
|
# Only two sets of subtotals detail, so
|
|
639
641
|
# a conditional expression will do here
|
|
640
|
-
if print_format
|
|
642
|
+
if print_format in ("LaTeX", "LaTeX+TikZ"):
|
|
641
643
|
_stats_text_color = "HiCoYellow" if _conc_zone == 1 else "BrightGreen"
|
|
642
644
|
_stats_hdr_list += [
|
|
643
|
-
R"{} {{\null\hfill \({}{}\) }}
|
|
644
|
-
rf"\node[text
|
|
645
|
+
R"{} {{\null\hfill \({}{}\) }}{}".format(
|
|
646
|
+
rf"\node[text={_stats_text_color}, fill=white, align=right]"
|
|
647
|
+
if print_format == "LaTeX+TikZ"
|
|
648
|
+
else rf"\SetCell{{r, fg={_stats_text_color}, bg=white}}",
|
|
645
649
|
ZONE_DETAIL_STRINGS_HHI_LATEX[_stats_byzone_detail[1]],
|
|
646
650
|
(
|
|
647
651
|
""
|
|
648
652
|
if _stats_byzone_detail[2] == 0
|
|
649
653
|
else Rf"{ZONE_DETAIL_STRINGS_DELTA_LATEX[_stats_byzone_detail[2]]}"
|
|
650
654
|
),
|
|
655
|
+
";" if print_format == "LaTeX+TikZ" else "",
|
|
651
656
|
)
|
|
652
657
|
]
|
|
653
658
|
else:
|
|
@@ -720,15 +725,11 @@ def stats_print_rows(
|
|
|
720
725
|
_enf_stats_dat_list: list[list[str]],
|
|
721
726
|
/,
|
|
722
727
|
*,
|
|
723
|
-
print_format: Literal["text", "LaTeX"] = "text",
|
|
728
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "text",
|
|
724
729
|
) -> None:
|
|
725
730
|
for _idx, _hdr in enumerate(_enf_stats_hdr_list):
|
|
726
|
-
if print_format
|
|
727
|
-
_hdr_str = (
|
|
728
|
-
_hdr
|
|
729
|
-
if _hdr == "TOTAL"
|
|
730
|
-
else re.fullmatch(r".*?\{(.*)\};?", _hdr)[1].strip()
|
|
731
|
-
)
|
|
731
|
+
if print_format in ("LaTeX", "LaTeX+TikZ"):
|
|
732
|
+
_hdr_str = re.search(r" \{(.*?)\};?\z", _hdr)[-1].strip()
|
|
732
733
|
print(
|
|
733
734
|
_hdr_str,
|
|
734
735
|
" & ",
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
% Tables in tikz, but first we need to define some colors for nonwhite text backgrounds
|
|
2
|
-
\definecolor{OBSHDRFill}{HTML}{0a6c97}
|
|
3
|
-
\definecolor{SIMHDRFill}{HTML}{646464}
|
|
4
|
-
\definecolor{DataFill}{HTML}{dfeadf}
|
|
5
|
-
% The below are definition's from Paul Tol's website, https://personal.sron.nl/~pault/
|
|
6
|
-
\definecolor{VibrBlue}{HTML}{0077bb}
|
|
7
|
-
\definecolor{BrightGreen}{HTML}{228833}
|
|
8
|
-
\definecolor{HiCoYellow}{HTML}{ddaa33}
|
|
9
|
-
\definecolor{VibrRed}{HTML}{cc3311}
|
|
10
|
-
% Some useful documents from grokking various options used below
|
|
11
|
-
% https://courses.helsinki.fi/sites/default/files/course-material/4611024/LaTeXandFriendsCourseInHelsinki_9_v2.pdf
|
|
12
|
-
% https://tug.org/TUGboat/tb39-1/tb121duck-tikz.pdf
|
|
13
|
-
% https://tug.org/TUGboat/tb41-1/tb127duck-matrix.pdf
|
|
14
|
-
% https://tex.stackexchange.com/questions/22286/coloring-every-other-row-of-a-table-with-vertical-lines
|
|
15
|
-
% https://tex.stackexchange.com/questions/354043/swot-matrix-with-multicolumn-and-multirow
|
|
16
|
-
% https://tex.stackexchange.com/questions/20599/horizontal-row-separation-line-in-tikz-matrix-like-hline-in-tabular
|
|
17
|
-
% https://tex.stackexchange.com/questions/63560/how-to-use-x-coordinate-of-a-point-and-y-coordinate-of-other-point
|
|
18
|
-
% https://tex.stackexchange.com/questions/167944/auto-word-wrapping-in-a-node-in-tikz
|
|
19
|
-
% https://tex.stackexchange.com/questions/132741/typewriter-in-tikz-node
|
|
20
|
-
\tikzset{
|
|
21
|
-
green_bar_filler/.code={%
|
|
22
|
-
\pgfmathtruncatemacro{\itest}{ifthenelse(%
|
|
23
|
-
\pgfmatrixcurrentcolumn==1,0,%
|
|
24
|
-
ifthenelse(iseven(\pgfmatrixcurrentrow),1,3))}
|
|
25
|
-
%\typeout{\the\pgfmatrixcurrentcolumn,\pgfmatrixcurrentrow->\itest}
|
|
26
|
-
\ifcase\itest
|
|
27
|
-
\tikzset{fill=none}%
|
|
28
|
-
\or
|
|
29
|
-
\tikzset{fill=DataFill}%
|
|
30
|
-
\else
|
|
31
|
-
\tikzset{fill=white}%
|
|
32
|
-
\fi
|
|
33
|
-
},
|
|
34
|
-
get matrix dims/.code={
|
|
35
|
-
\global\tnc=\pgf@matrix@numberofcolumns
|
|
36
|
-
\global\tnr=\pgfmatrixcurrentrow
|
|
37
|
-
},
|
|
38
|
-
% If you only have numbers, text depth = 0ex; if text, text depth = 0.25ex, (may need tweaking for alignment across cells)
|
|
39
|
-
anytext/.style = {
|
|
40
|
-
font = \sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}},
|
|
41
|
-
align = center,
|
|
42
|
-
inner sep = 3pt,
|
|
43
|
-
text depth = 0pt,
|
|
44
|
-
},
|
|
45
|
-
hdrtext/.style = {
|
|
46
|
-
anytext,
|
|
47
|
-
text = white,
|
|
48
|
-
fill = OBSHDRFill,
|
|
49
|
-
},
|
|
50
|
-
notetext/.style = {
|
|
51
|
-
anytext,
|
|
52
|
-
font = \sffamily\tiny,
|
|
53
|
-
align = left,
|
|
54
|
-
},
|
|
55
|
-
anytable/.style = {
|
|
56
|
-
matrix of nodes,
|
|
57
|
-
nodes in empty cells,
|
|
58
|
-
column sep = -1.0\pgflinewidth,
|
|
59
|
-
row sep = -1.0\pgflinewidth,
|
|
60
|
-
inner sep = -0.25\pgflinewidth,
|
|
61
|
-
outer sep = -0.25\pgflinewidth,
|
|
62
|
-
nodes = {anchor = center, minimum height = 12.5pt,}
|
|
63
|
-
},
|
|
64
|
-
datatable/.style = {
|
|
65
|
-
anytable,
|
|
66
|
-
nodes = {
|
|
67
|
-
anytext,
|
|
68
|
-
align = right,
|
|
69
|
-
draw = none,
|
|
70
|
-
fill = none,
|
|
71
|
-
green_bar_filler,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
hdrtable/.style = {
|
|
75
|
-
anytable,
|
|
76
|
-
nodes = {
|
|
77
|
-
hdrtext,
|
|
78
|
-
draw = none,
|
|
79
|
-
fill = OBSHDRFill,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
hrow/.style = {
|
|
83
|
-
hdrtable,
|
|
84
|
-
nodes = {text width = 40pt,},
|
|
85
|
-
},
|
|
86
|
-
hcol/.style = {
|
|
87
|
-
hdrtable,
|
|
88
|
-
nodes = {text width = 60pt,},
|
|
89
|
-
},
|
|
90
|
-
}
|
|
91
|
-
% Define layers for later reference
|
|
92
|
-
% https://tex.stackexchange.com/questions/40840/put-a-node-behind-another-in-a-tikz-diagram
|
|
93
|
-
\pgfdeclarelayer{background}
|
|
94
|
-
\pgfsetlayers{background,main}
|
|
95
|
-
|
|
96
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/damodaran_margin_data.py
RENAMED
|
File without changes
|
|
File without changes
|
{mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/guidelines_boundaries.py
RENAMED
|
File without changes
|
{mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/core/guidelines_boundary_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/data/damodaran_margin_data.xls
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mergeron-2024.739125.0 → mergeron-2024.739125.3}/src/mergeron/gen/data_generation_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|