Skip to content

Commit

Permalink
Stashing
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPHoughton committed Sep 5, 2017
1 parent a9e9b37 commit a9444e1
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 101 deletions.
119 changes: 24 additions & 95 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 23 additions & 6 deletions pysd/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def sample_pspace(model, param_list=None, bounds=None, samples=100):
the model.
Uses latin hypercube sampling, with random values within
the sample bins. the LHS sampler shuffles the bins each time,
the sample bins. The LHS sampler shuffles the bins each time,
so a subsequent call will yield a different sample from the
parameter space.
Expand Down Expand Up @@ -451,8 +451,25 @@ def timestep_test(model, threshold=.99, errors='return'):
pass


# __all__ = [create_extreme_conditions_test_matrix,
# extreme_conditions_test,
# create_bounds_test_matrix,
# bounds_test,
# sample_pspace]
def lookup_linter(model):
"""
Linter on lookup tables.
Checks that tables are:
- normalized
- monotonic
Parameters
----------
model
Returns
-------
References
----------
Sterman 2000, table 14.1
"""
32 changes: 32 additions & 0 deletions sandbox.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,38 @@
"import networkx as nx"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = pd.Series(np.arange(0,40,1))\n",
"# y = pd.Series(index=range(0,40))\n",
"# y[:10] = x[:10]**2 \n",
"# y[10:30] = -1*(x[10:30]-20)**2 + 2*x[10]**2\n",
"# y[30:40] = (x[30:40]-40)**2\n",
"\n",
"y = -1*np.cos(x*2*np.pi/40)\n",
"plt.plot(x, y)\n",
"\n",
"d1 = y.diff()\n",
"d2 = d1.diff()\n",
"inc_growth = (d1 > 0) & (d2 > 0)\n",
"dec_growth = (d1 > 0) & (d2 < 0)\n",
"inc_decline = (d1 < 0) & (d2 < 0)\n",
"dec_decline = (d1 < 0) & (d2 > 0)\n",
"\n",
"(inc_growth[inc_growth].index.max() < \n",
" dec_growth[dec_growth].index.min() <\n",
" dec_growth[dec_growth].index.max() <\n",
" inc_decline[inc_decline].index.min() <\n",
" inc_decline[inc_decline].index.max() <\n",
" dec_decline[dec_decline].index.min())"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand Down

0 comments on commit a9444e1

Please sign in to comment.