Skip to content

Commit

Permalink
Delayed, conservative, driven dissipative -- updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stanweer1 committed Aug 21, 2024
1 parent 72a5a8c commit d295ad4
Show file tree
Hide file tree
Showing 15 changed files with 471 additions and 263 deletions.
95 changes: 65 additions & 30 deletions docs/_modules/teaspoon/MakeData/DynSysLib/conservative_flows.html

Large diffs are not rendered by default.

219 changes: 142 additions & 77 deletions docs/_modules/teaspoon/MakeData/DynSysLib/driven_dissipative_flows.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/_modules/teaspoon/MakeData/DynSysLib/medical_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h1>Source code for teaspoon.MakeData.DynSysLib.medical_data</h1><div class="hig
<div class="viewcode-block" id="EEG"><a class="viewcode-back" href="../../../../modules/MakeData/DynSysLib/medical_data.html#teaspoon.MakeData.DynSysLib.medical_data.EEG">[docs]</a><span class="k">def</span> <span class="nf">EEG</span><span class="p">(</span><span class="n">SampleSize</span><span class="o">=</span><span class="mi">5000</span><span class="p">,</span> <span class="n">dynamic_state</span><span class="o">=</span><span class="s1">&#39;normal&#39;</span><span class="p">):</span>

<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The EEG signal was taken from andrzejak et al. [1]. Speci cally, the first 5000 data points from the EEG data of a healthy patient from set A (file Z-093) was used and the first 5000 data points of a patient experiencing a seizure from set E (file S-056) was used (see figure below for case during seizure).</span>
<span class="sd"> The EEG signal was taken from andrzejak et al. [1]_. Speci cally, the first 5000 data points from the EEG data of a healthy patient from set A (file Z-093) was used and the first 5000 data points of a patient experiencing a seizure from set E (file S-056) was used (see figure below for case during seizure).</span>

<span class="sd"> .. figure:: ../../../figures/Human_Medical_Data/EEG_Data.png</span>
<span class="sd"> </span>
Expand Down Expand Up @@ -191,7 +191,7 @@ <h1>Source code for teaspoon.MakeData.DynSysLib.medical_data</h1><div class="hig
<div class="viewcode-block" id="ECG"><a class="viewcode-back" href="../../../../modules/MakeData/DynSysLib/medical_data.html#teaspoon.MakeData.DynSysLib.medical_data.ECG">[docs]</a><span class="k">def</span> <span class="nf">ECG</span><span class="p">(</span><span class="n">dynamic_state</span><span class="o">=</span><span class="s1">&#39;normal&#39;</span><span class="p">):</span>

<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The Electrocardoagram (ECG) data was taken from SciPys misc.electrocardiogram data set. This ECG data was originally provided by the MIT-BIH Arrhythmia Database [1]. We used data points 3000 to 5500 during normal sinus rhythm and 8500 to 11000 during arrhythmia (arrhythmia case shown below in figure).</span>
<span class="sd"> The Electrocardoagram (ECG) data was taken from SciPys misc.electrocardiogram data set. This ECG data was originally provided by the MIT-BIH Arrhythmia Database [2]_. We used data points 3000 to 5500 during normal sinus rhythm and 8500 to 11000 during arrhythmia (arrhythmia case shown below in figure).</span>

<span class="sd"> .. figure:: ../../../figures/Human_Medical_Data/ECG_Data.png</span>
<span class="sd"> </span>
Expand All @@ -203,7 +203,7 @@ <h1>Source code for teaspoon.MakeData.DynSysLib.medical_data</h1><div class="hig

<span class="sd"> References</span>
<span class="sd"> ----------</span>
<span class="sd"> .. [1] George B Moody and Roger G Mark. Theimpact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3):4550, 2001.</span>
<span class="sd"> .. [2] George B Moody and Roger G Mark. Theimpact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3):4550, 2001.</span>
<span class="sd"> </span>
<span class="sd"> &quot;&quot;&quot;</span>

Expand Down
Binary file modified docs/doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/doctrees/modules/MakeData/DynSysLib/medical_data.doctree
Binary file not shown.
Binary file modified docs/doctrees/modules/SP/stoch_bif.doctree
Binary file not shown.
20 changes: 12 additions & 8 deletions docs/modules/MakeData/DynSysLib/conservative_flows.html

