5
5
import jax .numpy as jnp
6
6
import jax
7
7
8
- def create_modifiers (additional_parameters = None ):
8
+ def create_modifiers ():
9
9
10
10
class PureFunctionModifierBuilder :
11
11
is_shared = True
12
12
def __init__ (self , pdfconfig ):
13
13
self .config = pdfconfig
14
- self .required_parsets = additional_parameters or {}
14
+ self .required_parsets = {}
15
15
self .builder_data = {'local' : {},'global' : {'symbols' : set ()}}
16
16
17
17
def collect (self , thismod , nom ):
18
18
maskval = True if thismod else False
19
19
mask = [maskval ] * len (nom )
20
20
return {'mask' : mask }
21
21
22
+ def require_synbols_as_scalars (self , symbols ):
23
+ param_spec = {
24
+ p :
25
+ [{
26
+ 'paramset_type' : 'unconstrained' ,
27
+ 'n_parameters' : 1 ,
28
+ 'is_shared' : True ,
29
+ 'inits' : (1.0 ,),
30
+ 'bounds' : ((0 ,10 ),),
31
+ 'is_scalar' : True ,
32
+ 'fixed' : False ,
33
+ }]
34
+ for p in symbols
35
+ }
36
+ return param_spec
37
+
38
+
22
39
def append (self , key , channel , sample , thismod , defined_samp ):
23
40
self .builder_data ['local' ].setdefault (key , {}).setdefault (sample , {}).setdefault ('data' , {'mask' : []})
24
41
@@ -42,6 +59,9 @@ def append(self, key, channel, sample, thismod, defined_samp):
42
59
43
60
def finalize (self ):
44
61
list_of_symbols = [str (x ) for x in self .builder_data ['global' ]['symbols' ]]
62
+
63
+ self .required_parsets = self .require_synbols_as_scalars (list_of_symbols )
64
+
45
65
self .builder_data ['global' ]['symbol_names' ] = list_of_symbols
46
66
for modname , modspec in self .builder_data ['local' ].items ():
47
67
for sample , samplespec in modspec .items ():
@@ -113,29 +133,13 @@ def apply(self, pars):
113
133
114
134
from pyhf .modifiers import histfactory_set
115
135
116
- def enable (new_params = None ):
136
+ def enable ():
117
137
modifier_set = {}
118
138
modifier_set .update (** histfactory_set )
119
139
120
- builder , applicator = create_modifiers (new_params )
140
+ builder , applicator = create_modifiers ()
121
141
122
142
modifier_set .update (** {
123
143
applicator .name : (builder , applicator )}
124
144
)
125
- return modifier_set
126
-
127
- def new_unconstrained_scalars (new_params ):
128
- param_spec = {
129
- p ['name' ]:
130
- [{
131
- 'paramset_type' : 'unconstrained' ,
132
- 'n_parameters' : 1 ,
133
- 'is_shared' : True ,
134
- 'inits' : (p ['init' ],),
135
- 'bounds' : ((p ['min' ], p ['max' ]),),
136
- 'is_scalar' : True ,
137
- 'fixed' : False ,
138
- }]
139
- for p in new_params
140
- }
141
- return param_spec
145
+ return modifier_set
0 commit comments