Skip to content
Snippets Groups Projects
Commit 2a2b6945 authored by BastianTigges's avatar BastianTigges
Browse files

added multi paramter funtion to example project

parent 2b72c98d
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
...@@ -62,6 +62,26 @@ Afterwards, we add some attributes to this parameter:: ...@@ -62,6 +62,26 @@ Afterwards, we add some attributes to this parameter::
parameter1.attrs['variable'] = '-' parameter1.attrs['variable'] = '-'
parameter1.attrs['origin'] = 'this' parameter1.attrs['origin'] = 'this'
A more efficient way to add the paramters can be achieved by using the function build_multi_paramters.
First, you need to include the function as follows::
from pykkn.build_multi_parameters import build_multi_parameters
Then you can create a dictionary with all the parameters::
dic = {
"list_of_parameters": [
{"name": "gain", "value": 1, "units": '-', "variables": '-', "orign": 'this'}
]
}
This dictionary can be adding more parameters by just adding another line in curly brackets. |br|
The builrd_multi_parameters uses the before created dictionary::
paramter1 = build_multi_paramters(dic)
You can choose one of the two shown ways to create parameters.
The next step is to create model to which we can add the parameters. The next step is to create model to which we can add the parameters.
In this case, we create the model1 which is called "feedthrough". In this case, we create the model1 which is called "feedthrough".
Afterwards we add the parameters to this model:: Afterwards we add the parameters to this model::
...@@ -196,9 +216,9 @@ The output of this short project can be seen below: ...@@ -196,9 +216,9 @@ The output of this short project can be seen below:
.. start of the explanation of the recurring functionalities of the differen modules .. start of the explanation of the recurring functionalities of the differen modules
======================================= =========================================
Recurring functionalities and attributes Recurring functionalities and attributes
======================================= =========================================
In PYKKN, you will find several functions that are avalaible in different modules. To achieve this, the library is based on object-oriented programming In PYKKN, you will find several functions that are avalaible in different modules. To achieve this, the library is based on object-oriented programming
and several modules inherit functions from the storable class. The functions of this class will be explained below in more detail to avoid explaining again for each module. and several modules inherit functions from the storable class. The functions of this class will be explained below in more detail to avoid explaining again for each module.
......
This diff is collapsed.
...@@ -157,6 +157,25 @@ Afterwards, we add some attributes to this parameter:</p> ...@@ -157,6 +157,25 @@ Afterwards, we add some attributes to this parameter:</p>
<span class="n">parameter1</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;this&#39;</span> <span class="n">parameter1</span><span class="o">.</span><span class="n">attrs</span><span class="p">[</span><span class="s1">&#39;origin&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;this&#39;</span>
</pre></div> </pre></div>
</div> </div>
<p>A more efficient way to add the paramters can be achieved by using the function build_multi_paramters.
First, you need to include the function as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">pykkn.build_multi_parameters</span> <span class="kn">import</span> <span class="n">build_multi_parameters</span>
</pre></div>
</div>
<p>Then you can create a dictionary with all the parameters:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dic</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;list_of_parameters&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;gain&quot;</span><span class="p">,</span> <span class="s2">&quot;value&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">&quot;units&quot;</span><span class="p">:</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s2">&quot;variables&quot;</span><span class="p">:</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s2">&quot;orign&quot;</span><span class="p">:</span> <span class="s1">&#39;this&#39;</span><span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
<p>This dictionary can be adding more parameters by just adding another line in curly brackets. <br>
The builrd_multi_parameters uses the before created dictionary:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">paramter1</span> <span class="o">=</span> <span class="n">build_multi_paramters</span><span class="p">(</span><span class="n">dic</span><span class="p">)</span>
</pre></div>
</div>
<p>You can choose one of the two shown ways to create parameters.</p>
<p>The next step is to create model to which we can add the parameters. <p>The next step is to create model to which we can add the parameters.
In this case, we create the model1 which is called “feedthrough”. In this case, we create the model1 which is called “feedthrough”.
Afterwards we add the parameters to this model:</p> Afterwards we add the parameters to this model:</p>
......
...@@ -62,6 +62,26 @@ Afterwards, we add some attributes to this parameter:: ...@@ -62,6 +62,26 @@ Afterwards, we add some attributes to this parameter::
parameter1.attrs['variable'] = '-' parameter1.attrs['variable'] = '-'
parameter1.attrs['origin'] = 'this' parameter1.attrs['origin'] = 'this'
A more efficient way to add the paramters can be achieved by using the function build_multi_paramters.
First, you need to include the function as follows::
from pykkn.build_multi_parameters import build_multi_parameters
Then you can create a dictionary with all the parameters::
dic = {
"list_of_parameters": [
{"name": "gain", "value": 1, "units": '-', "variables": '-', "orign": 'this'}
]
}
This dictionary can be adding more parameters by just adding another line in curly brackets. |br|
The builrd_multi_parameters uses the before created dictionary::
paramter1 = build_multi_paramters(dic)
You can choose one of the two shown ways to create parameters.
The next step is to create model to which we can add the parameters. The next step is to create model to which we can add the parameters.
In this case, we create the model1 which is called "feedthrough". In this case, we create the model1 which is called "feedthrough".
Afterwards we add the parameters to this model:: Afterwards we add the parameters to this model::
...@@ -196,9 +216,9 @@ The output of this short project can be seen below: ...@@ -196,9 +216,9 @@ The output of this short project can be seen below:
.. start of the explanation of the recurring functionalities of the differen modules .. start of the explanation of the recurring functionalities of the differen modules
======================================= =========================================
Recurring functionalities and attributes Recurring functionalities and attributes
======================================= =========================================
In PYKKN, you will find several functions that are avalaible in different modules. To achieve this, the library is based on object-oriented programming In PYKKN, you will find several functions that are avalaible in different modules. To achieve this, the library is based on object-oriented programming
and several modules inherit functions from the storable class. The functions of this class will be explained below in more detail to avoid explaining again for each module. and several modules inherit functions from the storable class. The functions of this class will be explained below in more detail to avoid explaining again for each module.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment