Skip to content

Commit d16100e

Browse files
authored
Merge branch 'master' into bugfixes
2 parents 3fb56f7 + 1256560 commit d16100e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
# General information about the project.
6767
project = "ema_workbench"
68-
copyright = "2011-2022, J.H. Kwakkel"
68+
copyright = "2011-2023, J.H. Kwakkel"
6969

7070

7171
# The version info for the project you're documenting, acts as replacement for

ema_workbench/em_framework/parameters.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ class RealParameter(Parameter):
211211
upper_bound : int or float
212212
resolution : iterable
213213
variable_name : str, or list of str
214+
pff : bool
215+
if true, sample over this parameter using resolution in case of
216+
partial factorial sampling
214217
215218
Raises
216219
------
@@ -250,6 +253,16 @@ def from_dist(cls, name, dist, **kwargs):
250253
raise ValueError("dist should be instance of rv_continouos")
251254
return super().from_dist(name, dist, **kwargs)
252255

256+
def __repr__(self):
257+
if isinstance(self.dist, sp.stats._distn_infrastructure.rv_continuous_frozen):
258+
return (
259+
f"RealParameter('{self.name}', {self.lower_bound}, {self.upper_bound}, "
260+
f"resolution={self.resolution}, default={self.default}, variable_name={self.variable_name}, "
261+
f"pff={self.pff})"
262+
)
263+
else:
264+
return super().__repr__()
265+
253266

254267
class IntegerParameter(Parameter):
255268
"""integer valued model input parameter
@@ -261,6 +274,9 @@ class IntegerParameter(Parameter):
261274
upper_bound : int
262275
resolution : iterable
263276
variable_name : str, or list of str
277+
pff : bool
278+
if true, sample over this parameter using resolution in case of
279+
partial factorial sampling
264280
265281
Raises
266282
------
@@ -321,6 +337,16 @@ def from_dist(cls, name, dist, **kwargs):
321337
raise ValueError("dist should be instance of rv_discrete")
322338
return super().from_dist(name, dist, **kwargs)
323339

340+
def __repr__(self):
341+
if isinstance(self.dist, sp.stats._distn_infrastructure.rv_discrete_frozen):
342+
return (
343+
f"IntegerParameter('{self.name}', {self.lower_bound}, {self.upper_bound}, "
344+
f"resolution={self.resolution}, default={self.default}, variable_name={self.variable_name}, "
345+
f"pff={self.pff})"
346+
)
347+
else:
348+
return super().__repr__()
349+
324350

325351
class CategoricalParameter(IntegerParameter):
326352
"""categorical model input parameter
@@ -441,6 +467,12 @@ def __init__(self, name, default=None, variable_name=None, pff=False):
441467
name, categories=[True, False], default=default, variable_name=variable_name, pff=pff
442468
)
443469

470+
def __repr__(self):
471+
return (
472+
f"BooleanParameter('{self.name}', default={self.default}, "
473+
f"variable_name={self.variable_name}, pff={self.pff})"
474+
)
475+
444476

445477
def parameters_to_csv(parameters, file_name):
446478
"""Helper function for writing a collection of parameters to a csv file

0 commit comments

Comments
 (0)