aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Janovsky2023-05-24 15:32:00 +0200
committerAdam Janovsky2023-05-24 15:32:00 +0200
commit555cdd26fa4652830f51458520a74a21c244fc0b (patch)
tree61859907b6a7b89763bf23458392da7cfadb0409
parent2108bb6ccdebb1915861810ead3df91dd8bff243 (diff)
downloadsec-certs-555cdd26fa4652830f51458520a74a21c244fc0b.tar.gz
sec-certs-555cdd26fa4652830f51458520a74a21c244fc0b.tar.zst
sec-certs-555cdd26fa4652830f51458520a74a21c244fc0b.zip
add some latex commands previously missed from notebooks
-rw-r--r--notebooks/cc/temporal_trends.ipynb33
1 files changed, 31 insertions, 2 deletions
diff --git a/notebooks/cc/temporal_trends.ipynb b/notebooks/cc/temporal_trends.ipynb
index 754d494e..b128fb44 100644
--- a/notebooks/cc/temporal_trends.ipynb
+++ b/notebooks/cc/temporal_trends.ipynb
@@ -18,6 +18,7 @@
"import matplotlib.ticker as mtick\n",
"import warnings\n",
"from pathlib import Path\n",
+ "import yaml\n",
"\n",
"plt.style.use(\"seaborn-whitegrid\")\n",
"sns.set_palette(\"deep\")\n",
@@ -65,6 +66,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -104,6 +106,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -123,6 +126,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -194,6 +198,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -233,6 +238,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -274,6 +280,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -304,6 +311,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -342,7 +350,27 @@
"print(f\"\\\\newcommand{{\\\\numCCArchivedCerts}}{{${df.loc[df.status == 'archived'].shape[0]}$}}\")\n",
"print(f\"\\\\newcommand{{\\\\fractioncertspopularcategories}}{{${(100 * n_certs_popular / n_certs_all):.0f}\\%$}}\")\n",
"print(f\"\\\\newcommand{{\\\\fractionCertsSmartcards}}{{${(100 * n_certs_smartcards / n_certs_all):.0f}\\%$}}\")\n",
- "print(f\"\\\\newcommand{{\\\\numCCBulkArchivedTwentyNineteen}}{{${(df.not_valid_after.value_counts()['2019-09-01']):.0f}$}}\")"
+ "print(f\"\\\\newcommand{{\\\\numCCBulkArchivedTwentyNineteen}}{{${(df.not_valid_after.value_counts()['2019-09-01']):.0f}$}}\")\n",
+ "\n",
+ "# Number of attempts to convert documents pdf->txt\n",
+ "num_cc_convert_attempts = sum(bool(cert.state.st_pdf_path) for cert in dset) + sum(bool(cert.state.report_pdf_path) for cert in dset)\n",
+ "# Number of OCR attempts\n",
+ "num_cc_ocr_attempted = sum(bool(cert.state.st_convert_garbage) for cert in dset) + sum(bool(cert.state.report_convert_garbage) for cert in dset)\n",
+ "num_cc_ocr_success = sum(bool(cert.state.st_convert_garbage and cert.state.st_convert_ok) for cert in dset) + sum(bool(cert.state.report_convert_garbage and cert.state.report_convert_ok) for cert in dset)\n",
+ "\n",
+ "print(f\"\\\\newcommand{{\\\\numCcConvertAttempts}}{{${num_cc_convert_attempts}$}}\")\n",
+ "print(f\"\\\\newcommand{{\\\\numCcOcrAttempted}}{{${num_cc_ocr_attempted}$}}\")\n",
+ "print(f\"\\\\newcommand{{\\\\numCcOcrSuccess}}{{${num_cc_ocr_success}$}}\")\n",
+ "\n",
+ "# Load number of different schemes for cert ids and regexes to match theme\n",
+ "with open(\"../../src/sec_certs/rules.yaml\") as handle:\n",
+ " rules_yaml = yaml.load(handle, Loader=yaml.FullLoader)\n",
+ "\n",
+ "num_cc_schemes = len(rules_yaml[\"cc_cert_id\"].keys())\n",
+ "num_cc_scheme_id_rules = sum(len(rules_yaml[\"cc_cert_id\"][x]) for x in rules_yaml[\"cc_cert_id\"])\n",
+ "\n",
+ "print(f\"\\\\newcommand{{\\\\numccschemes}}{{${num_cc_schemes}$}}\")\n",
+ "print(f\"\\\\newcommand{{\\\\numccschemeidrules}}{{${num_cc_scheme_id_rules}$}}\")"
]
},
{
@@ -360,6 +388,7 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -455,7 +484,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.13"
+ "version": "3.8.16"
},
"vscode": {
"interpreter": {