From cfc4c1b0df46fb596d15c484c3ab00fdc2f361da Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Sun, 3 Sep 2023 16:35:19 +0200 Subject: [PATCH] Unfortenate formatting of notebooks --- docs/notebooks/03Define_sections.ipynb | 8 +++--- .../04Calculate_variance_Stokes.ipynb | 10 +++---- docs/notebooks/07Calibrate_single_ended.ipynb | 16 ++++++------ docs/notebooks/08Calibrate_double_ended.ipynb | 26 +++++++++---------- .../12Datastore_from_numpy_arrays.ipynb | 16 ++++++------ .../13Fixed_parameter_calibration.ipynb | 6 ++--- docs/notebooks/14Lossy_splices.ipynb | 10 +++---- docs/notebooks/15Matching_sections.ipynb | 8 +++--- docs/notebooks/16Averaging_temperatures.ipynb | 14 +++++----- ...Temperature_uncertainty_single_ended.ipynb | 10 +++---- 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/docs/notebooks/03Define_sections.ipynb b/docs/notebooks/03Define_sections.ipynb index 8b1000ea..c342cd53 100644 --- a/docs/notebooks/03Define_sections.ipynb +++ b/docs/notebooks/03Define_sections.ipynb @@ -23,7 +23,7 @@ "source": [ "import os\n", "\n", - "from dtscalibration import read_silixa_files\n" + "from dtscalibration import read_silixa_files" ] }, { @@ -40,7 +40,7 @@ "outputs": [], "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"double_ended2\")\n", - "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")\n" + "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")" ] }, { @@ -67,7 +67,7 @@ "source": [ "print(ds.timeseries_keys) # list the available timeseeries\n", "ds.probe1Temperature.plot(figsize=(12, 8))\n", - "# plot one of the timeseries\n" + "# plot one of the timeseries" ] }, { @@ -116,7 +116,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0), slice(70.0, 80.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0), slice(85.0, 95.0)], # warm bath\n", - "}\n" + "}" ] }, { diff --git a/docs/notebooks/04Calculate_variance_Stokes.ipynb b/docs/notebooks/04Calculate_variance_Stokes.ipynb index 0de14167..a167e999 100644 --- a/docs/notebooks/04Calculate_variance_Stokes.ipynb +++ b/docs/notebooks/04Calculate_variance_Stokes.ipynb @@ -55,7 +55,7 @@ "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"double_ended2\")\n", "\n", - "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")\n" + "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")" ] }, { @@ -81,7 +81,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0), slice(70.0, 80.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0), slice(85.0, 95.0)], # warm bath\n", - "}\n" + "}" ] }, { @@ -125,7 +125,7 @@ " \"is approximately {:.2f} on a {:.1f} sec acquisition time\".format(\n", " I_var, ds.userAcquisitionTimeFW.data[0]\n", " )\n", - ")\n" + ")" ] }, { @@ -152,7 +152,7 @@ " robust=True,\n", " units=\"\",\n", " method=\"single\",\n", - ")\n" + ")" ] }, { @@ -186,7 +186,7 @@ "x = np.linspace(mean - 3 * sigma, mean + 3 * sigma, 100)\n", "approximated_normal_fit = scipy.stats.norm.pdf(x, mean, sigma)\n", "residuals.plot.hist(bins=50, figsize=(12, 8), density=True)\n", - "plt.plot(x, approximated_normal_fit)\n" + "plt.plot(x, approximated_normal_fit)" ] }, { diff --git a/docs/notebooks/07Calibrate_single_ended.ipynb b/docs/notebooks/07Calibrate_single_ended.ipynb index 4c591ede..7edf0a8a 100644 --- a/docs/notebooks/07Calibrate_single_ended.ipynb +++ b/docs/notebooks/07Calibrate_single_ended.ipynb @@ -72,7 +72,7 @@ "outputs": [], "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"single_ended\")\n", - "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")\n" + "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")" ] }, { @@ -93,7 +93,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(20, 25.5)], # warm bath\n", " \"probe2Temperature\": [slice(5.5, 15.5)], # cold bath\n", - "}\n" + "}" ] }, { @@ -120,7 +120,7 @@ "outputs": [], "source": [ "st_var, resid = ds.variance_stokes_constant(sections=sections, st_label=\"st\")\n", - "ast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"ast\")\n" + "ast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"ast\")" ] }, { @@ -136,7 +136,7 @@ "metadata": {}, "outputs": [], "source": [ - "resid.plot(figsize=(12, 4))\n" + "resid.plot(figsize=(12, 4))" ] }, { @@ -160,7 +160,7 @@ }, "outputs": [], "source": [ - "ds.calibration_single_ended(sections=sections, st_var=st_var, ast_var=ast_var)\n" + "ds.calibration_single_ended(sections=sections, st_var=st_var, ast_var=ast_var)" ] }, { @@ -177,7 +177,7 @@ "metadata": {}, "outputs": [], "source": [ - "ds.tmpf.plot(figsize=(12, 4))\n" + "ds.tmpf.plot(figsize=(12, 4))" ] }, { @@ -189,7 +189,7 @@ "ds1 = ds.isel(time=0)\n", "ds1.tmpf.plot(figsize=(12, 4))\n", "(ds1.tmpf_var**0.5).plot(figsize=(12, 4))\n", - "plt.ylabel(\"$\\sigma$ ($^\\circ$C)\")\n" + "plt.ylabel(\"$\\sigma$ ($^\\circ$C)\")" ] }, { @@ -217,7 +217,7 @@ "outputs": [], "source": [ "ds1.st.plot(figsize=(12, 8))\n", - "ds1.ast.plot()\n" + "ds1.ast.plot()" ] }, { diff --git a/docs/notebooks/08Calibrate_double_ended.ipynb b/docs/notebooks/08Calibrate_double_ended.ipynb index 21ba4b45..5f36c954 100644 --- a/docs/notebooks/08Calibrate_double_ended.ipynb +++ b/docs/notebooks/08Calibrate_double_ended.ipynb @@ -70,7 +70,7 @@ "\n", "ds_notaligned = read_silixa_files(\n", " directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\"\n", - ")\n" + ")" ] }, { @@ -102,7 +102,7 @@ }, "outputs": [], "source": [ - "ds_notaligned = ds_notaligned.sel(x=slice(0, 100)) # only calibrate parts of the fiber\n" + "ds_notaligned = ds_notaligned.sel(x=slice(0, 100)) # only calibrate parts of the fiber" ] }, { @@ -124,7 +124,7 @@ " plot_result=True,\n", " figsize=(12, 6),\n", ")\n", - "print(suggested_shift)\n" + "print(suggested_shift)" ] }, { @@ -140,7 +140,7 @@ "metadata": {}, "outputs": [], "source": [ - "ds = shift_double_ended(ds_notaligned, suggested_shift[0])\n" + "ds = shift_double_ended(ds_notaligned, suggested_shift[0])" ] }, { @@ -160,7 +160,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0), slice(70.0, 80.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0), slice(85.0, 95.0)], # warm bath\n", - "}\n" + "}" ] }, { @@ -189,7 +189,7 @@ "st_var, resid = ds.variance_stokes_constant(sections=sections, st_label=\"st\")\n", "ast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"ast\")\n", "rst_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"rst\")\n", - "rast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"rast\")\n" + "rast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"rast\")" ] }, { @@ -212,7 +212,7 @@ }, "outputs": [], "source": [ - "resid.plot(figsize=(12, 4))\n" + "resid.plot(figsize=(12, 4))" ] }, { @@ -242,7 +242,7 @@ " ast_var=ast_var,\n", " rst_var=rst_var,\n", " rast_var=rast_var,\n", - ")\n" + ")" ] }, { @@ -258,7 +258,7 @@ }, "outputs": [], "source": [ - "ds.tmpw.plot(figsize=(12, 4))\n" + "ds.tmpw.plot(figsize=(12, 4))" ] }, { @@ -296,7 +296,7 @@ "ds.tmpw_var.plot(figsize=(12, 4))\n", "ds1 = ds.isel(time=-1) # take only the first timestep\n", "(ds1.tmpw_var**0.5).plot(figsize=(12, 4))\n", - "plt.gca().set_ylabel(\"Standard error ($^\\circ$C)\")\n" + "plt.gca().set_ylabel(\"Standard error ($^\\circ$C)\")" ] }, { @@ -333,7 +333,7 @@ " mc_sample_size=500,\n", ") # < increase sample size for better approximation\n", "\n", - "ds.tmpw_mc_var.plot(figsize=(12, 4))\n" + "ds.tmpw_mc_var.plot(figsize=(12, 4))" ] }, { @@ -353,7 +353,7 @@ "ds1.tmpw.plot(linewidth=0.7, figsize=(12, 4))\n", "ds1.tmpw_mc.isel(CI=0).plot(linewidth=0.7, label=\"CI: 2.5%\")\n", "ds1.tmpw_mc.isel(CI=1).plot(linewidth=0.7, label=\"CI: 97.5%\")\n", - "plt.legend(fontsize=\"small\")\n" + "plt.legend(fontsize=\"small\")" ] }, { @@ -382,7 +382,7 @@ "(ds1.tmpb_var**0.5).plot()\n", "(ds1.tmpw_var**0.5).plot()\n", "(ds1.tmpw_mc_var**0.5).plot()\n", - "plt.ylabel(\"$\\sigma$ ($^\\circ$C)\")\n" + "plt.ylabel(\"$\\sigma$ ($^\\circ$C)\")" ] }, { diff --git a/docs/notebooks/12Datastore_from_numpy_arrays.ipynb b/docs/notebooks/12Datastore_from_numpy_arrays.ipynb index 1f3d3ce7..9cd233a5 100644 --- a/docs/notebooks/12Datastore_from_numpy_arrays.ipynb +++ b/docs/notebooks/12Datastore_from_numpy_arrays.ipynb @@ -26,7 +26,7 @@ "import matplotlib.pyplot as plt\n", "import xarray as xr\n", "\n", - "from dtscalibration import DataStore, read_silixa_files\n" + "from dtscalibration import DataStore, read_silixa_files" ] }, { @@ -61,7 +61,7 @@ "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"single_ended\")\n", "\n", - "ds_silixa = read_silixa_files(directory=filepath, silent=True)\n" + "ds_silixa = read_silixa_files(directory=filepath, silent=True)" ] }, { @@ -89,7 +89,7 @@ "x = ds_silixa.x.values\n", "time = ds_silixa.time.values\n", "ST = ds_silixa.st.values\n", - "AST = ds_silixa.ast.values\n" + "AST = ds_silixa.ast.values" ] }, { @@ -116,7 +116,7 @@ "ds[\"x\"] = (\"x\", x)\n", "ds[\"time\"] = (\"time\", time)\n", "ds[\"st\"] = ([\"x\", \"time\"], ST)\n", - "ds[\"ast\"] = ([\"x\", \"time\"], AST)\n" + "ds[\"ast\"] = ([\"x\", \"time\"], AST)" ] }, { @@ -133,7 +133,7 @@ "outputs": [], "source": [ "ds = DataStore(ds)\n", - "print(ds)\n" + "print(ds)" ] }, { @@ -169,7 +169,7 @@ "ds[\"temp1\"] = ds_silixa[\"probe1Temperature\"]\n", "ds[\"temp2\"] = ds_silixa[\"probe2Temperature\"]\n", "\n", - "ds.attrs[\"isDoubleEnded\"] = \"0\"\n" + "ds.attrs[\"isDoubleEnded\"] = \"0\"" ] }, { @@ -202,7 +202,7 @@ "ast_var, _ = ds.variance_stokes_constant(sections=sections, st_label=\"ast\")\n", "ds.calibration_single_ended(sections=sections, st_var=st_var, ast_var=ast_var)\n", "\n", - "ds.isel(time=0).tmpf.plot()\n" + "ds.isel(time=0).tmpf.plot()" ] }, { @@ -211,7 +211,7 @@ "metadata": {}, "outputs": [], "source": [ - "ds\n" + "ds" ] }, { diff --git a/docs/notebooks/13Fixed_parameter_calibration.ipynb b/docs/notebooks/13Fixed_parameter_calibration.ipynb index cf5a78c1..fc2642ae 100644 --- a/docs/notebooks/13Fixed_parameter_calibration.ipynb +++ b/docs/notebooks/13Fixed_parameter_calibration.ipynb @@ -76,7 +76,7 @@ " ast_var=ast_var,\n", " fix_gamma=fix_gamma,\n", " fix_dalpha=fix_dalpha,\n", - ")\n" + ")" ] }, { @@ -100,7 +100,7 @@ "outputs": [], "source": [ "print(\"gamma used in calibration:\", ds100.gamma.values)\n", - "print(\"dalpha used in calibration:\", ds100.dalpha.values)\n" + "print(\"dalpha used in calibration:\", ds100.dalpha.values)" ] }, { @@ -132,7 +132,7 @@ " linewidth=1, label=\"Device calibrated\"\n", ") # plot the temperature calibrated by the device\n", "plt.title(\"Temperature at the first time step\")\n", - "plt.legend()\n" + "plt.legend()" ] }, { diff --git a/docs/notebooks/14Lossy_splices.ipynb b/docs/notebooks/14Lossy_splices.ipynb index 5e41b774..977969f3 100644 --- a/docs/notebooks/14Lossy_splices.ipynb +++ b/docs/notebooks/14Lossy_splices.ipynb @@ -72,7 +72,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0), slice(70.0, 80.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0), slice(85.0, 95.0)], # warm bath\n", - "}\n" + "}" ] }, { @@ -101,7 +101,7 @@ "ds[\"ast\"] = ds.ast.where(ds.x < 50, ds.ast * 0.82)\n", "\n", "ds[\"rst\"] = ds.rst.where(ds.x > 50, ds.rst * 0.85)\n", - "ds[\"rast\"] = ds.rast.where(ds.x > 50, ds.rast * 0.81)\n" + "ds[\"rast\"] = ds.rast.where(ds.x > 50, ds.rast * 0.81)" ] }, { @@ -121,7 +121,7 @@ "ds.isel(time=0).ast.plot(label=\"ast\")\n", "ds.isel(time=0).rst.plot(label=\"rst\")\n", "ds.isel(time=0).rast.plot(label=\"rast\")\n", - "plt.legend()\n" + "plt.legend()" ] }, { @@ -159,7 +159,7 @@ " rast_var=rast_var,\n", ")\n", "\n", - "ds_a.isel(time=0).tmpw.plot(label=\"calibrated\")\n" + "ds_a.isel(time=0).tmpw.plot(label=\"calibrated\")" ] }, { @@ -200,7 +200,7 @@ "\n", "ds_a.isel(time=0).tmpw.plot(label=\"no trans. att.\")\n", "ds.isel(time=0).tmpw.plot(label=\"with trans. att.\")\n", - "plt.legend()\n" + "plt.legend()" ] }, { diff --git a/docs/notebooks/15Matching_sections.ipynb b/docs/notebooks/15Matching_sections.ipynb index cb709b50..3017c04b 100644 --- a/docs/notebooks/15Matching_sections.ipynb +++ b/docs/notebooks/15Matching_sections.ipynb @@ -68,7 +68,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0)], # warm bath\n", - "}\n" + "}" ] }, { @@ -95,7 +95,7 @@ "ds[\"ast\"] = ds.ast.where(ds.x < 50, ds.ast * 0.82)\n", "\n", "ds[\"rst\"] = ds.rst.where(ds.x > 50, ds.rst * 0.85)\n", - "ds[\"rast\"] = ds.rast.where(ds.x > 50, ds.rast * 0.81)\n" + "ds[\"rast\"] = ds.rast.where(ds.x > 50, ds.rast * 0.81)" ] }, { @@ -135,7 +135,7 @@ " rast_var=rast_var,\n", ")\n", "\n", - "ds_a.isel(time=0).tmpw.plot(label=\"calibrated\")\n" + "ds_a.isel(time=0).tmpw.plot(label=\"calibrated\")" ] }, { @@ -185,7 +185,7 @@ "\n", "ds_a.isel(time=0).tmpw.plot(label=\"normal calibration\")\n", "ds.isel(time=0).tmpw.plot(label=\"matching sections\")\n", - "plt.legend()\n" + "plt.legend()" ] }, { diff --git a/docs/notebooks/16Averaging_temperatures.ipynb b/docs/notebooks/16Averaging_temperatures.ipynb index 76925061..2d97bb85 100644 --- a/docs/notebooks/16Averaging_temperatures.ipynb +++ b/docs/notebooks/16Averaging_temperatures.ipynb @@ -63,7 +63,7 @@ "sections = {\n", " \"probe1Temperature\": [slice(7.5, 17.0), slice(70.0, 80.0)], # cold bath\n", " \"probe2Temperature\": [slice(24.0, 34.0), slice(85.0, 95.0)], # warm bath\n", - "}\n" + "}" ] }, { @@ -82,7 +82,7 @@ "st_var, resid = ds.variance_stokes(sections=sections, st_label=\"st\")\n", "ast_var, _ = ds.variance_stokes(sections=sections, st_label=\"ast\")\n", "rst_var, _ = ds.variance_stokes(sections=sections, st_label=\"rst\")\n", - "rast_var, _ = ds.variance_stokes(sections=sections, st_label=\"rast\")\n" + "rast_var, _ = ds.variance_stokes(sections=sections, st_label=\"rast\")" ] }, { @@ -104,7 +104,7 @@ " ast_var=ast_var,\n", " rst_var=rst_var,\n", " rast_var=rast_var,\n", - ")\n" + ")" ] }, { @@ -191,7 +191,7 @@ " ci_avg_time_isel=[0, 1, 2, 3, 4, 5],\n", " ci_avg_time_sel=None,\n", ")\n", - "ds.tmpw_mc_avg1.plot(hue=\"CI\", linewidth=0.8)\n" + "ds.tmpw_mc_avg1.plot(hue=\"CI\", linewidth=0.8)" ] }, { @@ -252,7 +252,7 @@ " ci_avg_time_isel=[0, 1, 2, 3, 4, 5],\n", " ci_avg_time_sel=None,\n", ")\n", - "ds.tmpw_mc_avg2.plot(hue=\"CI\", linewidth=0.8)\n" + "ds.tmpw_mc_avg2.plot(hue=\"CI\", linewidth=0.8)" ] }, { @@ -313,7 +313,7 @@ " ci_avg_x_sel=slice(7.5, 17.0),\n", " ci_avg_x_isel=None,\n", ")\n", - "ds.tmpw_mc_avgx1.plot(hue=\"CI\", linewidth=0.8)\n" + "ds.tmpw_mc_avgx1.plot(hue=\"CI\", linewidth=0.8)" ] }, { @@ -374,7 +374,7 @@ " ci_avg_x_sel=slice(7.5, 17.0),\n", " ci_avg_x_isel=None,\n", ")\n", - "ds.tmpw_mc_avgx2.plot(hue=\"CI\", linewidth=0.8)\n" + "ds.tmpw_mc_avgx2.plot(hue=\"CI\", linewidth=0.8)" ] }, { diff --git a/docs/notebooks/17Temperature_uncertainty_single_ended.ipynb b/docs/notebooks/17Temperature_uncertainty_single_ended.ipynb index 478a490e..301e4963 100644 --- a/docs/notebooks/17Temperature_uncertainty_single_ended.ipynb +++ b/docs/notebooks/17Temperature_uncertainty_single_ended.ipynb @@ -73,7 +73,7 @@ "plt.fill_between(ds1.x, y1=ds1.tmpf_var, y2=stast_var, label=\"Parameter estimation\")\n", "plt.suptitle(\"Variance of the estimated temperature\")\n", "plt.ylabel(\"$\\sigma^2$ ($^\\circ$C$^2$)\")\n", - "plt.legend(fontsize=\"small\")\n" + "plt.legend(fontsize=\"small\")" ] }, { @@ -84,7 +84,7 @@ "outputs": [], "source": [ "# The effects of the parameter uncertainty can be further inspected\n", - "ds1.var_fw_da.plot(hue=\"comp_fw\", figsize=(12, 4))\n" + "ds1.var_fw_da.plot(hue=\"comp_fw\", figsize=(12, 4))" ] }, { @@ -121,7 +121,7 @@ "source": [ "ds.conf_int_single_ended(\n", " st_var=st_var, ast_var=ast_var, conf_ints=[2.5, 97.5], mc_sample_size=500\n", - ")\n" + ")" ] }, { @@ -145,7 +145,7 @@ "(ds1.tmpf_mc_var**0.5).plot(figsize=(12, 4), label=\"Monte Carlo approx.\")\n", "(ds1.tmpf_var**0.5).plot(label=\"Linear error approx.\")\n", "plt.ylabel(\"$\\sigma$ ($^\\circ$C)\")\n", - "plt.legend(fontsize=\"small\")\n" + "plt.legend(fontsize=\"small\")" ] }, { @@ -166,7 +166,7 @@ "ds1.tmpf.plot(linewidth=0.7, figsize=(12, 4))\n", "ds1.tmpf_mc.sel(CI=2.5).plot(linewidth=0.7, label=\"CI: 2.5%\")\n", "ds1.tmpf_mc.sel(CI=97.5).plot(linewidth=0.7, label=\"CI: 97.5%\")\n", - "plt.legend(fontsize=\"small\")\n" + "plt.legend(fontsize=\"small\")" ] }, {