{ "cells": [ { "cell_type": "markdown", "id": "dce84895", "metadata": {}, "source": [ "# Table S8: Dataset Summary Statistics\n", "\n", "Molecule and ¹H/¹³C site counts for each training dataset (site counts from each HDF5's\n", "`atomic_numbers`, ¹H=1/¹³C=6; MagNET-Zero combines both sigma-pepper rounds with sigma-concentrate)." ] }, { "cell_type": "code", "execution_count": null, "id": "df321bd6", "metadata": {}, "outputs": [], "source": [ "import os, sys\n", "\n", "# make the in-repo modules importable (not pip-installed)\n", "REPO = os.path.abspath(\"../..\")\n", "for _p in (\"analysis/code\", \"analysis/code/shared\"):\n", " sys.path.insert(0, os.path.join(REPO, _p))" ] }, { "cell_type": "code", "execution_count": null, "id": "88710ad5", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import dataset_summary" ] }, { "cell_type": "code", "execution_count": null, "id": "84e5a441", "metadata": {}, "outputs": [], "source": [ "DATA_DIR = os.path.join(REPO, \"data\")\n", "\n", "def document_path(name):\n", " os.makedirs(\"documents\", exist_ok=True)\n", " return os.path.join(\"documents\", name)" ] }, { "cell_type": "code", "execution_count": null, "id": "6a606891", "metadata": {}, "outputs": [], "source": [ "table_s8 = dataset_summary.summary_table(DATA_DIR)\n", "display(table_s8)\n", "\n", "# write the table to this notebook's documents/ folder\n", "out = document_path(\"si_table_s08_summary.xlsx\")\n", "with pd.ExcelWriter(out) as writer:\n", " table_s8.to_excel(writer, sheet_name=\"Table S8\", index=False)\n", "print(\"wrote\", os.path.relpath(out, REPO))" ] }, { "cell_type": "markdown", "id": "3bf67791", "metadata": {}, "source": [ "## Exact-reproduction check" ] }, { "cell_type": "code", "execution_count": null, "id": "4d5f4416", "metadata": {}, "outputs": [], "source": [ "# every count should match the published SI Table S8 value exactly\n", "for _, row in table_s8.iterrows():\n", " pub = dataset_summary.PUBLISHED_S8[row[\"dataset\"]]\n", " got = (row[\"molecules\"], row[\"n_1H_sites\"], row[\"n_13C_sites\"])\n", " assert got == pub, f\"{row['dataset']}: {got} != published {pub}\"\n", "print(\"all rows match the published SI Table S8 exactly\")" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }