33"""
44
55import copy
6- import numbers
76from enum import StrEnum
87from typing import Any
98
@@ -37,15 +36,6 @@ def validate_configuration(
3736 """
3837 config = copy .deepcopy (config )
3938
40- if config ["designtype" ] != "onebyone" :
41- raise ValueError (
42- "Generation of DesignMatrix only implemented for type 'onebyone', "
43- f"not { config ['designtype' ]} "
44- )
45-
46- if "repeats" not in config :
47- raise LookupError ('"repeats" must be specified in general input sheet' )
48-
4939 key = "correlation_iterations"
5040 if key not in config :
5141 if verbosity > 0 :
@@ -60,29 +50,6 @@ def validate_configuration(
6050 f" If desired correlation does not match observed, try setting { key !r} =999 or higher." # ruff: ignore[line-too-long]
6151 )
6252 config [key ] = 0
63- else :
64- try :
65- config [key ] = int (config [key ])
66- except (ValueError , TypeError ) as err :
67- raise ValueError (
68- f"{ key !r} must be a non-negative integer, got: { config [key ]} "
69- ) from err
70-
71- key = "distribution_seed"
72- if key not in config :
73- raise ValueError (
74- "You did not specify a value for 'distribution_seed', which is used to "
75- "seed the random number generator that draws from distributions in Monte "
76- "Carlo sensitivities.\n "
77- "- Specify a number (e.g. a 6 digit integer) to seed the random number "
78- "generator and obtain reproducible results.\n "
79- "- Specify None if you do not want to seed the random number generator. "
80- "Your analysis will not be reproducible."
81- )
82- if not (isinstance (config [key ], numbers .Integral ) or (config [key ] is None )):
83- raise ValueError (
84- f"{ key !r} must be a non-negative integer or None, got: { config [key ]} "
85- )
8653
8754 # 'seed_strategy' controls how Monte Carlo samples are seeded.
8855 # See the SeedStrategy docstring for what each strategy means.
@@ -92,13 +59,7 @@ def validate_configuration(
9259 value = value .strip ().lower ()
9360 if value is None or value == "none" :
9461 value = SeedStrategy .JOINT
95- try :
96- config [key ] = SeedStrategy (value )
97- except (ValueError , TypeError ) as err :
98- raise ValueError (
99- f"{ key !r} must be one of { [s .value for s in SeedStrategy ]} , "
100- f"got: { config [key ]} "
101- ) from err
62+ config [key ] = SeedStrategy (value )
10263
10364 # 'seeds' here is 'rms_seeds' in the input. It can be either:
10465 # - 'default' => gives seed numbers 1000, 1001, 1002, ...
0 commit comments