4
4
from dataclasses import dataclass
5
5
from enum import StrEnum
6
6
from pathlib import Path
7
- from typing import Any , Literal , Self , overload
7
+ from typing import Any , Literal , overload
8
8
9
9
import numpy as np
10
10
from scipy .stats import norm
@@ -227,8 +227,23 @@ class ScalarParameter:
227
227
input_source : DataSource
228
228
# dataset_file: PolarsData | None
229
229
230
+ # return cls(
231
+ # name=gen_kw_key,
232
+ # forward_init=forward_init,
233
+ # template_file=template_file,
234
+ # output_file=output_file,
235
+ # forward_init_file=init_file,
236
+ # transform_function_definitions=transform_function_definitions,
237
+ # update=update_parameter,
238
+ # )
239
+
240
+
241
+ @dataclass
242
+ class ScalarParameters :
243
+ scalar_params : dict [DataSource , list [ScalarParameter ]]
244
+
230
245
@classmethod
231
- def from_config_list (cls , gen_kw : list [str ]) -> list [Self ]:
246
+ def from_config_list (cls , gen_kw : list [str ]) -> list [ScalarParameter ]:
232
247
gen_kw_key = gen_kw [0 ]
233
248
234
249
positional_args , options = parse_config (gen_kw , 4 )
@@ -303,7 +318,7 @@ def from_config_list(cls, gen_kw: list[str]) -> list[Self]:
303
318
if errors :
304
319
raise ConfigValidationError .from_collected (errors )
305
320
306
- parameter_configuration : list [Self ] = []
321
+ parameter_configuration : list [ScalarParameter ] = []
307
322
with open (parameter_file , encoding = "utf-8" ) as file :
308
323
for line_number , item in enumerate (file ):
309
324
item = item .split ("--" )[0 ] # remove comments
@@ -318,7 +333,7 @@ def from_config_list(cls, gen_kw: list[str]) -> list[Self]:
318
333
)
319
334
else :
320
335
parameter_configuration .append (
321
- cls (
336
+ ScalarParameter (
322
337
param_name = items [1 ],
323
338
input_source = DataSource .SAMPLED ,
324
339
group_name = gen_kw_key ,
@@ -327,6 +342,9 @@ def from_config_list(cls, gen_kw: list[str]) -> list[Self]:
327
342
output_file = output_file ,
328
343
)
329
344
)
345
+ # cls.all_scalar_params[DataSource.SAMPLED] += (
346
+ # parameter_configuration
347
+ # )
330
348
331
349
if errors :
332
350
raise ConfigValidationError .from_collected (errors )
@@ -339,13 +357,3 @@ def from_config_list(cls, gen_kw: list[str]) -> list[Self]:
339
357
gen_kw [0 ],
340
358
)
341
359
return parameter_configuration
342
-
343
- # return cls(
344
- # name=gen_kw_key,
345
- # forward_init=forward_init,
346
- # template_file=template_file,
347
- # output_file=output_file,
348
- # forward_init_file=init_file,
349
- # transform_function_definitions=transform_function_definitions,
350
- # update=update_parameter,
351
- # )
0 commit comments