mergeron 2024.739125.0__py3-none-any.whl → 2024.739125.2__py3-none-any.whl
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/__init__.py +1 -1
- mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tabularray.tex.jinja2 +81 -0
- mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.sty +129 -0
- mergeron/gen/enforcement_stats.py +40 -24
- {mergeron-2024.739125.0.dist-info → mergeron-2024.739125.2.dist-info}/METADATA +1 -1
- {mergeron-2024.739125.0.dist-info → mergeron-2024.739125.2.dist-info}/RECORD +8 -7
- mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +0 -96
- /mergeron/data/jinja2_LaTeX_templates/{ftcinvdata_summarypaired_table_template.tex.jinja2 → ftcinvdata_summarypaired_table_template_tikz.tex.jinja2} +0 -0
- {mergeron-2024.739125.0.dist-info → mergeron-2024.739125.2.dist-info}/WHEEL +0 -0
mergeron/__init__.py
CHANGED
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tabularray.tex.jinja2
ADDED
|
@@ -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:
|
|
@@ -224,13 +224,20 @@ ZONE_DETAIL_STRINGS_DELTA = {
|
|
|
224
224
|
4: Rf"ΔHHI ⩾ {HHI_DELTA_KNOTS[2]} pts.",
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
ZONE_STRINGS_LATEX_TIKZ = {
|
|
228
228
|
0: R"\node[align = left, fill=BrightGreen] {Green Zone (Safeharbor)};",
|
|
229
229
|
1: R"\node[align = left, fill=HiCoYellow] {Yellow Zone};",
|
|
230
230
|
2: R"\node[align = left, fill=VibrRed] {Red Zone (SLC Presumption)};",
|
|
231
231
|
fid.TTL_KEY: R"\node[align = left, fill=OBSHDRFill] {TOTAL};",
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
ZONE_STRINGS_LATEX_TBLR = {
|
|
235
|
+
0: R"\SetCell{l, bg=BrightGreen} {Green Zone (Safeharbor)}",
|
|
236
|
+
1: R"\SetCell{l, bg=HiCoYellow} {Yellow Zone}",
|
|
237
|
+
2: R"\SetCell{l, bg=VibrRed} {Red Zone (SLC Presumption)}",
|
|
238
|
+
fid.TTL_KEY: R"\SetCell{l, bg=OBSHDRFill} {TOTAL}",
|
|
239
|
+
}
|
|
240
|
+
|
|
234
241
|
ZONE_DETAIL_STRINGS_HHI_LATEX = {
|
|
235
242
|
0: Rf"HHI_{{post}} < \text{{{HHI_POST_ZONE_KNOTS[1]} pts.}}",
|
|
236
243
|
1: R"HHI_{{post}} \in \text{{[{}, {}) pts. and }} ".format(
|
|
@@ -248,7 +255,7 @@ ZONE_DETAIL_STRINGS_DELTA_LATEX = {
|
|
|
248
255
|
}
|
|
249
256
|
|
|
250
257
|
|
|
251
|
-
def
|
|
258
|
+
def enf_stats_obs(
|
|
252
259
|
_data_array_dict: fid.INVData,
|
|
253
260
|
_data_period: str = "1996-2003",
|
|
254
261
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -259,6 +266,7 @@ def enf_stats_output(
|
|
|
259
266
|
*,
|
|
260
267
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.RPT,
|
|
261
268
|
sort_order: SortSelector = SortSelector.UCH,
|
|
269
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
262
270
|
print_to_screen: bool = True,
|
|
263
271
|
) -> tuple[list[str], list[list[str]]]:
|
|
264
272
|
if _data_period not in _data_array_dict:
|
|
@@ -279,7 +287,7 @@ def enf_stats_output(
|
|
|
279
287
|
'Statistics formatted, "{_stats_group}" not available here.'
|
|
280
288
|
)
|
|
281
289
|
|
|
282
|
-
_enf_stats_cnts =
|
|
290
|
+
_enf_stats_cnts = enf_cnts_obs_by_group(
|
|
283
291
|
_data_array_dict,
|
|
284
292
|
_data_period,
|
|
285
293
|
_table_ind_group,
|
|
@@ -288,13 +296,12 @@ def enf_stats_output(
|
|
|
288
296
|
_enf_spec,
|
|
289
297
|
)
|
|
290
298
|
|
|
291
|
-
_print_format: Literal["text", "LaTeX"] = "text" if print_to_screen else "LaTeX"
|
|
292
299
|
_enf_stats_hdr_list, _enf_stats_dat_list = _enf_stats_table_func(
|
|
293
300
|
_enf_stats_cnts,
|
|
294
301
|
None,
|
|
295
302
|
return_type_sel=return_type_sel,
|
|
296
303
|
sort_order=sort_order,
|
|
297
|
-
print_format=
|
|
304
|
+
print_format=print_format,
|
|
298
305
|
)
|
|
299
306
|
|
|
300
307
|
if print_to_screen:
|
|
@@ -306,13 +313,13 @@ def enf_stats_output(
|
|
|
306
313
|
_table_evid_cond,
|
|
307
314
|
)
|
|
308
315
|
stats_print_rows(
|
|
309
|
-
_enf_stats_hdr_list, _enf_stats_dat_list, print_format=
|
|
316
|
+
_enf_stats_hdr_list, _enf_stats_dat_list, print_format=print_format
|
|
310
317
|
)
|
|
311
318
|
|
|
312
319
|
return _enf_stats_hdr_list, _enf_stats_dat_list
|
|
313
320
|
|
|
314
321
|
|
|
315
|
-
def
|
|
322
|
+
def enf_cnts_obs_by_group(
|
|
316
323
|
_invdata_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
317
324
|
_study_period: str,
|
|
318
325
|
_table_ind_grp: IndustryGroup,
|
|
@@ -329,13 +336,13 @@ def enf_stats_listing_by_group(
|
|
|
329
336
|
match _stats_group:
|
|
330
337
|
case StatsGrpSelector.FC:
|
|
331
338
|
_cnts_func = enf_cnts_byfirmcount
|
|
332
|
-
_cnts_listing_func =
|
|
339
|
+
_cnts_listing_func = enf_cnts_obs_byfirmcount
|
|
333
340
|
case StatsGrpSelector.DL:
|
|
334
341
|
_cnts_func = enf_cnts_bydelta
|
|
335
|
-
_cnts_listing_func =
|
|
342
|
+
_cnts_listing_func = enf_cnts_obs_byhhianddelta
|
|
336
343
|
case StatsGrpSelector.ZN:
|
|
337
344
|
_cnts_func = enf_cnts_byconczone
|
|
338
|
-
_cnts_listing_func =
|
|
345
|
+
_cnts_listing_func = enf_cnts_obs_byhhianddelta
|
|
339
346
|
|
|
340
347
|
return _cnts_func(
|
|
341
348
|
_cnts_listing_func(
|
|
@@ -348,7 +355,7 @@ def enf_stats_listing_by_group(
|
|
|
348
355
|
)
|
|
349
356
|
|
|
350
357
|
|
|
351
|
-
def
|
|
358
|
+
def enf_cnts_obs_byfirmcount(
|
|
352
359
|
_data_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
353
360
|
_data_period: str = "1996-2003",
|
|
354
361
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -384,7 +391,7 @@ def enf_cnts_listing_byfirmcount(
|
|
|
384
391
|
])
|
|
385
392
|
|
|
386
393
|
|
|
387
|
-
def
|
|
394
|
+
def enf_cnts_obs_byhhianddelta(
|
|
388
395
|
_data_array_dict: Mapping[str, Mapping[str, Mapping[str, fid.INVTableData]]],
|
|
389
396
|
_data_period: str = "1996-2003",
|
|
390
397
|
_table_ind_group: IndustryGroup = IndustryGroup.ALL,
|
|
@@ -546,7 +553,7 @@ def enf_stats_table_onedim(
|
|
|
546
553
|
*,
|
|
547
554
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
548
555
|
sort_order: SortSelector = SortSelector.UCH,
|
|
549
|
-
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
556
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
550
557
|
) -> tuple[list[str], list[list[str]]]:
|
|
551
558
|
_ndim_in: int = 1
|
|
552
559
|
_dim_hdr_dict = {_v: _k for _k, _v in fid.CNT_FCOUNT_DICT.items()} | {
|
|
@@ -579,7 +586,9 @@ def enf_stats_table_onedim(
|
|
|
579
586
|
for _stats_row in _inparr:
|
|
580
587
|
_stats_hdr_str = _dim_hdr_dict[_stats_row[0]]
|
|
581
588
|
_stats_hdr_list += [
|
|
582
|
-
f"{{{_stats_hdr_str}}}"
|
|
589
|
+
f"{{{_stats_hdr_str}}}"
|
|
590
|
+
if print_format in ("LaTeX", "LaTeX+TikZ")
|
|
591
|
+
else _stats_hdr_str
|
|
583
592
|
]
|
|
584
593
|
|
|
585
594
|
_stats_cnt = _stats_row[_ndim_in:]
|
|
@@ -599,11 +608,15 @@ def enf_stats_table_byzone(
|
|
|
599
608
|
*,
|
|
600
609
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
601
610
|
sort_order: SortSelector = SortSelector.UCH,
|
|
602
|
-
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
611
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "LaTeX",
|
|
603
612
|
) -> tuple[list[str], list[list[str]]]:
|
|
604
613
|
_ndim_in: int = ZONE_VALS.shape[1]
|
|
605
614
|
|
|
606
|
-
_zone_str_dict =
|
|
615
|
+
_zone_str_dict = (
|
|
616
|
+
ZONE_STRINGS_LATEX_TIKZ
|
|
617
|
+
if print_format == "LaTeX+TikZ"
|
|
618
|
+
else (ZONE_STRINGS_LATEX_TBLR if print_format == "LaTeX" else ZONE_STRINGS)
|
|
619
|
+
)
|
|
607
620
|
_zone_str_keys = list(_zone_str_dict)
|
|
608
621
|
|
|
609
622
|
if sort_order == SortSelector.REV:
|
|
@@ -637,17 +650,20 @@ def enf_stats_table_byzone(
|
|
|
637
650
|
for _stats_byzone_detail in _stats_byzone_it:
|
|
638
651
|
# Only two sets of subtotals detail, so
|
|
639
652
|
# a conditional expression will do here
|
|
640
|
-
if print_format
|
|
653
|
+
if print_format in ("LaTeX", "LaTeX+TikZ"):
|
|
641
654
|
_stats_text_color = "HiCoYellow" if _conc_zone == 1 else "BrightGreen"
|
|
642
655
|
_stats_hdr_list += [
|
|
643
|
-
R"{} {{\null\hfill \({}{}\) }}
|
|
644
|
-
rf"\node[text = {_stats_text_color}, fill = white, align = right]"
|
|
656
|
+
R"{} {{\null\hfill \({}{}\) }}{}".format(
|
|
657
|
+
rf"\node[text = {_stats_text_color}, fill = white, align = right]"
|
|
658
|
+
if print_format == "LaTeX+TikZ"
|
|
659
|
+
else rf"\SetCell{{r, fg={_stats_text_color}, bg=white}}",
|
|
645
660
|
ZONE_DETAIL_STRINGS_HHI_LATEX[_stats_byzone_detail[1]],
|
|
646
661
|
(
|
|
647
662
|
""
|
|
648
663
|
if _stats_byzone_detail[2] == 0
|
|
649
664
|
else Rf"{ZONE_DETAIL_STRINGS_DELTA_LATEX[_stats_byzone_detail[2]]}"
|
|
650
665
|
),
|
|
666
|
+
";" if print_format == "LaTeX+TikZ" else "",
|
|
651
667
|
)
|
|
652
668
|
]
|
|
653
669
|
else:
|
|
@@ -720,14 +736,14 @@ def stats_print_rows(
|
|
|
720
736
|
_enf_stats_dat_list: list[list[str]],
|
|
721
737
|
/,
|
|
722
738
|
*,
|
|
723
|
-
print_format: Literal["text", "LaTeX"] = "text",
|
|
739
|
+
print_format: Literal["text", "LaTeX", "LaTeX+TikZ"] = "text",
|
|
724
740
|
) -> None:
|
|
725
741
|
for _idx, _hdr in enumerate(_enf_stats_hdr_list):
|
|
726
|
-
if print_format
|
|
742
|
+
if print_format in ("LaTeX", "LaTeX+TikZ"):
|
|
727
743
|
_hdr_str = (
|
|
728
744
|
_hdr
|
|
729
745
|
if _hdr == "TOTAL"
|
|
730
|
-
else re.fullmatch(r"
|
|
746
|
+
else re.fullmatch(r".*\{.*\}\{(.*)\};?", _hdr)[1].strip()
|
|
731
747
|
)
|
|
732
748
|
print(
|
|
733
749
|
_hdr_str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.739125.
|
|
3
|
+
Version: 2024.739125.2
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
mergeron/License.txt,sha256=7iX-y0EyjkbVJKJLS4ZKzuuE1wd0lryfsD_IytLG8lQ,1246
|
|
2
|
-
mergeron/__init__.py,sha256=
|
|
2
|
+
mergeron/__init__.py,sha256=iUTbN1iDXI_kex3PMtER6uHcikh16GPW07gs7XaPQvk,1479
|
|
3
3
|
mergeron/core/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
|
|
4
4
|
mergeron/core/damodaran_margin_data.py,sha256=rMrgN1Qtw572a0ftY97OOj4otq8ldlLrcOi-bcE-org,8554
|
|
5
5
|
mergeron/core/ftc_merger_investigations_data.py,sha256=Q8d2N4brY2cwJClibwxOVfLE3WV0XZABssblGN6nOdA,28639
|
|
@@ -14,18 +14,19 @@ mergeron/data/ftc_invdata.msgpack,sha256=WBFHgi7Ld4R-h2zL2Zc3TOIlKqVrbVFMH1LoI4-
|
|
|
14
14
|
mergeron/data/jinja2_LaTeX_templates/clrrate_cis_summary_table_template.tex.jinja2,sha256=ae4JiciU-pt8YAM8mRbsmt4W6ePuN1y1NPCWD95oXIo,4833
|
|
15
15
|
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_byhhianddelta_table_template.tex.jinja2,sha256=ODEurkC0UHuWpjRUiQpeW85njSeUEUJYRdYg8gqoEq0,3642
|
|
16
16
|
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summary_table_template.tex.jinja2,sha256=h8_DEE0iskT9tnga5lZtxcoevN7pY4iKF-maErt4UU4,2906
|
|
17
|
-
mergeron/data/jinja2_LaTeX_templates/
|
|
17
|
+
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tabularray.tex.jinja2,sha256=t6dVIYpt82-3h_XL_c15I2HlkdqgtsrZImxbL6qHY-Q,2847
|
|
18
|
+
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template_tikz.tex.jinja2,sha256=OJuvD2urDh3M1HHGHf1Sz32iuMAN_Yb_ltt8ewX3f5c,5511
|
|
18
19
|
mergeron/data/jinja2_LaTeX_templates/mergeron.cls,sha256=aM2nx2GVQayZ8JPtD_OU4zjYlnddYx9k9WumN4WQc6g,4385
|
|
19
20
|
mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2,sha256=FQ1uEwQv2QlGJS1DqlJwh0nLZp5h8dRjoYfWzbq6uMc,2546
|
|
20
|
-
mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.
|
|
21
|
+
mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.sty,sha256=3KYNMDNWaMCN9HuCSayKHfZvWh3v6-rDy5M6n6zTe6k,4775
|
|
21
22
|
mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
|
|
22
23
|
mergeron/demo/visualize_empirical_margin_distribution.py,sha256=v1xFJumBX2Ooye82kSSgly-_GpFVkYSDqBwM__rcmZY,2363
|
|
23
24
|
mergeron/gen/__init__.py,sha256=0rfcWpKDhYE_jNsw6xKTGFJqgNtfJ-5JFxHS89CIEuI,16575
|
|
24
25
|
mergeron/gen/data_generation.py,sha256=ZwcVoAfqGTwVBL7PRil_A9kZU8DQK0eCHtsBFA1QElA,16773
|
|
25
26
|
mergeron/gen/data_generation_functions.py,sha256=bP3E0IPXINRc8s0dUxS_Wqo1byVzheZLX811A17WNbU,28571
|
|
26
|
-
mergeron/gen/enforcement_stats.py,sha256=
|
|
27
|
+
mergeron/gen/enforcement_stats.py,sha256=cOmjnXFU1vgOph1sqTobUGhpeZqnYIaSiuLb_ECfxVI,28587
|
|
27
28
|
mergeron/gen/upp_tests.py,sha256=yzEwWK1bVfjtBYMwXnL5uEWWRiR0_9y0wmjNMB-O3rU,12589
|
|
28
29
|
mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
29
|
-
mergeron-2024.739125.
|
|
30
|
-
mergeron-2024.739125.
|
|
31
|
-
mergeron-2024.739125.
|
|
30
|
+
mergeron-2024.739125.2.dist-info/METADATA,sha256=MDIz4Yi5ilvmv0mkx_52SL1m6YNuvWa1wSX-JmToI9U,13976
|
|
31
|
+
mergeron-2024.739125.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
32
|
+
mergeron-2024.739125.2.dist-info/RECORD,,
|
|
@@ -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
|