From 1e8c7258c43bd5a62886f69dfc125794fb3e6953 Mon Sep 17 00:00:00 2001 From: Sunniva Indrehus Date: Tue, 22 Oct 2024 21:10:53 +0200 Subject: [PATCH] content: talk structure --- demo/demo/parameters_values_lmfit.py | 38 ++-- talk/slides.html | 279 +++++++++++++++------------ talk/slides.md | 185 ++++++++++-------- 3 files changed, 283 insertions(+), 219 deletions(-) diff --git a/demo/demo/parameters_values_lmfit.py b/demo/demo/parameters_values_lmfit.py index 7a06b15..70cae82 100644 --- a/demo/demo/parameters_values_lmfit.py +++ b/demo/demo/parameters_values_lmfit.py @@ -1,11 +1,11 @@ import numpy as np -from lmfit import Minimizer, create_params, report_fit, minimize +from lmfit import Minimizer, create_params, report_fit import matplotlib.pyplot as plt import matplotlib -matplotlib.use("Agg") +matplotlib.use("Agg") # create data to be fitted @@ -20,17 +20,16 @@ ) -# define objective function: returns the array to be minimized -def fcn2min(params, x, data): - """Model a decaying sine wave and subtract data.""" - v = params.valuesdict() - - model = v["amp"] * np.sin(x * v["omega"] + v["shift"]) * np.exp(-x * x * v["decay"]) +def residual(parameters, x, data): + model = ( + parameters["amp"] + * np.sin(x * parameters["omega"] + parameters["shift"]) + * np.exp(-x * x * parameters["decay"]) + ) return model - data -# create a set of Parameters -params = create_params( +parameters_initial = create_params( amp=dict(value=10, min=0), decay=0.1, omega=3.0, @@ -38,24 +37,23 @@ def fcn2min(params, x, data): ) initial_model = ( - params["amp"].value - * np.sin(x * params["omega"].value + params["shift"].value) - * np.exp(-x * x * params["decay"].value) + parameters_initial["amp"].value + * np.sin(x * parameters_initial["omega"].value + parameters_initial["shift"].value) + * np.exp(-x * x * parameters_initial["decay"].value) ) -# do fit, here with the default leastsq algorithm -minner = Minimizer(fcn2min, params, fcn_args=(x, data)) -result = minner.minimize(method="least_squares") -# calculate final result +minimizer = Minimizer(residual, parameters_initial, fcn_args=(x, data)) +result = minimizer.minimize(method="least_squares") + +# calculate final final = data + result.residual # write error report report_fit(result) -# try to plot results -plt.plot(x, data, "+", label="data", color="red") +plt.scatter(x, data, label="data", color="red") plt.plot(x, initial_model, label="initial", linestyle="--", color="green") plt.plot(x, final, label="final", color="blue") plt.legend() -plt.savefig("parameters_values_lmfit.png") +plt.savefig("parameters_values_lmfit.png", bbox_inches="tight", pad_inches=0.03) diff --git a/talk/slides.html b/talk/slides.html index dd01bd2..8ba9750 100755 --- a/talk/slides.html +++ b/talk/slides.html @@ -12,17 +12,49 @@ /* content:""; */display:table}div#\:\$p>svg>foreignObject>section:after{clear:both}div#\:\$p>svg>foreignObject>section>:first-child{margin-top:0!important}div#\:\$p>svg>foreignObject>section>:last-child{margin-bottom:0!important}div#\:\$p>svg>foreignObject>section a:not([href]){color:inherit;text-decoration:none}div#\:\$p>svg>foreignObject>section .absent{color:var(--color-danger-fg)}div#\:\$p>svg>foreignObject>section .anchor{float:left;line-height:1;margin-left:-20px;padding-right:4px}div#\:\$p>svg>foreignObject>section .anchor:focus{outline:none}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre),div#\:\$p>svg>foreignObject>section blockquote,div#\:\$p>svg>foreignObject>section details,div#\:\$p>svg>foreignObject>section dl,div#\:\$p>svg>foreignObject>section ol,div#\:\$p>svg>foreignObject>section p,div#\:\$p>svg>foreignObject>section table,div#\:\$p>svg>foreignObject>section ul{margin-bottom:16px;margin-top:0}div#\:\$p>svg>foreignObject>section blockquote>:first-child{margin-top:0}div#\:\$p>svg>foreignObject>section blockquote>:last-child{margin-bottom:0}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1) .octicon-link,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2) .octicon-link,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3) .octicon-link,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4) .octicon-link,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5) .octicon-link,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6) .octicon-link{color:var(--color-fg-default);vertical-align:middle;visibility:hidden}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1):hover .anchor,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2):hover .anchor,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3):hover .anchor,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4):hover .anchor,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5):hover .anchor,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6):hover .anchor{text-decoration:none}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1):hover .anchor .octicon-link,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2):hover .anchor .octicon-link,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3):hover .anchor .octicon-link,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4):hover .anchor .octicon-link,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5):hover .anchor .octicon-link,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6):hover .anchor .octicon-link{visibility:visible}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1) code,div#\:\$p>svg>foreignObject>section :is(h1,marp-h1) tt,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2) code,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2) tt,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3) code,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3) tt,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4) code,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4) tt,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5) code,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5) tt,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6) code,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6) tt{font-size:inherit;padding:0 .2em}div#\:\$p>svg>foreignObject>section summary :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section summary :is(h2,marp-h2),div#\:\$p>svg>foreignObject>section summary :is(h3,marp-h3),div#\:\$p>svg>foreignObject>section summary :is(h4,marp-h4),div#\:\$p>svg>foreignObject>section summary :is(h5,marp-h5),div#\:\$p>svg>foreignObject>section summary :is(h6,marp-h6){display:inline-block}div#\:\$p>svg>foreignObject>section summary :is(h1,marp-h1) .anchor,div#\:\$p>svg>foreignObject>section summary :is(h2,marp-h2) .anchor,div#\:\$p>svg>foreignObject>section summary :is(h3,marp-h3) .anchor,div#\:\$p>svg>foreignObject>section summary :is(h4,marp-h4) .anchor,div#\:\$p>svg>foreignObject>section summary :is(h5,marp-h5) .anchor,div#\:\$p>svg>foreignObject>section summary :is(h6,marp-h6) .anchor{margin-left:-40px}div#\:\$p>svg>foreignObject>section summary :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section summary :is(h2,marp-h2){border-bottom:0;padding-bottom:0}div#\:\$p>svg>foreignObject>section ol.no-list,div#\:\$p>svg>foreignObject>section ul.no-list{list-style-type:none;padding:0}div#\:\$p>svg>foreignObject>section ol[type=a]{list-style-type:lower-alpha}div#\:\$p>svg>foreignObject>section ol[type=A]{list-style-type:upper-alpha}div#\:\$p>svg>foreignObject>section ol[type=i]{list-style-type:lower-roman}div#\:\$p>svg>foreignObject>section ol[type=I]{list-style-type:upper-roman}div#\:\$p>svg>foreignObject>section div>ol:not([type]),div#\:\$p>svg>foreignObject>section ol[type="1"]{list-style-type:decimal}div#\:\$p>svg>foreignObject>section ol ol,div#\:\$p>svg>foreignObject>section ol ul,div#\:\$p>svg>foreignObject>section ul ol,div#\:\$p>svg>foreignObject>section ul ul{margin-bottom:0;margin-top:0}div#\:\$p>svg>foreignObject>section li>p{margin-top:16px}div#\:\$p>svg>foreignObject>section li+li{margin-top:.25em}div#\:\$p>svg>foreignObject>section dl{padding:0}div#\:\$p>svg>foreignObject>section dl dt{font-size:1em;font-style:italic;font-weight:var(--base-text-weight-semibold,600);margin-top:16px;padding:0}div#\:\$p>svg>foreignObject>section dl dd{margin-bottom:16px;padding:0 16px}div#\:\$p>svg>foreignObject>section table th{font-weight:var(--base-text-weight-semibold,600)}div#\:\$p>svg>foreignObject>section table td,div#\:\$p>svg>foreignObject>section table th{border:1px solid var(--color-border-default);padding:6px 13px}div#\:\$p>svg>foreignObject>section table tr{background-color:var(--color-canvas-default);border-top:1px solid var(--color-border-muted)}div#\:\$p>svg>foreignObject>section table tr:nth-child(2n){background-color:var(--color-canvas-subtle)}div#\:\$p>svg>foreignObject>section table img{background-color:transparent}div#\:\$p>svg>foreignObject>section img[align=right]{padding-left:20px}div#\:\$p>svg>foreignObject>section img[align=left]{padding-right:20px}div#\:\$p>svg>foreignObject>section .emoji{background-color:transparent;max-width:none;vertical-align:text-top}div#\:\$p>svg>foreignObject>section :is(span,marp-span).frame,div#\:\$p>svg>foreignObject>section :is(span,marp-span).frame>:is(span,marp-span){display:block;overflow:hidden}div#\:\$p>svg>foreignObject>section :is(span,marp-span).frame>:is(span,marp-span){border:1px solid var(--color-border-default);float:left;margin:13px 0 0;padding:7px;width:auto}div#\:\$p>svg>foreignObject>section :is(span,marp-span).frame :is(span,marp-span) img{display:block;float:left}div#\:\$p>svg>foreignObject>section :is(span,marp-span).frame :is(span,marp-span) :is(span,marp-span){clear:both;color:var(--color-fg-default);display:block;padding:5px 0 0}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-center{clear:both;display:block;overflow:hidden}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-center>:is(span,marp-span){display:block;margin:13px auto 0;overflow:hidden;text-align:center}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-center :is(span,marp-span) img{margin:0 auto;text-align:center}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-right{clear:both;display:block;overflow:hidden}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-right>:is(span,marp-span){display:block;margin:13px 0 0;overflow:hidden;text-align:right}div#\:\$p>svg>foreignObject>section :is(span,marp-span).align-right :is(span,marp-span) img{margin:0;text-align:right}div#\:\$p>svg>foreignObject>section :is(span,marp-span).float-left{display:block;float:left;margin-right:13px;overflow:hidden}div#\:\$p>svg>foreignObject>section :is(span,marp-span).float-left :is(span,marp-span){margin:13px 0 0}div#\:\$p>svg>foreignObject>section :is(span,marp-span).float-right{display:block;float:right;margin-left:13px;overflow:hidden}div#\:\$p>svg>foreignObject>section :is(span,marp-span).float-right>:is(span,marp-span){display:block;margin:13px auto 0;overflow:hidden;text-align:right}div#\:\$p>svg>foreignObject>section code,div#\:\$p>svg>foreignObject>section tt{background-color:var(--color-neutral-muted);border-radius:6px;font-size:85%;margin:0;padding:.2em .4em;white-space:break-spaces}div#\:\$p>svg>foreignObject>section code br,div#\:\$p>svg>foreignObject>section tt br{display:none}div#\:\$p>svg>foreignObject>section del code{text-decoration:inherit}div#\:\$p>svg>foreignObject>section samp{font-size:85%}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) code{font-size:100%}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre)>code{background:transparent;border:0;margin:0;padding:0;white-space:pre;word-break:normal}div#\:\$p>svg>foreignObject>section .highlight{margin-bottom:16px}div#\:\$p>svg>foreignObject>section .highlight :is(pre,marp-pre){margin-bottom:0;word-break:normal}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre){background-color:var(--color-canvas-subtle);border-radius:6px;font-size:85%;line-height:1.45;overflow:auto;padding:16px}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) code,div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) tt{word-wrap:normal;background-color:transparent;border:0;display:inline;line-height:inherit;margin:0;max-width:auto;overflow:visible;padding:0}div#\:\$p>svg>foreignObject>section .csv-data td,div#\:\$p>svg>foreignObject>section .csv-data th{font-size:12px;line-height:1;overflow:hidden;padding:5px;text-align:left;white-space:nowrap}div#\:\$p>svg>foreignObject>section .csv-data .blob-num{background:var(--color-canvas-default);border:0;padding:10px 8px 9px;text-align:right}div#\:\$p>svg>foreignObject>section .csv-data tr{border-top:0}div#\:\$p>svg>foreignObject>section .csv-data th{background:var(--color-canvas-subtle);border-top:0;font-weight:var(--base-text-weight-semibold,600)}div#\:\$p>svg>foreignObject>section [data-footnote-ref]:before{content:"["}div#\:\$p>svg>foreignObject>section [data-footnote-ref]:after{content:"]"}div#\:\$p>svg>foreignObject>section .footnotes{border-top:1px solid var(--color-border-default);color:var(--color-fg-muted);font-size:12px}div#\:\$p>svg>foreignObject>section div#\:\$p>svg>foreignObject>section section.footnotes{--marpit-root-font-size:12px}div#\:\$p>svg>foreignObject>section .footnotes ol{padding-left:16px}div#\:\$p>svg>foreignObject>section .footnotes ol ul{display:inline-block;margin-top:16px;padding-left:16px}div#\:\$p>svg>foreignObject>section .footnotes li{position:relative}div#\:\$p>svg>foreignObject>section .footnotes li:target:before{border:2px solid var(--color-accent-emphasis);border-radius:6px;bottom:-8px;content:"";left:-24px;pointer-events:none;position:absolute;right:-8px;top:-8px}div#\:\$p>svg>foreignObject>section .footnotes li:target{color:var(--color-fg-default)}div#\:\$p>svg>foreignObject>section .footnotes .data-footnote-backref g-emoji{font-family:monospace}div#\:\$p>svg>foreignObject>section .pl-c{color:var(--color-prettylights-syntax-comment)}div#\:\$p>svg>foreignObject>section .pl-c1,div#\:\$p>svg>foreignObject>section .pl-s .pl-v{color:var(--color-prettylights-syntax-constant)}div#\:\$p>svg>foreignObject>section .pl-e,div#\:\$p>svg>foreignObject>section .pl-en{color:var(--color-prettylights-syntax-entity)}div#\:\$p>svg>foreignObject>section .pl-s .pl-s1,div#\:\$p>svg>foreignObject>section .pl-smi{color:var(--color-prettylights-syntax-storage-modifier-import)}div#\:\$p>svg>foreignObject>section .pl-ent{color:var(--color-prettylights-syntax-entity-tag)}div#\:\$p>svg>foreignObject>section .pl-k{color:var(--color-prettylights-syntax-keyword)}div#\:\$p>svg>foreignObject>section .pl-pds,div#\:\$p>svg>foreignObject>section .pl-s,div#\:\$p>svg>foreignObject>section .pl-s .pl-pse .pl-s1,div#\:\$p>svg>foreignObject>section .pl-sr,div#\:\$p>svg>foreignObject>section .pl-sr .pl-cce,div#\:\$p>svg>foreignObject>section .pl-sr .pl-sra,div#\:\$p>svg>foreignObject>section .pl-sr .pl-sre{color:var(--color-prettylights-syntax-string)}div#\:\$p>svg>foreignObject>section .pl-smw,div#\:\$p>svg>foreignObject>section .pl-v{color:var(--color-prettylights-syntax-variable)}div#\:\$p>svg>foreignObject>section .pl-bu{color:var(--color-prettylights-syntax-brackethighlighter-unmatched)}div#\:\$p>svg>foreignObject>section .pl-ii{background-color:var(--color-prettylights-syntax-invalid-illegal-bg);color:var(--color-prettylights-syntax-invalid-illegal-text)}div#\:\$p>svg>foreignObject>section .pl-c2{background-color:var(--color-prettylights-syntax-carriage-return-bg);color:var(--color-prettylights-syntax-carriage-return-text)}div#\:\$p>svg>foreignObject>section .pl-sr .pl-cce{color:var(--color-prettylights-syntax-string-regexp);font-weight:700}div#\:\$p>svg>foreignObject>section .pl-ml{color:var(--color-prettylights-syntax-markup-list)}div#\:\$p>svg>foreignObject>section .pl-mh,div#\:\$p>svg>foreignObject>section .pl-mh .pl-en,div#\:\$p>svg>foreignObject>section .pl-ms{color:var(--color-prettylights-syntax-markup-heading);font-weight:700}div#\:\$p>svg>foreignObject>section .pl-mi{color:var(--color-prettylights-syntax-markup-italic);font-style:italic}div#\:\$p>svg>foreignObject>section .pl-mb{color:var(--color-prettylights-syntax-markup-bold);font-weight:700}div#\:\$p>svg>foreignObject>section .pl-md{background-color:var(--color-prettylights-syntax-markup-deleted-bg);color:var(--color-prettylights-syntax-markup-deleted-text)}div#\:\$p>svg>foreignObject>section .pl-mi1{background-color:var(--color-prettylights-syntax-markup-inserted-bg);color:var(--color-prettylights-syntax-markup-inserted-text)}div#\:\$p>svg>foreignObject>section .pl-mc{background-color:var(--color-prettylights-syntax-markup-changed-bg);color:var(--color-prettylights-syntax-markup-changed-text)}div#\:\$p>svg>foreignObject>section .pl-mi2{background-color:var(--color-prettylights-syntax-markup-ignored-bg);color:var(--color-prettylights-syntax-markup-ignored-text)}div#\:\$p>svg>foreignObject>section .pl-mdr{color:var(--color-prettylights-syntax-meta-diff-range);font-weight:700}div#\:\$p>svg>foreignObject>section .pl-ba{color:var(--color-prettylights-syntax-brackethighlighter-angle)}div#\:\$p>svg>foreignObject>section .pl-sg{color:var(--color-prettylights-syntax-sublimelinter-gutter-mark)}div#\:\$p>svg>foreignObject>section .pl-corl{color:var(--color-prettylights-syntax-constant-other-reference-link);text-decoration:underline}div#\:\$p>svg>foreignObject>section g-emoji{display:inline-block;font-family:Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:1em;font-style:normal!important;font-weight:var(--base-text-weight-normal,400);line-height:1;min-width:1ch;vertical-align:-.075em}div#\:\$p>svg>foreignObject>section g-emoji img{height:1em;width:1em}div#\:\$p>svg>foreignObject>section .task-list-item{list-style-type:none}div#\:\$p>svg>foreignObject>section .task-list-item label{font-weight:var(--base-text-weight-normal,400)}div#\:\$p>svg>foreignObject>section .task-list-item.enabled label{cursor:pointer}div#\:\$p>svg>foreignObject>section .task-list-item+.task-list-item{margin-top:4px}div#\:\$p>svg>foreignObject>section .task-list-item .handle{display:none}div#\:\$p>svg>foreignObject>section .task-list-item-checkbox{margin:0 .2em .25em -1.4em;vertical-align:middle}div#\:\$p>svg>foreignObject>section .contains-task-list:dir(rtl) .task-list-item-checkbox{margin:0 -1.6em .25em .2em}div#\:\$p>svg>foreignObject>section .contains-task-list{position:relative}div#\:\$p>svg>foreignObject>section .contains-task-list:focus-within .task-list-item-convert-container,div#\:\$p>svg>foreignObject>section .contains-task-list:hover .task-list-item-convert-container{clip:auto;display:block;height:24px;overflow:visible;width:auto}div#\:\$p>svg>foreignObject>section ::-webkit-calendar-picker-indicator{filter:invert(50%)}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1){color:var(--h1-color);font-size:1.6em}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section :is(h2,marp-h2){border-bottom:none}div#\:\$p>svg>foreignObject>section :is(h2,marp-h2){font-size:1.3em}div#\:\$p>svg>foreignObject>section :is(h3,marp-h3){font-size:1.1em}div#\:\$p>svg>foreignObject>section :is(h4,marp-h4){font-size:1.05em}div#\:\$p>svg>foreignObject>section :is(h5,marp-h5){font-size:1em}div#\:\$p>svg>foreignObject>section :is(h6,marp-h6){font-size:.9em}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1) strong,div#\:\$p>svg>foreignObject>section :is(h2,marp-h2) strong,div#\:\$p>svg>foreignObject>section :is(h3,marp-h3) strong,div#\:\$p>svg>foreignObject>section :is(h4,marp-h4) strong,div#\:\$p>svg>foreignObject>section :is(h5,marp-h5) strong,div#\:\$p>svg>foreignObject>section :is(h6,marp-h6) strong{color:var(--heading-strong-color);font-weight:inherit}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h2,marp-h2)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h3,marp-h3)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h4,marp-h4)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h5,marp-h5)::part(auto-scaling),div#\:\$p>svg>foreignObject>section :is(h6,marp-h6)::part(auto-scaling){max-height:563px}div#\:\$p>svg>foreignObject>section hr{height:0;padding-top:.25em}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre){border:1px solid var(--color-border-default);line-height:1.15;overflow:visible}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre)::part(auto-scaling){max-height:529px}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs){color:var(--color-prettylights-syntax-storage-modifier-import)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-doctag),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-keyword),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-meta .hljs-keyword),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-template-tag),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-template-variable),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-type),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-variable.language_){color:var(--color-prettylights-syntax-keyword)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-title),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-title.class_),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-title.class_.inherited__),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-title.function_){color:var(--color-prettylights-syntax-entity)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-attr),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-attribute),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-literal),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-meta),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-number),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-operator),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-selector-attr),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-selector-class),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-selector-id),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-variable){color:var(--color-prettylights-syntax-constant)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-meta .hljs-string),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-regexp),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-string){color:var(--color-prettylights-syntax-string)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-built_in),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-symbol){color:var(--color-prettylights-syntax-variable)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-code),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-comment),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-formula){color:var(--color-prettylights-syntax-comment)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-name),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-quote),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-selector-pseudo),div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-selector-tag){color:var(--color-prettylights-syntax-entity-tag)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-subst){color:var(--color-prettylights-syntax-storage-modifier-import)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-section){color:var(--color-prettylights-syntax-markup-heading);font-weight:700}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-bullet){color:var(--color-prettylights-syntax-markup-list)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-emphasis){color:var(--color-prettylights-syntax-markup-italic);font-style:italic}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-strong){color:var(--color-prettylights-syntax-markup-bold);font-weight:700}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-addition){background-color:var(--color-prettylights-syntax-markup-inserted-bg);color:var(--color-prettylights-syntax-markup-inserted-text)}div#\:\$p>svg>foreignObject>section :is(pre,marp-pre) :where(.hljs-deletion){background-color:var(--color-prettylights-syntax-markup-deleted-bg);color:var(--color-prettylights-syntax-markup-deleted-text)}div#\:\$p>svg>foreignObject>section footer,div#\:\$p>svg>foreignObject>section header{color:var(--header-footer-color);font-size:18px;left:30px;margin:0;position:absolute}div#\:\$p>svg>foreignObject>section header{top:21px}div#\:\$p>svg>foreignObject>section footer{bottom:21px}div#\:\$p>svg>foreignObject>section{--h1-color:#246;--header-footer-color:hsla(0,0%,40%,.75);--heading-strong-color:#48c;--paginate-color:#777;align-items:stretch;display:flex;flex-flow:column nowrap;font-size:29px;height:720px;justify-content:center;padding:78.5px;width:1280px}div#\:\$p>svg>foreignObject>section{--marpit-root-font-size:29px}div#\:\$p>svg>foreignObject>section:where(.invert){--h1-color:#cee7ff;--header-footer-color:hsla(0,0%,60%,.75);--heading-strong-color:#7bf;--paginate-color:#999}div#\:\$p>svg>foreignObject>section>:last-child,div#\:\$p>svg>foreignObject>section[data-footer]>:nth-last-child(2){margin-bottom:0}div#\:\$p>svg>foreignObject>section>:first-child,div#\:\$p>svg>foreignObject>section>header:first-child+*{margin-top:0}div#\:\$p>svg>foreignObject>section:after{bottom:21px;color:var(--paginate-color);font-size:24px;padding:0;position:absolute;right:30px}div#\:\$p>svg>foreignObject>section:after{--marpit-root-font-size:24px}div#\:\$p>svg>foreignObject>section[data-color] :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section[data-color] :is(h2,marp-h2),div#\:\$p>svg>foreignObject>section[data-color] :is(h3,marp-h3),div#\:\$p>svg>foreignObject>section[data-color] :is(h4,marp-h4),div#\:\$p>svg>foreignObject>section[data-color] :is(h5,marp-h5),div#\:\$p>svg>foreignObject>section[data-color] :is(h6,marp-h6){color:currentcolor}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG]{direction:ltr}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG]>svg{overflow:visible;min-height:1px;min-width:1px}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG]>svg a{fill:blue;stroke:blue}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG][display=true]{display:block;text-align:center;margin:1em 0}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG][display=true][width=full]{display:flex}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG][justify=left]{text-align:left}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG][justify=right]{text-align:right}div#\:\$p>svg>foreignObject>section g[data-mml-node=merror]>g{fill:red;stroke:red}div#\:\$p>svg>foreignObject>section g[data-mml-node=merror]>rect[data-background]{fill:yellow;stroke:none}div#\:\$p>svg>foreignObject>section g[data-mml-node=mtable]>line[data-line],div#\:\$p>svg>foreignObject>section svg[data-table]>g>line[data-line]{stroke-width:70px;fill:none}div#\:\$p>svg>foreignObject>section g[data-mml-node=mtable]>rect[data-frame],div#\:\$p>svg>foreignObject>section svg[data-table]>g>rect[data-frame]{stroke-width:70px;fill:none}div#\:\$p>svg>foreignObject>section g[data-mml-node=mtable]>.mjx-dashed,div#\:\$p>svg>foreignObject>section svg[data-table]>g>.mjx-dashed{stroke-dasharray:140}div#\:\$p>svg>foreignObject>section g[data-mml-node=mtable]>.mjx-dotted,div#\:\$p>svg>foreignObject>section svg[data-table]>g>.mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}div#\:\$p>svg>foreignObject>section g[data-mml-node=mtable]>g>svg{overflow:visible}div#\:\$p>svg>foreignObject>section [jax=SVG] mjx-tool{display:inline-block;position:relative;width:0;height:0}div#\:\$p>svg>foreignObject>section [jax=SVG] mjx-tool>mjx-tip{position:absolute;top:0;left:0}div#\:\$p>svg>foreignObject>section mjx-tool>mjx-tip{display:inline-block;padding:.2em;border:1px solid #888;font-size:70%;background-color:#F8F8F8;color:black;box-shadow:2px 2px 5px #AAAAAA}div#\:\$p>svg>foreignObject>section g[data-mml-node=maction][data-toggle]{cursor:pointer}div#\:\$p>svg>foreignObject>section mjx-status{display:block;position:fixed;left:1em;bottom:1em;min-width:25%;padding:.2em .4em;border:1px solid #888;font-size:90%;background-color:#F8F8F8;color:black}div#\:\$p>svg>foreignObject>section foreignObject[data-mjx-xml]{font-family:initial;line-height:normal;overflow:visible}div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG] path[data-c],div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG] use[data-c]{stroke-width:3}@media print{div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG] path[data-c],div#\:\$p>svg>foreignObject>section mjx-container[jax=SVG] use[data-c]{stroke-width:0}}div#\:\$p>svg>foreignObject>section img[data-marp-twemoji]{background:transparent;height:1em;margin:0 .05em 0 .1em;vertical-align:-.1em;width:1em} /* ngi-theme.css*/ /* @theme ngi-theme */div#\:\$p>svg>foreignObject>section{ - /* Override default background */background-color:#F5F5F5;color:black;font-family:'Times New Roman' - /*justify-content: flex-start;*/}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1){color:#B22222}div#\:\$p>svg>foreignObject>section slide{font-family:'Times New Roman',serif!important}div#\:\$p>svg>foreignObject>section:after{content:attr(data-marpit-pagination) ' / ' attr(data-marpit-pagination-total)}div#\:\$p>svg>foreignObject>section td,div#\:\$p>svg>foreignObject>section th{border:none!important} + /* Override default background */background-color:#F5F5F5;color:black;font-family:'Times New Roman' + /*justify-content: flex-start;*/}div#\:\$p>svg>foreignObject>section :is(h1,marp-h1){color:#B22222}div#\:\$p>svg>foreignObject>section slide{font-family:'Times New Roman',serif!important}div#\:\$p>svg>foreignObject>section:after{content:attr(data-marpit-pagination) ' / ' attr(data-marpit-pagination-total)}div#\:\$p>svg>foreignObject>section td,div#\:\$p>svg>foreignObject>section th{border:none!important} /* Reset table styling provided by theme */div#\:\$p>svg>foreignObject>section table,div#\:\$p>svg>foreignObject>section td,div#\:\$p>svg>foreignObject>section th,div#\:\$p>svg>foreignObject>section tr{all:unset; /* Override contextual styling */border:0!important;background:transparent!important}div#\:\$p>svg>foreignObject>section table{display:table}div#\:\$p>svg>foreignObject>section tr{display:table-row} -/* ...and layout freely :) */div#\:\$p>svg>foreignObject>section table{width:100%}div#\:\$p>svg>foreignObject>section td{text-align:center;vertical-align:middle}div#\:\$p>svg>foreignObject>section td,div#\:\$p>svg>foreignObject>section th{display:table-cell}div#\:\$p>svg>foreignObject>section ul{list-style-type:none;margin-left:0.2px}div#\:\$p>svg>foreignObject>section li:before{content:"";background-image:url(./figures/logo/NGI/NGI_pil_RGB_dark_grey_medium.png);width:15px;height:15px;display:inline-block;background-size:contain;margin-right:calc(var(--marpit-root-font-size, 1rem) * 0.25)}div#\:\$p>svg>foreignObject>section :is(h2,marp-h2){color:gray}div#\:\$p>svg>foreignObject>section img{background-color:transparent!important;box-sizing:initial;max-width:100%}div#\:\$p>svg>foreignObject>section figure{border:thin #c0c0c0 solid;display:flex;flex-flow:column;padding:5px;max-width:220px;margin:auto}div#\:\$p>svg>foreignObject>section.title{--title-height:130px;--subtitle-height:70px;--subsubtitle-height:50px;overflow:visible;display:grid;grid-template-columns:1fr;grid-template-rows:1fr var(--title-height) var(--subtitle-height) var(--subsubtitle-height) 1fr;grid-template-areas:"." "title" "subtitle" "subsubtitle" "."}div#\:\$p>svg>foreignObject>section.title :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section.title :is(h2,marp-h2),div#\:\$p>svg>foreignObject>section.title :is(h3,marp-h3){margin:0;padding:0;text-align:center;height:var(--area-height);line-height:var(--area-height);font-size:calc(var(--area-height) * 0.7);border:0px dashed gray /* debug */}div#\:\$p>svg>foreignObject>section.title :is(h1,marp-h1){grid-area:title;--area-height:var(--title-height)}div#\:\$p>svg>foreignObject>section.title :is(h2,marp-h2){grid-area:subtitle;--area-height:var(--subtitle-height)}div#\:\$p>svg>foreignObject>section.title :is(h3,marp-h3){grid-area:subsubtitle;text-align:center;--area-height:var(--subsubtitle-height)}div#\:\$p>svg>foreignObject>section.split-text{overflow:visible;display:grid;grid-template-columns:500px 500px;grid-template-rows:100px auto;grid-template-areas:"slideheading slideheading" "leftpanel rightpanel"} -/* debug */div#\:\$p>svg>foreignObject>section.split-text .ldiv,div#\:\$p>svg>foreignObject>section.split-text .rdiv,div#\:\$p>svg>foreignObject>section.split-text :is(h3,marp-h3){border:none}div#\:\$p>svg>foreignObject>section.split-text :is(h3,marp-h3){grid-area:slideheading;font-size:50px}div#\:\$p>svg>foreignObject>section.split-text .ldiv{grid-area:leftpanel;text-align:left}div#\:\$p>svg>foreignObject>section.split-text .rdiv{grid-area:rightpanel;text-align:left}div#\:\$p>svg>foreignObject>section.split-text-image{overflow:visible;display:grid;grid-template-columns:500px 500px;grid-template-rows:100px auto;grid-template-areas:"slideheading slideheading" "leftpanel rightpanel"} -/* debug */div#\:\$p>svg>foreignObject>section.split-text-image .ldiv,div#\:\$p>svg>foreignObject>section.split-text-image .rdiv,div#\:\$p>svg>foreignObject>section.split-text-image :is(h3,marp-h3){border:none}div#\:\$p>svg>foreignObject>section.split-text-image :is(h3,marp-h3){grid-area:slideheading;font-size:50px}div#\:\$p>svg>foreignObject>section.split-text-image .ldiv{grid-area:leftpanel;text-align:left}div#\:\$p>svg>foreignObject>section.split-text-image .rdiv{grid-area:rightpanel;text-align:right}div#\:\$p>svg>foreignObject>section.body-quote{margin:1em;font:calc(var(--marpit-root-font-size, 1rem) * 1.2)/1.4 Georgia,serif}div#\:\$p>svg>foreignObject>section.body-quote{margin:0;background:#eee;padding:1em;border-radius:1em}div#\:\$p>svg>foreignObject>section figcaption{position:right;bottom:0;padding:15px;color:black;background-color:#F5F5F5;text-align:right;font-size:calc(var(--marpit-root-font-size, 1rem) * 1);width:100%}div#\:\$p>svg>foreignObject>section div.twocols{margin-top:35px;column-count:2}div#\:\$p>svg>foreignObject>section div.twocols :is(h1,marp-h1):first-child,div#\:\$p>svg>foreignObject>section div.twocols :is(h2,marp-h2):first-child,div#\:\$p>svg>foreignObject>section div.twocols p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul:first-child{margin-top:0!important}div#\:\$p>svg>foreignObject>section div.twocols p.break{break-before:column;margin-top:0} -/* @theme 9127mw0v1aa60ya31jxrvpved83w2s404ewrxe4u8p2 */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}
+/* ...and layout freely :) */div#\:\$p>svg>foreignObject>section table{width:100%}div#\:\$p>svg>foreignObject>section td{text-align:center;vertical-align:middle}div#\:\$p>svg>foreignObject>section td,div#\:\$p>svg>foreignObject>section th{display:table-cell}div#\:\$p>svg>foreignObject>section ul{list-style-type:none;margin-left:0.2px}div#\:\$p>svg>foreignObject>section li:before{content:"";background-image:url(./figures/logo/NGI/NGI_pil_RGB_dark_grey_medium.png);width:15px;height:15px;display:inline-block;background-size:contain;margin-right:calc(var(--marpit-root-font-size, 1rem) * 0.25)}div#\:\$p>svg>foreignObject>section :is(h2,marp-h2){color:gray}div#\:\$p>svg>foreignObject>section img{background-color:transparent!important;box-sizing:initial;max-width:100%}div#\:\$p>svg>foreignObject>section figure{border:thin #c0c0c0 solid;display:flex;flex-flow:column;padding:5px;max-width:220px;margin:auto}div#\:\$p>svg>foreignObject>section.title{--title-height:130px;--subtitle-height:70px;--subsubtitle-height:50px;overflow:visible;display:grid;grid-template-columns:1fr;grid-template-rows:1fr var(--title-height) var(--subtitle-height) var(--subsubtitle-height) 1fr;grid-template-areas:"." "title" "subtitle" "subsubtitle" "."}div#\:\$p>svg>foreignObject>section.title :is(h1,marp-h1),div#\:\$p>svg>foreignObject>section.title :is(h2,marp-h2),div#\:\$p>svg>foreignObject>section.title :is(h3,marp-h3){margin:0;padding:0;text-align:center;height:var(--area-height);line-height:var(--area-height);font-size:calc(var(--area-height) * 0.7);border:0px dashed gray + /* debug */}div#\:\$p>svg>foreignObject>section.title :is(h1,marp-h1){grid-area:title;--area-height:var(--title-height)}div#\:\$p>svg>foreignObject>section.title :is(h2,marp-h2){grid-area:subtitle;--area-height:var(--subtitle-height)}div#\:\$p>svg>foreignObject>section.title :is(h3,marp-h3){grid-area:subsubtitle;text-align:center;--area-height:var(--subsubtitle-height)}div#\:\$p>svg>foreignObject>section.split-text{overflow:visible;display:grid;grid-template-columns:500px 500px;grid-template-rows:100px auto;grid-template-areas:"slideheading slideheading" "leftpanel rightpanel"} + +/* debug */div#\:\$p>svg>foreignObject>section.split-text .ldiv,div#\:\$p>svg>foreignObject>section.split-text .rdiv,div#\:\$p>svg>foreignObject>section.split-text :is(h3,marp-h3){border:none}div#\:\$p>svg>foreignObject>section.split-text :is(h3,marp-h3){grid-area:slideheading;font-size:50px}div#\:\$p>svg>foreignObject>section.split-text .ldiv{grid-area:leftpanel;text-align:left}div#\:\$p>svg>foreignObject>section.split-text .rdiv{grid-area:rightpanel;text-align:left}div#\:\$p>svg>foreignObject>section.split-text-image{overflow:visible;display:grid;grid-template-columns:1fr 1fr; + /* Use fractions for responsive columns */grid-template-rows:auto auto; + /* Automatically adjust row heights */grid-template-areas:"slideheading slideheading" "leftpanel rightpanel" + /* Panels for images */} + +/* Debug */div#\:\$p>svg>foreignObject>section.split-text-image .ldiv,div#\:\$p>svg>foreignObject>section.split-text-image .rdiv,div#\:\$p>svg>foreignObject>section.split-text-image :is(h3,marp-h3){border:none + /* No border for debug mode */}div#\:\$p>svg>foreignObject>section.split-text-image{overflow:visible;display:grid;grid-template-columns:1fr 1fr; + /* Use fractions for responsive columns */grid-template-rows:auto auto; + /* Automatically adjust row heights */grid-template-areas:"slideheading slideheading" "leftpanel rightpanel" + /* Panels for images */} + +/* Debug */div#\:\$p>svg>foreignObject>section.split-text-image .ldiv,div#\:\$p>svg>foreignObject>section.split-text-image .rdiv,div#\:\$p>svg>foreignObject>section.split-text-image :is(h1,marp-h1){border:none + /* No border for debug mode */}div#\:\$p>svg>foreignObject>section.split-text-image :is(h1,marp-h1){grid-area:slideheading; + /* Place the header in the first row */font-size:50px; + /* Set the font size for the header */text-align:center; + /* Center the header text */margin:0; + /* Remove default margin */overflow:hidden; + /* Hide overflow if text is too long */text-overflow:ellipsis + /* Add ellipsis if the text overflows */}div#\:\$p>svg>foreignObject>section.split-text-image .ldiv{grid-area:leftpanel; + /* Place left image in the left column */display:flex; + /* Use flexbox for image alignment */justify-content:center; + /* Center image horizontally */align-items:center + /* Center image vertically */}div#\:\$p>svg>foreignObject>section.split-text-image .rdiv{grid-area:rightpanel; + /* Place right image in the right column */display:flex; + /* Use flexbox for image alignment */justify-content:center; + /* Center image horizontally */align-items:center + /* Center image vertically */}div#\:\$p>svg>foreignObject>section img{max-width:100%; + /* Responsive images */height:auto + /* Maintain aspect ratio */}div#\:\$p>svg>foreignObject>section.body-quote{margin:1em;font:calc(var(--marpit-root-font-size, 1rem) * 1.2)/1.4 Georgia,serif}div#\:\$p>svg>foreignObject>section.body-quote{margin:0;background:#eee;padding:1em;border-radius:1em}div#\:\$p>svg>foreignObject>section figcaption{position:right;bottom:0;padding:15px;color:black;background-color:#F5F5F5;text-align:right;font-size:calc(var(--marpit-root-font-size, 1rem) * 1);width:100%}div#\:\$p>svg>foreignObject>section div.twocols{margin-top:35px;column-count:2}div#\:\$p>svg>foreignObject>section div.twocols :is(h1,marp-h1):first-child,div#\:\$p>svg>foreignObject>section div.twocols :is(h2,marp-h2):first-child,div#\:\$p>svg>foreignObject>section div.twocols p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul:first-child{margin-top:0!important}div#\:\$p>svg>foreignObject>section div.twocols p.break{break-before:column;margin-top:0} + +/* CSS to align the term to the right */div#\:\$p>svg>foreignObject>section .right-aligned{text-align:right;font-style:italic;margin-top:calc(var(--marpit-root-font-size, 1rem) * 0.5); + /* Add some spacing from the quote */display:block}div#\:\$p>svg>foreignObject>section div.twocols{margin-top:35px;column-count:2}div#\:\$p>svg>foreignObject>section div.twocols :is(h1,marp-h1):first-child,div#\:\$p>svg>foreignObject>section div.twocols :is(h2,marp-h2):first-child,div#\:\$p>svg>foreignObject>section div.twocols p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li p:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul li:first-child,div#\:\$p>svg>foreignObject>section div.twocols ul:first-child{margin-top:0!important}div#\:\$p>svg>foreignObject>section div.twocols p.break{break-before:column;margin-top:0} +/* @theme ysl57swbkoome4znjekgpfx9gkoda9gsmaqn8r9o4g */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}
24.10.2024

