Skip to content

Commit

Permalink
Unfortenate formatting of notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed Sep 3, 2023
1 parent a40c810 commit cfc4c1b
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 62 deletions.
8 changes: 4 additions & 4 deletions docs/notebooks/03Define_sections.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"source": [
"import os\n",
"\n",
"from dtscalibration import read_silixa_files\n"
"from dtscalibration import read_silixa_files"
]
},
{
Expand All @@ -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\")"
]
},
{
Expand All @@ -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"
]
},
{
Expand Down Expand Up @@ -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"
"}"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions docs/notebooks/04Calculate_variance_Stokes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
},
{
Expand All @@ -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"
"}"
]
},
{
Expand Down Expand Up @@ -125,7 +125,7 @@
" \"is approximately {:.2f} on a {:.1f} sec acquisition time\".format(\n",
" I_var, ds.userAcquisitionTimeFW.data[0]\n",
" )\n",
")\n"
")"
]
},
{
Expand All @@ -152,7 +152,7 @@
" robust=True,\n",
" units=\"\",\n",
" method=\"single\",\n",
")\n"
")"
]
},
{
Expand Down Expand Up @@ -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)"
]
},
{
Expand Down
16 changes: 8 additions & 8 deletions docs/notebooks/07Calibrate_single_ended.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
},
{
Expand All @@ -93,7 +93,7 @@
"sections = {\n",
" \"probe1Temperature\": [slice(20, 25.5)], # warm bath\n",
" \"probe2Temperature\": [slice(5.5, 15.5)], # cold bath\n",
"}\n"
"}"
]
},
{
Expand All @@ -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\")"
]
},
{
Expand All @@ -136,7 +136,7 @@
"metadata": {},
"outputs": [],
"source": [
"resid.plot(figsize=(12, 4))\n"
"resid.plot(figsize=(12, 4))"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -177,7 +177,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds.tmpf.plot(figsize=(12, 4))\n"
"ds.tmpf.plot(figsize=(12, 4))"
]
},
{
Expand All @@ -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)\")"
]
},
{
Expand Down Expand Up @@ -217,7 +217,7 @@
"outputs": [],
"source": [
"ds1.st.plot(figsize=(12, 8))\n",
"ds1.ast.plot()\n"
"ds1.ast.plot()"
]
},
{
Expand Down
26 changes: 13 additions & 13 deletions docs/notebooks/08Calibrate_double_ended.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"\n",
"ds_notaligned = read_silixa_files(\n",
" directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\"\n",
")\n"
")"
]
},
{
Expand Down Expand Up @@ -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"
]
},
{
Expand All @@ -124,7 +124,7 @@
" plot_result=True,\n",
" figsize=(12, 6),\n",
")\n",
"print(suggested_shift)\n"
"print(suggested_shift)"
]
},
{
Expand All @@ -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])"
]
},
{
Expand All @@ -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"
"}"
]
},
{
Expand Down Expand Up @@ -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\")"
]
},
{
Expand All @@ -212,7 +212,7 @@
},
"outputs": [],
"source": [
"resid.plot(figsize=(12, 4))\n"
"resid.plot(figsize=(12, 4))"
]
},
{
Expand Down Expand Up @@ -242,7 +242,7 @@
" ast_var=ast_var,\n",
" rst_var=rst_var,\n",
" rast_var=rast_var,\n",
")\n"
")"
]
},
{
Expand All @@ -258,7 +258,7 @@
},
"outputs": [],
"source": [
"ds.tmpw.plot(figsize=(12, 4))\n"
"ds.tmpw.plot(figsize=(12, 4))"
]
},
{
Expand Down Expand Up @@ -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)\")"
]
},
{
Expand Down Expand Up @@ -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))"
]
},
{
Expand All @@ -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\")"
]
},
{
Expand Down Expand Up @@ -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)\")"
]
},
{
Expand Down
16 changes: 8 additions & 8 deletions docs/notebooks/12Datastore_from_numpy_arrays.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -133,7 +133,7 @@
"outputs": [],
"source": [
"ds = DataStore(ds)\n",
"print(ds)\n"
"print(ds)"
]
},
{
Expand Down Expand Up @@ -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\""
]
},
{
Expand Down Expand Up @@ -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()"
]
},
{
Expand All @@ -211,7 +211,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds\n"
"ds"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/notebooks/13Fixed_parameter_calibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
" ast_var=ast_var,\n",
" fix_gamma=fix_gamma,\n",
" fix_dalpha=fix_dalpha,\n",
")\n"
")"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down Expand Up @@ -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()"
]
},
{
Expand Down
Loading

0 comments on commit cfc4c1b

Please sign in to comment.