mergeron 2024.739123.2__py3-none-any.whl → 2024.739125.0__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/core/ftc_merger_investigations_data.py +37 -27
- mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2 +35 -23
- mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex +5 -4
- mergeron/gen/enforcement_stats.py +118 -94
- {mergeron-2024.739123.2.dist-info → mergeron-2024.739125.0.dist-info}/METADATA +1 -1
- {mergeron-2024.739123.2.dist-info → mergeron-2024.739125.0.dist-info}/RECORD +8 -8
- {mergeron-2024.739123.2.dist-info → mergeron-2024.739125.0.dist-info}/WHEEL +0 -0
mergeron/__init__.py
CHANGED
|
@@ -95,7 +95,7 @@ class INVTableData(NamedTuple):
|
|
|
95
95
|
data_array: ArrayBIGINT
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
INVData: TypeAlias = Mapping[str,
|
|
98
|
+
INVData: TypeAlias = Mapping[str, Mapping[str, Mapping[str, INVTableData]]]
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def construct_data(
|
|
@@ -165,7 +165,7 @@ def construct_data(
|
|
|
165
165
|
|
|
166
166
|
# Create data for industries with no evidence on entry
|
|
167
167
|
for _data_period in _invdata:
|
|
168
|
-
|
|
168
|
+
_construct_no_evidence_data(_invdata, _data_period)
|
|
169
169
|
|
|
170
170
|
# Create a list of exclusions to named industries in the base period,
|
|
171
171
|
# for construction of aggregate enforcement statistics where feasible
|
|
@@ -202,37 +202,47 @@ def construct_data(
|
|
|
202
202
|
return MappingProxyType(_invdata)
|
|
203
203
|
|
|
204
204
|
|
|
205
|
-
def
|
|
205
|
+
def _construct_no_evidence_data(_invdata: INVData, _data_period: str, /) -> None:
|
|
206
206
|
_invdata_ind_grp = "All Markets"
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_invdata_sub_evid_cond_conc = _invdata[_data_period]["ByHHIandDelta"]
|
|
210
|
-
_invdata_sub_evid_cond_conc["Table 9.X"] = INVTableData(
|
|
211
|
-
_invdata_ind_grp,
|
|
212
|
-
_invdata_evid_cond,
|
|
213
|
-
np.column_stack((
|
|
214
|
-
_invdata_sub_evid_cond_conc["Table 3.1"].data_array[:, :2],
|
|
207
|
+
_table_nos_map = dict(
|
|
208
|
+
zip(
|
|
215
209
|
(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
"No Entry Evidence",
|
|
211
|
+
"No Evidence on Customer Complaints",
|
|
212
|
+
"No Evidence on Hot Documents",
|
|
219
213
|
),
|
|
220
|
-
)),
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
_invdata_sub_evid_cond_fcount = _invdata[_data_period]["ByFirmCount"]
|
|
224
|
-
_invdata_sub_evid_cond_fcount["Table 10.X"] = INVTableData(
|
|
225
|
-
_invdata_ind_grp,
|
|
226
|
-
_invdata_evid_cond,
|
|
227
|
-
np.column_stack((
|
|
228
|
-
_invdata_sub_evid_cond_fcount["Table 4.1"].data_array[:, :1],
|
|
229
214
|
(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
215
|
+
{"ByHHIandDelta": "Table 9.X", "ByFirmCount": "Table 10.X"},
|
|
216
|
+
{"ByHHIandDelta": "Table 7.X", "ByFirmCount": "Table 8.X"},
|
|
217
|
+
{"ByHHIandDelta": "Table 5.X", "ByFirmCount": "Table 6.X"},
|
|
233
218
|
),
|
|
234
|
-
|
|
219
|
+
strict=True,
|
|
220
|
+
)
|
|
235
221
|
)
|
|
222
|
+
for _invdata_evid_cond in (
|
|
223
|
+
"No Entry Evidence",
|
|
224
|
+
"No Evidence on Customer Complaints",
|
|
225
|
+
"No Evidence on Hot Documents",
|
|
226
|
+
):
|
|
227
|
+
for _stats_grp in ("ByHHIandDelta", "ByFirmCount"):
|
|
228
|
+
_invdata_sub_evid_cond_conc = _invdata[_data_period][_stats_grp]
|
|
229
|
+
|
|
230
|
+
_dtn = _table_nos_map[_invdata_evid_cond]["ByHHIandDelta"]
|
|
231
|
+
_stn0 = "Table 4.1" if _stats_grp == "ByFirmCount" else "Table 3.1"
|
|
232
|
+
_stn1, _stn2 = (_dtn.replace(".X", f".{_i}") for _i in ("1", "2"))
|
|
233
|
+
|
|
234
|
+
_invdata_sub_evid_cond_conc[_dtn] = INVTableData(
|
|
235
|
+
_invdata_ind_grp,
|
|
236
|
+
_invdata_evid_cond,
|
|
237
|
+
np.column_stack((
|
|
238
|
+
_invdata_sub_evid_cond_conc[_stn0].data_array[:, :2],
|
|
239
|
+
(
|
|
240
|
+
_invdata_sub_evid_cond_conc[_stn0].data_array[:, 2:]
|
|
241
|
+
- _invdata_sub_evid_cond_conc[_stn1].data_array[:, 2:]
|
|
242
|
+
- _invdata_sub_evid_cond_conc[_stn2].data_array[:, 2:]
|
|
243
|
+
),
|
|
244
|
+
)),
|
|
245
|
+
)
|
|
236
246
|
|
|
237
247
|
|
|
238
248
|
def _construct_new_period_data(
|
|
@@ -14,32 +14,44 @@
|
|
|
14
14
|
((* set obs_merger_class_0 = "Markets with, ``" + tmpl_data.obs_merger_class_0 + "''" *))
|
|
15
15
|
((* endif *))
|
|
16
16
|
|
|
17
|
+
((* if tmpl_data.obs_summary_type == 'ByConcZone' *))
|
|
18
|
+
((* set hdrcol_align = "left" *))
|
|
19
|
+
((* else *))
|
|
20
|
+
((* set hdrcol_align = "center" *))
|
|
21
|
+
((* endif *))
|
|
22
|
+
|
|
17
23
|
((* set obs_merger_class_1 = "Markets with, ``" + tmpl_data.obs_merger_class_1 + "''" *))
|
|
18
24
|
|
|
25
|
+
|
|
26
|
+
|
|
19
27
|
\centering
|
|
20
|
-
\caption{FTC Merger Investigations Data}\label{tbl:FTCInvData_\JINVAR{- obs_summary_type }}
|
|
21
|
-
{\footnotesize
|
|
22
|
-
|
|
28
|
+
\caption{FTC Merger Investigations Data}\label{tbl:FTCInvData_\JINVAR{- tmpl_data.obs_summary_type }}
|
|
29
|
+
{\footnotesize
|
|
30
|
+
\JINVAR{ tmpl_data.obs_summary_type_title } \\
|
|
31
|
+
Grouped by Entry Conditions and Reporting Period \\[0.5\baselineskip]
|
|
32
|
+
}
|
|
23
33
|
\begin{tikzpicture}[auto, font = \sffamily]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
\matrix[
|
|
35
|
+
datatable,
|
|
36
|
+
nodes = {text width = 27pt,},
|
|
37
|
+
column 1/.style = {nodes = {
|
|
38
|
+
hdrtext,
|
|
39
|
+
text width=\JINVAR{ tmpl_data.hdrcol_width -}, fill=OBSHDRFill,
|
|
40
|
+
align=\JINVAR{ hdrcol_align -},
|
|
41
|
+
},},
|
|
42
|
+
record matrix dimensions,
|
|
43
|
+
] (invres_rate_raw) {
|
|
44
|
+
\JINVAR{ tmpl_data.invdata_datstr -}
|
|
35
45
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
% Horizontal scoring for totals
|
|
47
|
+
\draw[color = OBSHDRFill, line width = 1pt]
|
|
48
|
+
($(invres_rate_raw-\the\tnr-2.north west) + (- \JINVAR{ tmpl_data.hdrcol_width } - 6pt + 0.25\pgflinewidth, 0pt)$)
|
|
49
|
+
-- (invres_rate_raw-\the\tnr-\the\tnc.north east)
|
|
50
|
+
;
|
|
51
|
+
% Vertical scoring for column groups
|
|
52
|
+
\draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-3.north east) -- (invres_rate_raw-\the\tnr-3.south east);
|
|
53
|
+
\draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-5.north east) -- (invres_rate_raw-\the\tnr-5.south east);
|
|
54
|
+
\draw[color = OBSHDRFill, line width = 1pt] (invres_rate_raw-1-7.north east) -- (invres_rate_raw-\the\tnr-7.south east);
|
|
43
55
|
|
|
44
56
|
|
|
45
57
|
%% Header column - row heads - description
|
|
@@ -120,9 +132,9 @@
|
|
|
120
132
|
% \item Fed. Trade Comm'n (2003), at note~\cref{fn:FTCInvData1996to2003}
|
|
121
133
|
% \item Fed. Trade Comm'n (2011), at note~\cref{fn:FTCInvData1996to2011}
|
|
122
134
|
% \end{itemize}
|
|
123
|
-
\JINVAR{
|
|
135
|
+
\JINVAR{ tmpl_data.invdata_notestr }
|
|
124
136
|
\vspace{\baselineskip}
|
|
125
|
-
\JINVAR{ tmpl_data.invdata_sourcestr
|
|
137
|
+
\JINVAR{ tmpl_data.invdata_sourcestr }
|
|
126
138
|
}
|
|
127
139
|
\vspace{\baselineskip}
|
|
128
140
|
\end{table}
|
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
ifthenelse(iseven(\pgfmatrixcurrentrow),1,3))}
|
|
25
25
|
%\typeout{\the\pgfmatrixcurrentcolumn,\pgfmatrixcurrentrow->\itest}
|
|
26
26
|
\ifcase\itest
|
|
27
|
-
\tikzset{fill=
|
|
27
|
+
\tikzset{fill=none}%
|
|
28
28
|
\or
|
|
29
29
|
\tikzset{fill=DataFill}%
|
|
30
30
|
\else
|
|
31
31
|
\tikzset{fill=white}%
|
|
32
32
|
\fi
|
|
33
33
|
},
|
|
34
|
+
get matrix dims/.code={
|
|
35
|
+
\global\tnc=\pgf@matrix@numberofcolumns
|
|
36
|
+
\global\tnr=\pgfmatrixcurrentrow
|
|
37
|
+
},
|
|
34
38
|
% If you only have numbers, text depth = 0ex; if text, text depth = 0.25ex, (may need tweaking for alignment across cells)
|
|
35
39
|
anytext/.style = {
|
|
36
40
|
font = \sffamily\scriptsize\addfontfeatures{Numbers={Monospaced,Lining}},
|
|
@@ -66,9 +70,6 @@
|
|
|
66
70
|
fill = none,
|
|
67
71
|
green_bar_filler,
|
|
68
72
|
},
|
|
69
|
-
% every even row/.style = {
|
|
70
|
-
% nodes = {fill = DataFill}
|
|
71
|
-
% },
|
|
72
73
|
},
|
|
73
74
|
hdrtable/.style = {
|
|
74
75
|
anytable,
|
|
@@ -6,7 +6,7 @@ Methods to format and print summary statistics on merger enforcement patterns.
|
|
|
6
6
|
import enum
|
|
7
7
|
import shutil
|
|
8
8
|
import subprocess
|
|
9
|
-
from collections.abc import Mapping
|
|
9
|
+
from collections.abc import Mapping
|
|
10
10
|
from importlib import resources
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from types import SimpleNamespace
|
|
@@ -48,12 +48,16 @@ class IndustryGroup(enum.StrEnum):
|
|
|
48
48
|
|
|
49
49
|
@enum.unique
|
|
50
50
|
class OtherEvidence(enum.StrEnum):
|
|
51
|
+
UR = "Unrestricted on additional evidence"
|
|
51
52
|
HD = "Hot Documents Identified"
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
HN = "No Hot Documents Identified"
|
|
54
|
+
HU = "No Evidence on Hot Documents"
|
|
55
|
+
CN = "No Strong Customer Complaints"
|
|
56
|
+
CS = "Strong Customer Complaints"
|
|
57
|
+
CU = "No Evidence on Customer Complaints"
|
|
54
58
|
ED = "Entry Difficult"
|
|
55
59
|
EE = "Entry Easy"
|
|
56
|
-
|
|
60
|
+
NE = "No Entry Evidence"
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
@enum.unique
|
|
@@ -90,47 +94,53 @@ moe_tmpl = Template(R"""
|
|
|
90
94
|
""")
|
|
91
95
|
|
|
92
96
|
# Define the LaTeX jinja environment
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
LaTeX_jinja_env = Environment(
|
|
102
|
-
block_start_string=R"((*",
|
|
103
|
-
block_end_string="*))",
|
|
104
|
-
variable_start_string=R"\JINVAR{",
|
|
105
|
-
variable_end_string="}",
|
|
106
|
-
comment_start_string=R"((#", # r'#{',
|
|
107
|
-
comment_end_string=R"#))", # '}',
|
|
108
|
-
line_statement_prefix="##",
|
|
109
|
-
line_comment_prefix="%#",
|
|
110
|
-
trim_blocks=True,
|
|
111
|
-
lstrip_blocks=True,
|
|
112
|
-
autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
|
|
113
|
-
loader=FileSystemLoader(_tmpl_folder),
|
|
114
|
-
)
|
|
97
|
+
_template_resource = resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
|
|
98
|
+
_template_folder = DATA_DIR.joinpath(_template_resource.name)
|
|
99
|
+
with resources.as_file(
|
|
100
|
+
resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates")
|
|
101
|
+
) as _tmpl_src:
|
|
102
|
+
if not _template_folder.is_dir():
|
|
103
|
+
shutil.copytree(_tmpl_src, _template_folder)
|
|
115
104
|
|
|
116
105
|
# Place files related to rendering LaTeX in output data directory
|
|
117
106
|
if not (_out_path := DATA_DIR.joinpath(f"{_PKG_NAME}.cls")).is_file():
|
|
118
|
-
|
|
119
|
-
resources.files(f"{_PKG_NAME}.data.jinja2_LaTeX_templates").joinpath(
|
|
120
|
-
"{_PKG_NAME}.cls"
|
|
121
|
-
)
|
|
122
|
-
) as _in_path:
|
|
123
|
-
shutil.copy2(_in_path, _out_path)
|
|
124
|
-
|
|
107
|
+
shutil.move(_template_folder / _out_path.name, _out_path)
|
|
125
108
|
|
|
109
|
+
# Write to LaTeX table settings file
|
|
126
110
|
if not (_DOTTEX := DATA_DIR / Rf"{_PKG_NAME}_TikZTableSettings.tex").is_file():
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
111
|
+
shutil.move(_template_folder / "setup_tikz_tables.tex", _DOTTEX)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def create_jinja_env(_tmpl_folder: Path = _template_folder, /) -> Environment:
|
|
115
|
+
"""Create jinja2 environment
|
|
116
|
+
|
|
117
|
+
Loader is the FileSystemLoader initialized with the given path as
|
|
118
|
+
template folder
|
|
119
|
+
|
|
120
|
+
Parameters
|
|
121
|
+
----------
|
|
122
|
+
_tmpl_folder : Path
|
|
123
|
+
Path to template folder
|
|
124
|
+
|
|
125
|
+
Returns
|
|
126
|
+
-------
|
|
127
|
+
Environment
|
|
128
|
+
jinja2 environment
|
|
129
|
+
"""
|
|
130
|
+
return Environment(
|
|
131
|
+
block_start_string=R"((*",
|
|
132
|
+
block_end_string="*))",
|
|
133
|
+
variable_start_string=R"\JINVAR{",
|
|
134
|
+
variable_end_string="}",
|
|
135
|
+
comment_start_string=R"((#", # r'#{',
|
|
136
|
+
comment_end_string=R"#))", # '}',
|
|
137
|
+
line_statement_prefix="##",
|
|
138
|
+
line_comment_prefix="%#",
|
|
139
|
+
trim_blocks=True,
|
|
140
|
+
lstrip_blocks=True,
|
|
141
|
+
autoescape=select_autoescape(disabled_extensions=("tex.jinja2",)),
|
|
142
|
+
loader=FileSystemLoader(_tmpl_folder),
|
|
143
|
+
)
|
|
134
144
|
|
|
135
145
|
|
|
136
146
|
LTX_ARRAY_LINEEND = "\\\\\n"
|
|
@@ -168,6 +178,32 @@ hhi_delta_ranger, hhi_zone_post_ranger = (
|
|
|
168
178
|
for _f in (HHI_DELTA_KNOTS, HHI_POST_ZONE_KNOTS)
|
|
169
179
|
)
|
|
170
180
|
|
|
181
|
+
|
|
182
|
+
HMG_PRESUMPTION_ZONE_MAP = {
|
|
183
|
+
HHI_POST_ZONE_KNOTS[0]: {
|
|
184
|
+
HHI_DELTA_KNOTS[0]: (0, 0, 0),
|
|
185
|
+
HHI_DELTA_KNOTS[1]: (0, 0, 0),
|
|
186
|
+
HHI_DELTA_KNOTS[2]: (0, 0, 0),
|
|
187
|
+
},
|
|
188
|
+
HHI_POST_ZONE_KNOTS[1]: {
|
|
189
|
+
HHI_DELTA_KNOTS[0]: (0, 1, 1),
|
|
190
|
+
HHI_DELTA_KNOTS[1]: (1, 1, 2),
|
|
191
|
+
HHI_DELTA_KNOTS[2]: (1, 1, 2),
|
|
192
|
+
},
|
|
193
|
+
HHI_POST_ZONE_KNOTS[2]: {
|
|
194
|
+
HHI_DELTA_KNOTS[0]: (0, 2, 1),
|
|
195
|
+
HHI_DELTA_KNOTS[1]: (1, 2, 3),
|
|
196
|
+
HHI_DELTA_KNOTS[2]: (2, 2, 4),
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
ZONE_VALS = np.unique(
|
|
201
|
+
np.vstack([
|
|
202
|
+
tuple(HMG_PRESUMPTION_ZONE_MAP[_k].values()) for _k in HMG_PRESUMPTION_ZONE_MAP
|
|
203
|
+
]),
|
|
204
|
+
axis=0,
|
|
205
|
+
)
|
|
206
|
+
|
|
171
207
|
ZONE_STRINGS = {
|
|
172
208
|
0: R"Green Zone (Safeharbor)",
|
|
173
209
|
1: R"Yellow Zone",
|
|
@@ -182,10 +218,10 @@ ZONE_DETAIL_STRINGS_HHI = {
|
|
|
182
218
|
|
|
183
219
|
ZONE_DETAIL_STRINGS_DELTA = {
|
|
184
220
|
0: "",
|
|
185
|
-
1: Rf"ΔHHI <
|
|
186
|
-
2: Rf"ΔHHI ⩾
|
|
187
|
-
3: R"ΔHHI ∈
|
|
188
|
-
4: Rf"ΔHHI ⩾
|
|
221
|
+
1: Rf"ΔHHI < {HHI_DELTA_KNOTS[1]} pts.",
|
|
222
|
+
2: Rf"ΔHHI ⩾ {HHI_DELTA_KNOTS[1]} pts.}}",
|
|
223
|
+
3: R"ΔHHI ∈ [{}, {}) pts.".format(*HHI_DELTA_KNOTS[1:3]),
|
|
224
|
+
4: Rf"ΔHHI ⩾ {HHI_DELTA_KNOTS[2]} pts.",
|
|
189
225
|
}
|
|
190
226
|
|
|
191
227
|
ZONE_STRINGS_LATEX = {
|
|
@@ -211,31 +247,6 @@ ZONE_DETAIL_STRINGS_DELTA_LATEX = {
|
|
|
211
247
|
4: Rf"\Delta HHI \geqslant \text{{{HHI_DELTA_KNOTS[2]} pts.}}",
|
|
212
248
|
}
|
|
213
249
|
|
|
214
|
-
HMG_PRESUMPTION_ZONE_MAP = {
|
|
215
|
-
HHI_POST_ZONE_KNOTS[0]: {
|
|
216
|
-
HHI_DELTA_KNOTS[0]: (0, 0, 0),
|
|
217
|
-
HHI_DELTA_KNOTS[1]: (0, 0, 0),
|
|
218
|
-
HHI_DELTA_KNOTS[2]: (0, 0, 0),
|
|
219
|
-
},
|
|
220
|
-
HHI_POST_ZONE_KNOTS[1]: {
|
|
221
|
-
HHI_DELTA_KNOTS[0]: (0, 1, 1),
|
|
222
|
-
HHI_DELTA_KNOTS[1]: (1, 1, 2),
|
|
223
|
-
HHI_DELTA_KNOTS[2]: (1, 1, 2),
|
|
224
|
-
},
|
|
225
|
-
HHI_POST_ZONE_KNOTS[2]: {
|
|
226
|
-
HHI_DELTA_KNOTS[0]: (0, 2, 1),
|
|
227
|
-
HHI_DELTA_KNOTS[1]: (1, 2, 3),
|
|
228
|
-
HHI_DELTA_KNOTS[2]: (2, 2, 4),
|
|
229
|
-
},
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
ZONE_VALS = np.unique(
|
|
233
|
-
np.vstack([
|
|
234
|
-
tuple(HMG_PRESUMPTION_ZONE_MAP[_k].values()) for _k in HMG_PRESUMPTION_ZONE_MAP
|
|
235
|
-
]),
|
|
236
|
-
axis=0,
|
|
237
|
-
)
|
|
238
|
-
|
|
239
250
|
|
|
240
251
|
def enf_stats_output(
|
|
241
252
|
_data_array_dict: fid.INVData,
|
|
@@ -277,8 +288,13 @@ def enf_stats_output(
|
|
|
277
288
|
_enf_spec,
|
|
278
289
|
)
|
|
279
290
|
|
|
291
|
+
_print_format: Literal["text", "LaTeX"] = "text" if print_to_screen else "LaTeX"
|
|
280
292
|
_enf_stats_hdr_list, _enf_stats_dat_list = _enf_stats_table_func(
|
|
281
|
-
_enf_stats_cnts,
|
|
293
|
+
_enf_stats_cnts,
|
|
294
|
+
None,
|
|
295
|
+
return_type_sel=return_type_sel,
|
|
296
|
+
sort_order=sort_order,
|
|
297
|
+
print_format=_print_format,
|
|
282
298
|
)
|
|
283
299
|
|
|
284
300
|
if print_to_screen:
|
|
@@ -289,7 +305,9 @@ def enf_stats_output(
|
|
|
289
305
|
f"{_table_ind_group};",
|
|
290
306
|
_table_evid_cond,
|
|
291
307
|
)
|
|
292
|
-
stats_print_rows(
|
|
308
|
+
stats_print_rows(
|
|
309
|
+
_enf_stats_hdr_list, _enf_stats_dat_list, print_format=_print_format
|
|
310
|
+
)
|
|
293
311
|
|
|
294
312
|
return _enf_stats_hdr_list, _enf_stats_dat_list
|
|
295
313
|
|
|
@@ -472,7 +490,7 @@ def enf_cnts_byconczone(_cnts_array: ArrayBIGINT, /) -> ArrayBIGINT:
|
|
|
472
490
|
|
|
473
491
|
for _hhi_zone_delta_lim in HHI_DELTA_KNOTS[:3]:
|
|
474
492
|
_delta_test = (
|
|
475
|
-
(_hhi_delta_ranged
|
|
493
|
+
(_hhi_delta_ranged >= _hhi_zone_delta_lim)
|
|
476
494
|
if _hhi_zone_delta_lim == HHI_DELTA_KNOTS[2]
|
|
477
495
|
else (_hhi_delta_ranged == _hhi_zone_delta_lim)
|
|
478
496
|
)
|
|
@@ -528,12 +546,10 @@ def enf_stats_table_onedim(
|
|
|
528
546
|
*,
|
|
529
547
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
530
548
|
sort_order: SortSelector = SortSelector.UCH,
|
|
531
|
-
print_format: Literal["text", "LaTeX"] = "
|
|
549
|
+
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
532
550
|
) -> tuple[list[str], list[list[str]]]:
|
|
533
551
|
_ndim_in: int = 1
|
|
534
|
-
_dim_hdr_dict = {
|
|
535
|
-
_v: (_k if _k == "TOTAL" else f"{_k}") for _k, _v in fid.CNT_FCOUNT_DICT.items()
|
|
536
|
-
} | {
|
|
552
|
+
_dim_hdr_dict = {_v: _k for _k, _v in fid.CNT_FCOUNT_DICT.items()} | {
|
|
537
553
|
_v: (
|
|
538
554
|
"[2500, 5000]"
|
|
539
555
|
if _k == "2,500 +"
|
|
@@ -583,7 +599,7 @@ def enf_stats_table_byzone(
|
|
|
583
599
|
*,
|
|
584
600
|
return_type_sel: StatsReturnSelector = StatsReturnSelector.CNT,
|
|
585
601
|
sort_order: SortSelector = SortSelector.UCH,
|
|
586
|
-
print_format: Literal["text", "LaTeX"] = "
|
|
602
|
+
print_format: Literal["text", "LaTeX"] = "LaTeX",
|
|
587
603
|
) -> tuple[list[str], list[list[str]]]:
|
|
588
604
|
_ndim_in: int = ZONE_VALS.shape[1]
|
|
589
605
|
|
|
@@ -624,7 +640,7 @@ def enf_stats_table_byzone(
|
|
|
624
640
|
if print_format == "LaTeX":
|
|
625
641
|
_stats_text_color = "HiCoYellow" if _conc_zone == 1 else "BrightGreen"
|
|
626
642
|
_stats_hdr_list += [
|
|
627
|
-
R"{} {{ \({}{}\) }};".format(
|
|
643
|
+
R"{} {{\null\hfill \({}{}\) }};".format(
|
|
628
644
|
rf"\node[text = {_stats_text_color}, fill = white, align = right]",
|
|
629
645
|
ZONE_DETAIL_STRINGS_HHI_LATEX[_stats_byzone_detail[1]],
|
|
630
646
|
(
|
|
@@ -702,6 +718,8 @@ def _stats_formatted_row(
|
|
|
702
718
|
def stats_print_rows(
|
|
703
719
|
_enf_stats_hdr_list: list[str],
|
|
704
720
|
_enf_stats_dat_list: list[list[str]],
|
|
721
|
+
/,
|
|
722
|
+
*,
|
|
705
723
|
print_format: Literal["text", "LaTeX"] = "text",
|
|
706
724
|
) -> None:
|
|
707
725
|
for _idx, _hdr in enumerate(_enf_stats_hdr_list):
|
|
@@ -828,35 +846,41 @@ def propn_ci(
|
|
|
828
846
|
|
|
829
847
|
|
|
830
848
|
def render_table_pdf(
|
|
831
|
-
|
|
849
|
+
_table_collection_design: Template,
|
|
850
|
+
_table_collection_content: StatsContainer,
|
|
851
|
+
_output_tex_path: Path,
|
|
852
|
+
/,
|
|
832
853
|
) -> None:
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
854
|
+
"""Render table collection to PDF
|
|
855
|
+
|
|
856
|
+
Parameters
|
|
857
|
+
----------
|
|
858
|
+
_table_collection_design
|
|
859
|
+
A jinja2 template for generating the LaTeX file to render
|
|
860
|
+
|
|
861
|
+
_table_collection_content
|
|
862
|
+
Content for jinja2 template
|
|
837
863
|
|
|
838
|
-
|
|
864
|
+
_output_tex_path
|
|
865
|
+
Path to LaTeX output file to render to PDF
|
|
866
|
+
"""
|
|
839
867
|
|
|
840
|
-
with
|
|
841
|
-
|
|
842
|
-
) as _table_coll_file:
|
|
843
|
-
_table_coll_file.write(
|
|
868
|
+
with _output_tex_path.open("w", encoding="utf8") as _output_tex_file:
|
|
869
|
+
_output_tex_file.write(
|
|
844
870
|
_table_collection_design.render(tmpl_data=_table_collection_content)
|
|
845
871
|
)
|
|
846
|
-
print("\n", file=
|
|
872
|
+
print("\n", file=_output_tex_file)
|
|
847
873
|
|
|
848
874
|
_run_rc = subprocess.run( # noqa: S603
|
|
849
|
-
f"latexmk -f -quiet -synctex=0 -interaction=nonstopmode -file-line-error -pdflua {
|
|
875
|
+
f"latexmk -f -quiet -synctex=0 -interaction=nonstopmode -file-line-error -pdflua {_output_tex_path}".split(),
|
|
850
876
|
check=True,
|
|
851
877
|
cwd=DATA_DIR,
|
|
852
878
|
)
|
|
853
879
|
if _run_rc:
|
|
854
|
-
subprocess.run("
|
|
880
|
+
subprocess.run("latexmk -quiet -c".split(), check=True, cwd=DATA_DIR) # noqa: S603
|
|
855
881
|
del _run_rc
|
|
856
882
|
|
|
857
|
-
print(
|
|
858
|
-
f"Tables rendered to path, {f"{Path(DATA_DIR / _table_coll_path).with_suffix(".pdf")}"}"
|
|
859
|
-
)
|
|
883
|
+
print(f"Tables rendered to path, {_output_tex_path.with_suffix(".pdf")}")
|
|
860
884
|
|
|
861
885
|
|
|
862
886
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mergeron
|
|
3
|
-
Version: 2024.
|
|
3
|
+
Version: 2024.739125.0
|
|
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,8 +1,8 @@
|
|
|
1
1
|
mergeron/License.txt,sha256=7iX-y0EyjkbVJKJLS4ZKzuuE1wd0lryfsD_IytLG8lQ,1246
|
|
2
|
-
mergeron/__init__.py,sha256=
|
|
2
|
+
mergeron/__init__.py,sha256=5QKzLNoCz8V-dP_hOfOTu2hNaSyIO5Zrd2uN7DDbtOk,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
|
-
mergeron/core/ftc_merger_investigations_data.py,sha256=
|
|
5
|
+
mergeron/core/ftc_merger_investigations_data.py,sha256=Q8d2N4brY2cwJClibwxOVfLE3WV0XZABssblGN6nOdA,28639
|
|
6
6
|
mergeron/core/guidelines_boundaries.py,sha256=sEvIIaOvWl6tMDYeZCIr8EsBioXOn9RSXKyKlmxnH-k,15610
|
|
7
7
|
mergeron/core/guidelines_boundary_functions.py,sha256=GGn5mwBWmxkqcat4Ya0D-J6-7ujosgCCK3eJ9RFWASI,29749
|
|
8
8
|
mergeron/core/guidelines_boundary_functions_extra.py,sha256=HDwwKZDWlrj3Tw-I0gHm0TCSDcIyb9jDfwbuDvK55B8,11322
|
|
@@ -14,18 +14,18 @@ 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/ftcinvdata_summarypaired_table_template.tex.jinja2,sha256=
|
|
17
|
+
mergeron/data/jinja2_LaTeX_templates/ftcinvdata_summarypaired_table_template.tex.jinja2,sha256=OJuvD2urDh3M1HHGHf1Sz32iuMAN_Yb_ltt8ewX3f5c,5511
|
|
18
18
|
mergeron/data/jinja2_LaTeX_templates/mergeron.cls,sha256=aM2nx2GVQayZ8JPtD_OU4zjYlnddYx9k9WumN4WQc6g,4385
|
|
19
19
|
mergeron/data/jinja2_LaTeX_templates/mergeron_table_collection_template.tex.jinja2,sha256=FQ1uEwQv2QlGJS1DqlJwh0nLZp5h8dRjoYfWzbq6uMc,2546
|
|
20
|
-
mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex,sha256=
|
|
20
|
+
mergeron/data/jinja2_LaTeX_templates/setup_tikz_tables.tex,sha256=N_ykya_TceWxuygpPEEkCpPLopsF9KkJe6dEOu166QU,3399
|
|
21
21
|
mergeron/demo/__init__.py,sha256=KtjBlZOl7jwBCAUhrTJB9PdrN39YLYytNiSUSM_gRmA,62
|
|
22
22
|
mergeron/demo/visualize_empirical_margin_distribution.py,sha256=v1xFJumBX2Ooye82kSSgly-_GpFVkYSDqBwM__rcmZY,2363
|
|
23
23
|
mergeron/gen/__init__.py,sha256=0rfcWpKDhYE_jNsw6xKTGFJqgNtfJ-5JFxHS89CIEuI,16575
|
|
24
24
|
mergeron/gen/data_generation.py,sha256=ZwcVoAfqGTwVBL7PRil_A9kZU8DQK0eCHtsBFA1QElA,16773
|
|
25
25
|
mergeron/gen/data_generation_functions.py,sha256=bP3E0IPXINRc8s0dUxS_Wqo1byVzheZLX811A17WNbU,28571
|
|
26
|
-
mergeron/gen/enforcement_stats.py,sha256=
|
|
26
|
+
mergeron/gen/enforcement_stats.py,sha256=53ld9Qg_oZpYAoCXJg54m9wLBNycy7TwULPDJj18aHg,27940
|
|
27
27
|
mergeron/gen/upp_tests.py,sha256=yzEwWK1bVfjtBYMwXnL5uEWWRiR0_9y0wmjNMB-O3rU,12589
|
|
28
28
|
mergeron/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
29
|
-
mergeron-2024.
|
|
30
|
-
mergeron-2024.
|
|
31
|
-
mergeron-2024.
|
|
29
|
+
mergeron-2024.739125.0.dist-info/METADATA,sha256=U-7AJXiRdBMTLLzzzjPdM5CFINNPtC60fSW_ICTykU0,13976
|
|
30
|
+
mergeron-2024.739125.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
31
|
+
mergeron-2024.739125.0.dist-info/RECORD,,
|
|
File without changes
|