Optimize your curves,

@@ -32,11 +64,15 @@

Oslo Python MeetUp

Sunniva Indrehus

-
echo $(whoami)
+
+

📈 + 💪 + 🐍 = ❓

+
+
+
echo $(whoami)
 
-
+

Agenda

#TODO update content in the end

Curve Fitting

@@ -55,15 +91,23 @@

Curve Fitting

-
+

Problem

-

right

-
    -
  • What are the optimal model parameters for my data?
  • -
+ + + + + + + + + + + +
Which model parameters describe this data?
-
+

Optimization: an act, process, or methodology of making something (such as a design, system, or decision) as fully perfect, functional, or effective as possible
specifically : the mathematical procedures (such as finding the maximum of a function) involved in this

@@ -74,7 +118,7 @@

Problem

-
+

What is Curve Fitting?

  • Identify the best-fit curve for a dataset with a known model @@ -85,98 +129,64 @@

    What is Curve Fitting?

  • Categories of problems
    • Linear vs non-linear

    • -
    • Constrained vs unconstrained

    • +
    • Unconstrained vs Constrained

-
-

Difference of observed and predicted values

-
-

-
-
-

+
+

Difference between observed and predicted values

+
+

+

+

+

+

-
-

Curve fitting vs. model optimization

+
+

