%23%20%2F%2F%2F%20script%0A%23%20requires-python%20%3D%20%22%3E%3D3.11%22%0A%23%20dependencies%20%3D%20%5B%22marimo%3E%3D0.23.9%22%2C%20%22numpy%3E%3D2.0%22%5D%0A%23%20%2F%2F%2F%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.25.2%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Replace%20missing%20data%0A%0A%20%20%20%20%3E%20Marcos%20Duarte%2C%20Renato%20Naville%20Watanabe%3Cbr%3E%0A%20%20%20%20%3E%20%5BLaboratory%20of%20Biomechanics%20and%20Motor%20Control%5D(https%3A%2F%2Fbmclab.pesquisa.ufabc.edu.br%2F)%3Cbr%3E%0A%20%20%20%20%3E%20Federal%20University%20of%20ABC%2C%20Brazil%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20How%20to%20use%20this%20guide%0A%0A%20%20%20%20A%20marker%20disappears%20for%20two%20frames.%20Should%20we%20delete%20those%20frames%2C%20fill%20them%20with%20a%20constant%2C%20or%20interpolate%3F%0A%0A%20%20%20%20We%20will%20compare%20the%20replacement%20methods%20already%20used%20in%20this%20collection%2C%20while%20keeping%20missing%20measurements%20distinguishable%20from%20measured%20zeros.%0A%0A%20%20%20%20Predict%20the%20result%20before%20running%20each%20example.%20Try%20the%20**Exercises**%20before%20opening%20their%20worked%20solutions.%20Finish%20with%20the%20**Checkpoint%20questions**%20and%20**Problems**%3B%20the%20latter%20provide%20final%20answers%20only.%0A%0A%20%20%20%20Open%20this%20file%20locally%20in%20marimo%2C%20on%20%5Bmarimo.app%5D(https%3A%2F%2Fmarimo.app%2F)%2C%20or%20in%20%5Bmolab%5D(https%3A%2F%2Fmolab.marimo.io%2Fnotebooks).%20The%20examples%20are%20self-contained.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Python%20setup%0A%0A%20%20%20%20NumPy%20stores%20the%20signal.%20The%20helper%20is%20included%20below%20so%20this%20notebook%20can%20run%20as%20a%20single%20file.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20return%20mo%2C%20np%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20def%20rep_missing(x%2C%20value%3Dnp.nan%2C%20new_value%3D'interp'%2C%20max_alert%3D100)%3A%0A%20%20%20%20%20%20%20%20%22%22%22Replace%20missing%20data%20in%20different%20ways.%0A%0A%20%20%20%20%20%20%20%20Parameters%0A%20%20%20%20%20%20%20%20----------%0A%20%20%20%20%20%20%20%20x%20%3A%201D%20numpy%20array_like%0A%20%20%20%20%20%20%20%20%20%20%20%20data%0A%20%20%20%20%20%20%20%20value%20%3A%20number%2C%20optional.%20Default%20%3D%20np.nan.%0A%20%20%20%20%20%20%20%20%20%20%20%20Scalar%20value%20in%20x%20marking%20missing%20data.%20The%20input%20is%20never%20modified.%0A%20%20%20%20%20%20%20%20new_value%20%3A%20number%20or%20string%2C%20optional.%20Default%20%3D%20'interp'.%0A%20%20%20%20%20%20%20%20%20%20%20%20Value%20or%20string%20for%20the%20method%20to%20use%20for%20replacing%20missing%20data%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20'delete'%3A%20delete%20missing%20data.%0A%20%20%20%20%20%20%20%20%20%20%20%20new_value%3A%20replace%20missing%20data%20with%20new_value.%0A%20%20%20%20%20%20%20%20%20%20%20%20'mean'%3A%20replace%20missing%20data%20with%20the%20mean%20of%20the%20rest%20of%20the%20data.%0A%20%20%20%20%20%20%20%20%20%20%20%20'median'%3A%20replace%20missing%20data%20with%20the%20median%20of%20the%20rest%20of%20the%20data.%0A%20%20%20%20%20%20%20%20%20%20%20%20'interp'%3A%20replace%20missing%20data%20by%20linear%20interpolating%20over%20them.%0A%20%20%20%20%20%20%20%20max_alert%20%3A%20number%2C%20optional.%20Default%20%3D%20100.%0A%20%20%20%20%20%20%20%20%20%20%20%20Minimal%20number%20of%20sequential%20data%20for%20a%20message%20to%20be%20printed%20with%0A%20%20%20%20%20%20%20%20%20%20%20%20information%20about%20the%20continuous%20missing%20data.%0A%20%20%20%20%20%20%20%20%20%20%20%20Set%20to%200%20to%20not%20print%20any%20message.%0A%0A%20%20%20%20%20%20%20%20This%20function%20can%20handle%20NaNs%20separately%20from%20missing%20data%20(in%20case%20they%0A%20%20%20%20%20%20%20%20are%20different)%2C%20but%20the%20'interp'%20method%20will%20interpolate%20on%20both%20the%0A%20%20%20%20%20%20%20%20missing%20data%20and%20NaNs.%20Interpolation%20uses%20sample%20indices%2C%20assumes%20uniform%20sampling%2C%0A%20%20%20%20%20%20%20%20and%20extends%20the%20nearest%20observed%20value%20at%20missing%20endpoints.%0A%0A%0A%20%20%20%20%20%20%20%20Returns%0A%20%20%20%20%20%20%20%20-------%0A%20%20%20%20%20%20%20%20y%20%3A%201D%20numpy%20array%0A%20%20%20%20%20%20%20%20%20%20%20%201D%20numpy%20array%20similar%20to%20x%20but%20with%20missing%20data%20replaced%20according%0A%20%20%20%20%20%20%20%20%20%20%20%20to%20value%20or%20method%20specified%20with%20the%20parameter%20new_value.%0A%0A%20%20%20%20%20%20%20%20References%0A%20%20%20%20%20%20%20%20----------%0A%20%20%20%20%20%20%20%20..%20%5B1%5D%20https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Frep_missing.py%0A%0A%20%20%20%20%20%20%20%20Examples%0A%20%20%20%20%20%20%20%20--------%0A%20%20%20%20%20%20%20%20%3E%3E%3E%20x%20%3D%20%5B1%2C%201%2C%202%2C%200%2C%204%2C%201%2C%201%2C%200%2C%201%2C%200%2C%202%5D%0A%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20%20%20%20%20from%20numbers%20import%20Number%0A%20%20%20%20%20%20%20%20y%20%3D%20np.array(x%2C%20dtype%3Dcomplex%20if%20np.iscomplexobj(x)%20else%20float%2C%20copy%3DTrue)%0A%20%20%20%20%20%20%20%20if%20y.ndim%20!%3D%201%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20raise%20ValueError('x%20must%20be%20one-dimensional')%0A%20%20%20%20%20%20%20%20idx%20%3D%20np.isnan(y)%20if%20np.isnan(value)%20else%20y%20%3D%3D%20value%0A%20%20%20%20%20%20%20%20if%20new_value%20%3D%3D%20'interp'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20idx%20%3D%20idx%20%7C%20np.isnan(y)%0A%20%20%20%20%20%20%20%20if%20isinstance(new_value%2C%20str)%20and%20new_value%20not%20in%20%7B'delete'%2C%20'mean'%2C%20'median'%2C%20'interp'%7D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20raise%20ValueError('new_value%20must%20be%20numeric%2C%20delete%2C%20mean%2C%20median%2C%20or%20interp')%0A%20%20%20%20%20%20%20%20if%20max_alert%20and%20idx.any()%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20edges%20%3D%20np.diff(np.r_%5BFalse%2C%20idx%2C%20False%5D.astype(int))%0A%20%20%20%20%20%20%20%20%20%20%20%20lengths%20%3D%20np.flatnonzero(edges%20%3D%3D%20-1)%20-%20np.flatnonzero(edges%20%3D%3D%201)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20np.any(lengths%20%3E%3D%20max_alert)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20import%20warnings%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20warnings.warn('Long%20missing-data%20sequence%3B%20assess%20whether%20replacement%20is%20justified.'%2C%20stacklevel%3D2)%0A%20%20%20%20%20%20%20%20if%20isinstance(new_value%2C%20Number)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20y%5Bidx%5D%20%3D%20new_value%0A%20%20%20%20%20%20%20%20elif%20new_value%20%3D%3D%20'delete'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20y%20%3D%20y%5B~idx%5D%0A%20%20%20%20%20%20%20%20elif%20idx.any()%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20valid%20%3D%20~idx%20%26%20np.isfinite(y)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20not%20valid.any()%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20raise%20ValueError('Replacement%20requires%20at%20least%20one%20finite%20observed%20value')%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20new_value%20%3D%3D%20'mean'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%5Bidx%5D%20%3D%20np.mean(y%5Bvalid%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20elif%20new_value%20%3D%3D%20'median'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%5Bidx%5D%20%3D%20np.median(y%5Bvalid%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20missing%20%3D%20idx%20%7C%20np.isnan(y)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20samples%20%3D%20np.arange(y.size)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%5Bmissing%5D%20%3D%20np.interp(samples%5Bmissing%5D%2C%20samples%5Bvalid%5D%2C%20y%5Bvalid%5D)%0A%20%20%20%20%20%20%20%20return%20y%0A%0A%20%20%20%20return%20(rep_missing%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Mark%20the%20missing%20values%0A%0A%20%20%20%20%60value%60%20identifies%20a%20missing-data%20sentinel.%20The%20default%20is%20%60np.nan%60%3B%20a%20zero%20is%20missing%20only%20when%20the%20acquisition%20convention%20says%20so.%20The%20function%20returns%20a%20copy%2C%20leaving%20the%20measurement%20unchanged.%20%60max_alert%60%20warns%20about%20long%20consecutive%20gaps%3B%20it%20does%20not%20make%20filling%20those%20gaps%20scientifically%20justified.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20x%20%3D%20np.array(%5B1%2C%202%2C%20np.nan%2C%204%2C%2020%2C%20np.nan%2C%20np.nan%2C%200%2C%201%5D)%0A%20%20%20%20x%0A%20%20%20%20return%20(x%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%201.**%20Which%20entries%20in%20%60x%60%20are%20missing%20under%20the%20default%20convention%3F%20What%20changes%20when%20%60value%3D0%60%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%201%0A%0A%20%20%20%20With%20the%20default%20convention%20the%20missing%20indices%20are%202%2C%205%2C%20and%206%20(zero-based).%20With%20%60value%3D0%60%2C%20only%20index%207%20is%20selected.%20NaNs%20still%20remain%20NaNs%20for%20constant%2C%20mean%2C%20and%20median%20replacement%3B%20interpolation%20also%20fills%20NaNs.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Compare%20the%20replacements%0A%0A%20%20%20%20A%20mean%20or%20median%20uses%20only%20finite%2C%20unflagged%20observations.%20Deleting%20a%20sample%20changes%20the%20time%20grid%20if%20you%20subsequently%20pretend%20that%20the%20remaining%20samples%20are%20equally%20spaced.%20Keep%20the%20original%20timestamps%20when%20deleting%20data.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(rep_missing%2C%20x)%3A%0A%20%20%20%20replacements%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22constant%22%3A%20rep_missing(x%2C%20new_value%3D0)%2C%0A%20%20%20%20%20%20%20%20%22delete%22%3A%20rep_missing(x%2C%20new_value%3D%22delete%22)%2C%0A%20%20%20%20%20%20%20%20%22mean%22%3A%20rep_missing(x%2C%20new_value%3D%22mean%22)%2C%0A%20%20%20%20%20%20%20%20%22median%22%3A%20rep_missing(x%2C%20new_value%3D%22median%22)%2C%0A%20%20%20%20%20%20%20%20%22interpolate%22%3A%20rep_missing(x%2C%20new_value%3D%22interp%22)%2C%0A%20%20%20%20%7D%0A%20%20%20%20replacements%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%202.**%20For%20%60%5B1%2C%200%2C%209%5D%60%2C%20treating%20zero%20as%20missing%2C%20find%20the%20mean%20and%20median%20replacements.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%202%0A%0A%20%20%20%20Both%20give%20%60%5B1%2C%205%2C%209%5D%60%3A%20the%20observed%20values%20are%201%20and%209%2C%20whose%20mean%20and%20median%20are%20both%205.%20Including%20the%20sentinel%20in%20the%20calculation%20would%20bias%20the%20result.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Interpolate%20a%20short%20gap%0A%0A%20%20%20%20Linear%20interpolation%20assumes%20uniformly%20spaced%20samples%20and%20a%20straight%20segment%20between%20adjacent%20observed%20values.%20At%20missing%20endpoints%20this%20helper%20extends%20the%20nearest%20observed%20value%2C%20an%20explicit%20extrapolation%20convention.%20It%20cannot%20reconstruct%20unobserved%20rapid%20changes.%20All-missing%20input%20raises%20a%20clear%20error%20for%20data-dependent%20replacement.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np%2C%20rep_missing)%3A%0A%20%20%20%20rep_missing(%5Bnp.nan%2C%202%2C%20np.nan%2C%206%2C%20np.nan%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%203.**%20What%20is%20the%20interpolated%20interior%20value%20in%20%60%5B2%2C%20NaN%2C%206%5D%60%2C%20and%20why%20is%20replacing%20a%20long%20gap%20riskier%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%203%0A%0A%20%20%20%20The%20interior%20value%20is%204%20because%20it%20lies%20halfway%20between%20two%20observations.%20A%20long%20gap%20permits%20many%20possible%20trajectories%3B%20linear%20interpolation%20chooses%20one%20without%20measuring%20it.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Detect%20consecutive%20gaps%20before%20filling%0A%0A%20%20%20%20The%20companion%20%5Bdetecta%20sequence-detection%20guide%5D(https%3A%2F%2Fgithub.com%2Fdemotu%2Fdetecta)%20returns%20inclusive%20start%2Fend%20indices%20and%20lets%20you%20reject%20gaps%20longer%20than%20an%20acceptable%20duration.%20For%20the%20original%20example%2C%20the%20NaN%20runs%20are%20%60%5B2%2C%202%5D%60%20and%20%60%5B5%2C%206%5D%60%3B%20a%20run%20of%20length%20two%20spans%20two%20missing%20samples.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Checkpoint%20questions%0A%0A%20%20%20%201.%20Is%20a%20numerical%20zero%20always%20missing%3F%0A%0A%20%20%20%202.%20Does%20filling%20a%20gap%20create%20a%20new%20measurement%3F%0A%0A%20%20%20%203.%20What%20happens%20to%20the%20original%20input%20array%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Checkpoint%20answers%0A%0A%20%20%20%201.%20No%3B%20the%20file%20convention%20determines%20that.%0A%20%20%20%202.%20No%3B%20the%20filled%20values%20are%20estimates.%0A%20%20%20%203.%20It%20stays%20unchanged.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Problems%0A%0A%20%20%20%20Try%20these%20independently%3B%20open%20a%20panel%20only%20to%20check%20your%20final%20answer.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Problem%201.**%20Fill%20%60%5B2%2C%20NaN%2C%208%5D%60%20by%20linear%20interpolation.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Answer%20to%20Problem%201%0A%0A%20%20%20%20%60%5B2%2C%205%2C%208%5D%60.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Problem%202.**%20At%20100%20Hz%2C%20how%20many%20samples%20are%20missing%20in%20a%20gap%20marked%20by%20inclusive%20indices%2010%20through%2014%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Answer%20to%20Problem%202%0A%0A%20%20%20%205%20samples%3B%20missing-sample%20duration%200.05%20s.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Go%20deeper%0A%0A%20%20%20%20Compare%20replacement%20choices%20on%20a%20short%2C%20known%20gap%20before%20applying%20them%20to%20a%20recording.%0A%0A%20%20%20%20%23%23%23%20Video%20lectures%20on%20the%20Internet%0A%0A%20%20%20%20%5BMIT%20OpenCourseWare%3A%20Signals%20and%20Systems%20video%20lectures%5D(https%3A%2F%2Focw.mit.edu%2Fcourses%2Fres-6-007-signals-and-systems-spring-2011%2Fvideo_galleries%2Fvideo-lectures%2F)%20give%20context%20for%20sampling%20and%20interpolation.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20References%0A%0A%20%20%20%20-%20%5BNumPy%3A%20linear%20interpolation%5D(https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2Freference%2Fgenerated%2Fnumpy.interp.html).%0A%0A%20%20%20%20-%20%5BSequence%20detection%20in%20detecta%5D(https%3A%2F%2Fgithub.com%2Fdemotu%2Fdetecta).%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
9df3ad6febb41f777ca687620c670154