Large diffs are not rendered by default.

60 changes: 32 additions & 28 deletions docs/modules/MakeData/DynSysLib/driven_dissipative_flows.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/modules/MakeData/DynSysLib/medical_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h1><span class="section-number">2.1.2.1.7. </span>Medical Data<a class="headerl
<dl class="py function">
<dt class="sig sig-object py" id="teaspoon.MakeData.DynSysLib.medical_data.EEG">
<span class="sig-prename descclassname"><span class="pre">teaspoon.MakeData.DynSysLib.medical_data.</span></span><span class="sig-name descname"><span class="pre">EEG</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">SampleSize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dynamic_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'normal'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/teaspoon/MakeData/DynSysLib/medical_data.html#EEG"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#teaspoon.MakeData.DynSysLib.medical_data.EEG" title="Permalink to this definition"></a></dt>
<dd><p>The EEG signal was taken from andrzejak et al. [1]. Speci cally, the first 5000 data points from the EEG data of a healthy patient from set A (file Z-093) was used and the first 5000 data points of a patient experiencing a seizure from set E (file S-056) was used (see figure below for case during seizure).</p>
<dd><p>The EEG signal was taken from andrzejak et al. <a class="footnote-reference brackets" href="#id2" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>. Speci cally, the first 5000 data points from the EEG data of a healthy patient from set A (file Z-093) was used and the first 5000 data points of a patient experiencing a seizure from set E (file S-056) was used (see figure below for case during seizure).</p>
<figure class="align-default">
<img alt="../../../_images/EEG_Data.png" src="../../../_images/EEG_Data.png" />
</figure>
Expand All @@ -196,8 +196,8 @@ <h1><span class="section-number">2.1.2.1.7. </span>Medical Data<a class="headerl
</dl>
<p class="rubric">References</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id1" role="note">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<aside class="footnote brackets" id="id2" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<p>Ralph G Andrzejak, Klaus Lehnertz, Florian Mormann, Christoph Rieke, Peter David, and Christian E Elger. Indications of nonlinear deterministic and nite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state. Physical Review E, 64(6):061907, 2001.</p>
</aside>
</aside>
Expand All @@ -206,7 +206,7 @@ <h1><span class="section-number">2.1.2.1.7. </span>Medical Data<a class="headerl
<dl class="py function">
<dt class="sig sig-object py" id="teaspoon.MakeData.DynSysLib.medical_data.ECG">
<span class="sig-prename descclassname"><span class="pre">teaspoon.MakeData.DynSysLib.medical_data.</span></span><span class="sig-name descname"><span class="pre">ECG</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dynamic_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'normal'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/teaspoon/MakeData/DynSysLib/medical_data.html#ECG"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#teaspoon.MakeData.DynSysLib.medical_data.ECG" title="Permalink to this definition"></a></dt>
<dd><p>The Electrocardoagram (ECG) data was taken from SciPys misc.electrocardiogram data set. This ECG data was originally provided by the MIT-BIH Arrhythmia Database [1]. We used data points 3000 to 5500 during normal sinus rhythm and 8500 to 11000 during arrhythmia (arrhythmia case shown below in figure).</p>
<dd><p>The Electrocardoagram (ECG) data was taken from SciPys misc.electrocardiogram data set. This ECG data was originally provided by the MIT-BIH Arrhythmia Database <a class="footnote-reference brackets" href="#id4" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>. We used data points 3000 to 5500 during normal sinus rhythm and 8500 to 11000 during arrhythmia (arrhythmia case shown below in figure).</p>
<figure class="align-default">
<img alt="../../../_images/ECG_Data.png" src="../../../_images/ECG_Data.png" />
</figure>
Expand All @@ -223,8 +223,8 @@ <h1><span class="section-number">2.1.2.1.7. </span>Medical Data<a class="headerl
</dl>
<p class="rubric">References</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id2" role="note">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<aside class="footnote brackets" id="id4" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id3">2</a><span class="fn-bracket">]</span></span>
<p>George B Moody and Roger G Mark. Theimpact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3):4550, 2001.</p>
</aside>
</aside>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