The real world is complicated

- - - + - - - - - - - - - - - - - - - - - - +
AspectCurve FittingModel Optimization
ScopeSpecific; find a curve that fits dataBroad; enhance model performance in various contexts
ApplicationsScientific, engineering, and data analysisMachine learning, operations research, statistics, etc.
TechniquesPrimarily uses least squares regression, polynomial fitting, non-linear fittingIncludes hyperparameter tuning, model selection, regularization, etc.
GoalModel relationships between variables through a curveImprove performance across various model types
-
-

The complicated real world is non-linear

-

-
-
-
+

Real (NGI work) life example

-

+


-Monopile system

+Offshore structure

-

+


Horizontal displacement curves under load

-
-

📈 + 💪 + 🐍 = ❓

-
-
-
-

📈 + 💪 + 🐍 = ❤️

-
-
-
-

Curve fitting in Python needs

-
    -
  • Estimate of uncertainties and parameter correlations estimates
  • -
  • Non-linear problem formulation
  • -
  • Easy change of the fitting algorithm +
    +

    Curve fitting requirements

      -
    • Functionality for handeling parameter bounds
    • -
    - +
  • Provide estimates of parameter uncertanties
  • +
  • Handle non-linear problem formulations
  • +
  • Easy changebility of the optimization algorithm
  • +
  • High level functionality for handling parameter bounds
  • -
    -

    Recommended tool

    +
    +

    Recommended tool (by me)

    @@ -209,65 +219,90 @@

    Recommended tool

    -
    -

    Tiling can improve the access pattern

    -
    -

    Left

    -

    - -
    +
    +

    ✨ Let's see some code ✨

    -
    -

    Demo: Curve Fitting with lmfit**

    -

    Step 1: Problem Setup

    -
    import numpy as np
    -import matplotlib.pyplot as plt
    -from lmfit import Model
    +
    +

    Problem set up

    +
    from lmfit import Minimizer, create_params
    +
    +def residual(parameters, x, data):
    +    model = (
    +        parameters["amp"]
    +        * np.sin(x * parameters["omega"] + parameters["shift"])
    +        * np.exp(-x * x * parameters["decay"])
    +    )
    +    return model - data
     
    -def model_function(x, a, b, c):
    -    return a * np.exp(-b * x) + c
    +parameters_initial = create_params(
    +    amp=10,
    +    decay=0.1,
    +    omega=3.0,
    +    shift=value=0.0,
    +)
     
    -x_data = np.linspace(0, 10, 100)
    -y_true = model_function(x_data, a=3, b=1, c=0.5)
    -noise = np.random.normal(0, 0.2, x_data.shape)
    -y_data = y_true + noise
    +minimizer = Minimizer(residual, parameters_initial, fcn_args=(x, data))
    +result = minimizer.minimize(method="least_squares")
     
    -plt.scatter(x_data, y_data, label='Noisy Data')
    -plt.plot(x_data, y_true, color='red', label='True Model')
    -plt.legend()
    -plt.show()
     
    -
    -

    Interpreting the Results

    -
      -
    • Parameter Estimates: Best-fit values for a, b, and c
    • -
    • Fit Report: Provides uncertainties and goodness-of-fit statistics
    • -
    • Visualization: Compare the fitted model to the noisy data
    • -
    • Adding Constraints: -
        -
      • Constrain parameters (e.g., a > 0)
      • -
      -
    • -
    • Fitting Different Models: -
        -
      • Experiment with other functions (e.g., polynomials, sine)
      • -
      -
    • -
    • Advanced Features: -
        -
      • Handle multiple datasets, parameter bounds, and more
      • -
      -
    • -
    +
    +

    Handeling bounds

    +
    from lmfit import Parameters 
    +
    +params = Parameters()
    +params.add('amp', value=10, min=0)
    +params.add('decay', value=0.1)
    +params.add('shift', value=0.0, min=-np.pi/2., max=np.pi/2.)
    +params.add('omega', value=3.0)
    +
    +
    +
    from lmfit import create_params
    +
    +params = create_params(amp=dict(value=10, min=0),
    +                       decay=0.1,
    +                       omega=3,
    +                       shift=dict(value=0, min=-np.pi/2, max=np.pi/2))
    +
    -
    -

    ✨ 👩‍💻 Let's see some code 👩‍💻 ✨

    +
    +

    Interperet simulation results

    +
    [[Fit Statistics]]
    +    # fitting method   = least_squares
    +    # function evals   = 58
    +    # data points      = 301
    +    # variables        = 4
    +    chi-square         = 12.1867036
    +    reduced chi-square = 0.04103267
    +    Akaike info crit   = -957.236198
    +    Bayesian info crit = -942.407756
    +[[Variables]]
    +    amp:    5.03088066 +/- 0.04005821 (0.80%) (init = 10)
    +    decay:  0.02495457 +/- 4.5396e-04 (1.82%) (init = 0.1)
    +    omega:  2.00026311 +/- 0.00326183 (0.16%) (init = 3)
    +    shift: -0.10264955 +/- 0.01022294 (9.96%) (init = 0)
    +[[Correlations]] (unreported correlations are < 0.100)
    +    C(omega, shift) = -0.7852
    +    C(amp, decay)   = +0.5840
    +    C(amp, shift)   = -0.1179
    +
    +
    +
    +
    +

    👩‍💻 Demo 👩‍💻

    +
    +
    +
    +

    📈 + 💪 + 🐍 = ❓

    +
    +
    +
    +

    📈 + 💪 + 🐍 = ❤️

    - What are the optimal model parameters for my data?

    \ No newline at end of file diff --git a/talk/slides.md b/talk/slides.md index 7d16413..a19556a 100755 --- a/talk/slides.md +++ b/talk/slides.md @@ -18,6 +18,12 @@ footer: '![width:90 height:40](figures/logo/NGI/NGI_logo_transparent.gif)' #### Sunniva Indrehus +--- + + + +# :chart_with_upwards_trend: + :muscle: + :snake: = :question: + --- @@ -44,10 +50,14 @@ echo $(whoami) --- # Problem -![h:500 right](figures/plot/observed_low.png) +|![h:500](figures/plot/observed_low.png)| +|:--:| +| Which model parameters describe this data? | + -- What are the optimal model parameters for my data? + + --- @@ -73,7 +83,7 @@ specifically : the mathematical procedures (such as finding the maximum of a fun $$ y_1 = ax + b \qquad \text{vs} \quad y_2 = \sin(\omega t)\text{e}^{-x^2} $$ - * Constrained vs unconstrained + * Unconstrained vs Constrained $$ a\in [-\infty,\infty] \quad \text{vs} \quad a \in [-\pi,\pi/3] $$ @@ -82,42 +92,36 @@ specifically : the mathematical procedures (such as finding the maximum of a fun --- -# Difference of *observed* and *predicted* values +# Difference between *observed* and *predicted* values - -
    +
    -![](figures/plot/observed_vs_predicted_low.png) +## -
    +![w:600 h:300](figures/plot/observed_vs_predicted_low.png) -
    -![](figures/plot/chi_square_plot_low.png) +

    -
    +### +![w:600 h:300](figures/plot/chi_square_plot_low.png) ---- +
    -# Curve fitting vs. model optimization -| Aspect | Curve Fitting | Model Optimization | -|:---------------------|:------------------------------------------------|:------------------------------------------------| -| **Scope** | Specific; find a curve that fits data | Broad; enhance model performance in various contexts | -| **Applications** | Scientific, engineering, and data analysis | Machine learning, operations research, statistics, etc. | -| **Techniques** | Primarily uses least squares regression, polynomial fitting, non-linear fitting | Includes hyperparameter tuning, model selection, regularization, etc. | -| **Goal** | Model relationships between variables through a curve | Improve performance across various model types | --- -# The complicated real world is non-linear +# The real world is complicated -![](figures/plot/observed_sin.png) +| | +|-----| +|![](figures/plot/parameters_values_lmfit.png)| --- @@ -128,7 +132,7 @@ specifically : the mathematical procedures (such as finding the maximum of a fun ## ![w:450 h:350](figures/illustrations/full_model.png) -Monopile system +Offshore structure @@ -141,32 +145,22 @@ Horizontal displacement curves under load ---- - - -# :chart_with_upwards_trend: + :muscle: + :snake: = :question: - ---- - - -# :chart_with_upwards_trend: + :muscle: + :snake: = :heart: - --- -# Curve fitting in Python needs - - Estimate of uncertainties and parameter correlations estimates - - Non-linear problem formulation - - Easy change of the fitting algorithm - - Functionality for handeling parameter [bounds](https://lmfit.github.io/lmfit-py/bounds.html) +# Curve fitting requirements + - Provide estimates of parameter uncertanties + - Handle non-linear problem formulations + - Easy changebility of the optimization algorithm + - High level functionality for handling parameter [bounds](https://lmfit.github.io/lmfit-py/bounds.html) --- -# Recommended tool +# Recommended tool (by me) | **Topic** | **Details** | @@ -180,63 +174,100 @@ Horizontal displacement curves under load --- -# Tiling can improve the access pattern -
    +#
    :sparkles: Let's see some code :sparkles:
    +--- -## Left -

    +# Problem set up +```python +from lmfit import Minimizer, create_params + +def residual(parameters, x, data): + model = ( + parameters["amp"] + * np.sin(x * parameters["omega"] + parameters["shift"]) + * np.exp(-x * x * parameters["decay"]) + ) + return model - data + +parameters_initial = create_params( + amp=10, + decay=0.1, + omega=3.0, + shift=value=0.0, +) + +minimizer = Minimizer(residual, parameters_initial, fcn_args=(x, data)) +result = minimizer.minimize(method="least_squares") -## Right -
    +``` +--- ---- +# Handeling bounds + +```python +from lmfit import Parameters -# Demo: Curve Fitting with `lmfit`** +params = Parameters() +params.add('amp', value=10, min=0) +params.add('decay', value=0.1) +params.add('shift', value=0.0, min=-np.pi/2., max=np.pi/2.) +params.add('omega', value=3.0) -### Step 1: Problem Setup +``` ```python -import numpy as np -import matplotlib.pyplot as plt -from lmfit import Model - -def model_function(x, a, b, c): - return a * np.exp(-b * x) + c - -x_data = np.linspace(0, 10, 100) -y_true = model_function(x_data, a=3, b=1, c=0.5) -noise = np.random.normal(0, 0.2, x_data.shape) -y_data = y_true + noise - -plt.scatter(x_data, y_data, label='Noisy Data') -plt.plot(x_data, y_true, color='red', label='True Model') -plt.legend() -plt.show() +from lmfit import create_params + +params = create_params(amp=dict(value=10, min=0), + decay=0.1, + omega=3, + shift=dict(value=0, min=-np.pi/2, max=np.pi/2)) ``` + --- -# Interpreting the Results -- **Parameter Estimates**: Best-fit values for `a`, `b`, and `c` -- **Fit Report**: Provides uncertainties and goodness-of-fit statistics -- **Visualization**: Compare the fitted model to the noisy data -- **Adding Constraints**: - - Constrain parameters (e.g., `a > 0`) -- **Fitting Different Models**: - - Experiment with other functions (e.g., polynomials, sine) -- **Advanced Features**: - - Handle multiple datasets, parameter bounds, and more +# Interperet simulation results + +```bash +[[Fit Statistics]] + # fitting method = least_squares + # function evals = 58 + # data points = 301 + # variables = 4 + chi-square = 12.1867036 + reduced chi-square = 0.04103267 + Akaike info crit = -957.236198 + Bayesian info crit = -942.407756 +[[Variables]] + amp: 5.03088066 +/- 0.04005821 (0.80%) (init = 10) + decay: 0.02495457 +/- 4.5396e-04 (1.82%) (init = 0.1) + omega: 2.00026311 +/- 0.00326183 (0.16%) (init = 3) + shift: -0.10264955 +/- 0.01022294 (9.96%) (init = 0) +[[Correlations]] (unreported correlations are < 0.100) + C(omega, shift) = -0.7852 + C(amp, decay) = +0.5840 + C(amp, shift) = -0.1179 +``` +--- + + +#
    :woman_technologist: Demo :woman_technologist:
    --- - -#
    :sparkles: :woman_technologist: Let's see some code :woman_technologist: :sparkles:
    + + +# :chart_with_upwards_trend: + :muscle: + :snake: = :question: + +--- + + +# :chart_with_upwards_trend: + :muscle: + :snake: = :heart: