Skip to content

Commit

Permalink
Load results from json
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahbaumann committed Mar 25, 2024
1 parent f829ebb commit 4d5681c
Showing 1 changed file with 41 additions and 15 deletions.
56 changes: 41 additions & 15 deletions ahfe_tutorial/python_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -812,18 +812,10 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"id": "d0f6b8fb-dde2-442a-b641-3160a70e2f84",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AHFE dG: -0.8757588273304342 kilocalorie_per_mole, err 0.15236223232996626 kilocalorie_per_mole\n"
]
}
],
"outputs": [],
"source": [
"# Get the complex and solvent results\n",
"protocol_results = protocol.gather([dag_results])\n",
Expand All @@ -833,7 +825,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": null,
"id": "847b5663-2e6c-4cb2-aa9d-39d132fcff3d",
"metadata": {},
"outputs": [],
Expand All @@ -852,17 +844,51 @@
" }\n",
"}\n",
"\n",
"with gzip.open(\"ahfe_benzene_json_results.gz\", 'wt') as zipfile:\n",
" json.dump(outdict, zipfile, cls=gufe.tokenization.JSON_HANDLER.encoder)"
"with open(\"ahfe_json/benzene_results.json\") as stream:\n",
" json.dump(outdict, stream, cls=gufe.tokenization.JSON_HANDLER.encoder)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"id": "f62f69a1-09c0-4a4a-9b37-9663b51a75ac",
"metadata": {},
"outputs": [],
"source": []
"source": [
"import gzip\n",
"import json\n",
"import gufe\n",
"\n",
"outfile = \"ahfe_json/benzene_results.json\"\n",
"with open(outfile) as stream:\n",
" results = json.load(stream)\n",
" estimate = results['estimate']\n",
" uncertainty = results['uncertainty']"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "3b459b28-a4dc-4fa9-a961-b106c45d79ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'magnitude': -0.7536190151704971,\n",
" 'unit': 'kilocalorie_per_mole',\n",
" ':is_custom:': True,\n",
" 'pint_unit_registry': 'openff_units'}"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"estimate"
]
}
],
"metadata": {
Expand Down

0 comments on commit 4d5681c

Please sign in to comment.