Modeling: Difference between revisions
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
=Eyeopeners= | =Eyeopeners= | ||
* Store results in a list | * Store results in a [[Python:DataTypes#List|list]] | ||
<syntaxhighlight lang=python> | <syntaxhighlight lang=python> | ||
for a in range(100): | for a in range(100): | ||
| Line 8: | Line 8: | ||
funcBresults[a] = functionBcall(bla,bla) | funcBresults[a] = functionBcall(bla,bla) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
: ModSimPy is using Series from [[Pandas]] to store results. This adds handy functions. | : ModSimPy is using Series from [[Pandas]] to store results. This adds handy functions like. | ||
* The state of the model is stored in a Pandas Series too. | * The state of the model is stored in a Pandas Series too. | ||
* Put other interesting metrics in the state object too. | * Put other interesting metrics in the state object too. | ||
* Check the effect of different parameter values using [[Numpy]] [[Numpy#linspace | linspace]]. | |||
<syntaxhighlight lang=python> | |||
funcAresults = pd.Series([]) | |||
p1_array = np.linspace(0,1,12) | |||
for p1 in p1_array: | |||
for a in range(50): | |||
funcAresults[a] = functionAcall(p1,p2) | |||
print(funcAresults) | |||
</syntaxhighlight> | |||
Revision as of 20:32, 19 December 2018
Mostly based on this paper that comes with its own modsim library.
Eyeopeners
- Store results in a list
for a in range(100):
funcAresults[a] = functionAcall(bla,bla)
funcBresults[a] = functionBcall(bla,bla)
- ModSimPy is using Series from Pandas to store results. This adds handy functions like.
- The state of the model is stored in a Pandas Series too.
- Put other interesting metrics in the state object too.
- Check the effect of different parameter values using Numpy linspace.
funcAresults = pd.Series([])
p1_array = np.linspace(0,1,12)
for p1 in p1_array:
for a in range(50):
funcAresults[a] = functionAcall(p1,p2)
print(funcAresults)