95 changes: 65 additions & 30 deletions teaspoon/teaspoon/MakeData/DynSysLib/conservative_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def conservative_flows(system, dynamic_state=None, L=None, fs=None,

return t, ts

def simplest_driven_chaotic_flow(fs = 50, SampleSize = 5000, L = 300.0, parameters=[1], InitialConditions=[0, 0]):
def simplest_driven_chaotic_flow(fs = 50, SampleSize = 5000, L = 300.0, parameters=[1], InitialConditions=[0, 0], dynamic_state=None):

"""
The simplest driven chaotic flow can be reproduced with the following equations
Expand All @@ -37,20 +37,28 @@ def simplest_driven_chaotic_flow(fs = 50, SampleSize = 5000, L = 300.0, paramete
L (Optional[int]): Number of iterations.
fs (Optional[int]): sampling rate for simulation.
SampleSize (Optional[int]): length of sample at end of entire time series
parameters (Optional[floats]): list of values for [:math:`\\omega`].
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`y_0`]
parameters (Optional[floats]): array [:math:`\\omega`] or None if using the dynamic_state variable
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`y_0`]
dynamic_state (Optional[str]): Set dynamic state as either 'periodic' or 'chaotic' if not supplying parameters.
Returns:
array: Array of the time indices as `t` and the simulation time series `ts`
"""

t = np.linspace(0, L, int(L*fs))

if len(parameters) != 1:
print(
'Warning: needed 1 parameters. Defaulting to periodic solution parameters.')
print('Parameters needed are [omega].')
parameters = None
num_param = 1

if len(parameters) != num_param:
raise ValueError(f'Need {num_param} parameters as specified in documentation.')
elif dynamic_state != None:
if dynamic_state == 'periodic':
omega = 1
elif dynamic_state == 'chaotic':
omega = 1.88
else:
raise ValueError(f'dynamic_state needs to be either "periodic" or "chaotic" or provide an array of length {num_param} in parameters.')
else:
omega = parameters[0]

Expand All @@ -66,7 +74,7 @@ def simplest_driven_chaotic_flow(state, t):
return t, ts


def nose_hoover_oscillator(fs = 20, SampleSize = 5000, L = 500.0, parameters=[6], InitialConditions=[0, 5, 0]):
def nose_hoover_oscillator(fs = 20, SampleSize = 5000, L = 500.0, parameters=[6], InitialConditions=[0, 5, 0], dynamic_state=None):

"""
The Nose Hoover Oscillator is represented by the following equations
Expand All @@ -86,20 +94,28 @@ def nose_hoover_oscillator(fs = 20, SampleSize = 5000, L = 500.0, parameters=[6]
L (Optional[int]): Number of iterations.
fs (Optional[int]): sampling rate for simulation.
SampleSize (Optional[int]): length of sample at end of entire time series
parameters (Optional[floats]): list of values for [:math:`a`].
parameters (Optional[floats]): list of values for [:math:`a`] or None if using the dynamic_state variable
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`y_0`, :math:`z_0`]
dynamic_state (Optional[str]): Set dynamic state as either 'periodic' or 'chaotic' if not supplying parameters.
Returns:
array: Array of the time indices as `t` and the simulation time series `ts`
"""

t = np.linspace(0, L, int(L*fs))

if len(parameters) != 1:
print(
'Warning: needed 1 parameters. Defaulting to periodic solution parameters.')
print('Parameters needed are [a].')
parameters = None
num_param = 1

if len(parameters) != num_param:
raise ValueError(f'Need {num_param} parameters as specified in documentation.')
elif dynamic_state != None:
if dynamic_state == 'periodic':
a = 6
elif dynamic_state == 'chaotic':
a = 1
else:
raise ValueError(f'dynamic_state needs to be either "periodic" or "chaotic" or provide an array of length {num_param} in parameters.')
else:
a = parameters[0]

Expand All @@ -116,7 +132,7 @@ def nose_hoover_oscillator(state, t):
return t, ts


def labyrinth_chaos(fs = 10, SampleSize = 5000, L = 2000.0, parameters=[1, 1, 1], InitialConditions=[0.1, 0, 0]):
def labyrinth_chaos(fs = 10, SampleSize = 5000, L = 2000.0, parameters=[1, 1, 1], InitialConditions=[0.1, 0, 0], dynamic_state=None):

"""
The Labyrinth Chaos Oscillator is represented by the following equations
Expand All @@ -136,20 +152,29 @@ def labyrinth_chaos(fs = 10, SampleSize = 5000, L = 2000.0, parameters=[1, 1, 1]
L (Optional[int]): Number of iterations.
fs (Optional[int]): sampling rate for simulation.
SampleSize (Optional[int]): length of sample at end of entire time series
parameters (Optional[floats]): list of values for [:math:`a`, :math:`b`, :math:`c`].
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`y_0`, :math:`z_0`]
parameters (Optional[floats]): list of values for [:math:`a`, :math:`b`, :math:`c`] or None if using the dynamic_state variable
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`y_0`, :math:`z_0`]
dynamic_state (Optional[str]): Set dynamic state as either 'periodic' or 'chaotic' if not supplying parameters.
Returns:
array: Array of the time indices as `t` and the simulation time series `ts`
"""

t = np.linspace(0, L, int(L*fs))

if len(parameters) != 3:
print(
'Warning: needed 3 parameters. Defaulting to periodic solution parameters.')
print('Parameters needed are [a, b, c].')
parameters = None
num_param = 3

if len(parameters) != num_param:
raise ValueError(f'Need {num_param} parameters as specified in documentation.')
elif dynamic_state != None:
if dynamic_state == 'periodic':
print('We could not find a periodic response. Using the chaotic parameters.')
a, b, c = 1, 1, 1
elif dynamic_state == 'chaotic':
a, b, c = 1, 1, 1
else:
raise ValueError(f'dynamic_state needs to be either "periodic" or "chaotic" or provide an array of length {num_param} in parameters.')
else:
a, b, c = parameters[0], parameters[1], parameters[2]

Expand All @@ -166,7 +191,7 @@ def labyrinth_chaos(state, t):
return t, ts


def henon_heiles_system(fs = 20, SampleSize = 5000, L = 10000.0, parameters=[1], InitialConditions=[0.499, 0, 0, 0.03]):
def henon_heiles_system(fs = 20, SampleSize = 5000, L = 10000.0, parameters=[1], InitialConditions=[0.499, 0, 0, 0.03], dynamic_state=None):

"""
The Henon Heiles System is represented by the following equations
Expand All @@ -188,23 +213,33 @@ def henon_heiles_system(fs = 20, SampleSize = 5000, L = 10000.0, parameters=[1],
L (Optional[int]): Number of iterations.
fs (Optional[int]): sampling rate for simulation.
SampleSize (Optional[int]): length of sample at end of entire time series
parameters (Optional[floats]): list of values for [:math:`a`].
parameters (Optional[floats]): list of values for [:math:`a`] or None if using the dynamic_state variable
InitialConditions (Optional[floats]): list of values for [:math:`x_0`, :math:`px_0`, :math:`y_0`, :math:`py_0`]
dynamic_state (Optional[str]): Set dynamic state as either 'periodic' or 'chaotic' if not supplying parameters.
Returns:
array: Array of the time indices as `t` and the simulation time series `ts`
"""

t = np.linspace(0, L, int(L*fs))

if len(parameters) != 1:
print(
'Warning: needed 1 parameters. Defaulting to periodic solution parameters.')
print('Parameters needed are [a].')
parameters = None
num_param = 1

if len(parameters) != num_param:
raise ValueError(f'Need {num_param} parameters as specified in documentation.')
elif dynamic_state != None:
if dynamic_state == 'periodic':
print('We could not find a periodic response. Using the chaotic parameters.')
a = 1
elif dynamic_state == 'chaotic':
a = 1
else:
raise ValueError(f'dynamic_state needs to be either "periodic" or "chaotic" or provide an array of length {num_param} in parameters.')
else:
a = parameters[0]


# defining simulation functions
def henon_heiles_system(state, t):
x, px, y, py = state # unpack the state vector
Expand Down
Loading

0 comments on commit d295ad4

Please sign in to comment.