Skip to content

Commit

Permalink
♻️ Converted target_rcg_compare to project API
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Feb 27, 2023
1 parent 0701661 commit 01ba768
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 32 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
75 changes: 43 additions & 32 deletions rc/target_rcg_compare_part2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@
"# Inspect experimental data\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from glotaran.project import Project\n",
"\n",
"project = Project.open(\"\")\n",
"project.import_data(\n",
" \"measured_data/Krg_grga.ascii\", dataset_name=\"tas_rcg_dcm\", ignore_existing=True\n",
")\n",
"project.import_data(\n",
" \"measured_data/Krg_grgc.ascii\", dataset_name=\"guide_rcg_r1\", ignore_existing=True\n",
")\n",
"project.import_data(\n",
" \"measured_data/Krg_grgd.ascii\", dataset_name=\"guide_rcg_r2\", ignore_existing=True\n",
")\n",
"project.import_data(\n",
" \"measured_data/Krg_grge.ascii\", dataset_name=\"guide_rcg_r3\", ignore_existing=True\n",
")\n",
"project.import_data(\n",
" \"measured_data/Krg_grgf.ascii\", dataset_name=\"guide_rcg_r4\", ignore_existing=True\n",
")\n",
"project.import_data(\n",
" \"measured_data/Krg_grgg.ascii\", dataset_name=\"guide_rcg_g\", ignore_existing=True\n",
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -87,7 +116,7 @@
" # \"guide_rcgcr_r4\": \"data/Krg_grgf.ascii\",\n",
"}\n",
"\n",
"plot_data_overview(experiment_data[\"tas_rcg_dcm\"], linlog=True, linthresh=1)"
"plot_data_overview(project.data[\"tas_rcg_dcm\"], linlog=True, linthresh=1);"
]
},
{
Expand All @@ -110,10 +139,7 @@
},
"outputs": [],
"source": [
"# from glotaran.utils.ipython import display_file\n",
"\n",
"model_path = \"models/model_target_rcg_refine.yml\"\n",
"# display_file(model_path, syntax=\"yaml\")"
"# project.show_model_definition(\"target_rcg_refine\")"
]
},
{
Expand All @@ -138,8 +164,7 @@
},
"outputs": [],
"source": [
"parameters_file_path = \"models/parameters_target_rcg_refine.yml\"\n",
"# display_file(parameters_file_path, syntax=\"yaml\")"
"# project.show_parameters_definition(\"target_rcg_refine\")"
]
},
{
Expand Down Expand Up @@ -175,17 +200,12 @@
},
"outputs": [],
"source": [
"from glotaran.optimization.optimize import optimize\n",
"from glotaran.project.scheme import Scheme\n",
"\n",
"scheme = Scheme(\n",
" model_path,\n",
" parameters_file_path,\n",
" experiment_data,\n",
"result = project.optimize(\n",
" model_name=\"target_rcg_refine\",\n",
" parameters_name=\"target_rcg_refine\",\n",
" clp_link_tolerance=1.9,\n",
" maximum_number_function_evaluations=1,\n",
")\n",
"result = optimize(scheme)"
")"
]
},
{
Expand Down Expand Up @@ -337,7 +357,6 @@
},
"outputs": [],
"source": [
"\n",
"from pyglotaran_extras.plotting.style import PlotStyle\n",
"\n",
"# fig, ax = plt.subplots(1, 1, figsize=(15, 7))\n",
Expand Down Expand Up @@ -494,21 +513,12 @@
},
"outputs": [],
"source": [
"from glotaran.optimization.optimize import optimize\n",
"from glotaran.project.scheme import Scheme\n",
"\n",
"model_noRP_path = \"models/model_target_noRP_rcg_refine.yml\"\n",
"parameters_noRP_file_path = \"models/parameters_target_noRP_rcg_refine.yml\"\n",
"\n",
"\n",
"scheme_noRP = Scheme(\n",
" model_noRP_path,\n",
" parameters_noRP_file_path,\n",
" experiment_data,\n",
"result_noRP = project.optimize(\n",
" model_name=\"target_noRP_rcg_refine\",\n",
" parameters_name=\"target_noRP_rcg_refine\",\n",
" clp_link_tolerance=1.9,\n",
" maximum_number_function_evaluations=1,\n",
")\n",
"result_noRP = optimize(scheme_noRP)"
" maximum_number_function_evaluations=7,\n",
")"
]
},
{
Expand Down Expand Up @@ -593,7 +603,8 @@
"axes[1][0].annotate(\"C\", xy=(0.01, 0.92), xycoords=\"axes fraction\", fontsize=16)\n",
"axes[1][1].annotate(\"D\", xy=(0.01, 0.92), xycoords=\"axes fraction\", fontsize=16)\n",
"for ax in axes[0:3, 0:3].flatten():\n",
" ax.axhline(0, color=\"k\", linewidth=1)"
" ax.axhline(0, color=\"k\", linewidth=1)\n",
"fig.tight_layout()"
]
}
],
Expand Down

0 comments on commit 01ba768

Please sign in to comment.