Skip to content

Commit 52dcb55

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 73095f8 commit 52dcb55

10 files changed

Lines changed: 70 additions & 69 deletions

File tree

alea/examples/gaussian_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88

99
class GaussianModel(StatisticalModel):
10-
"""A model of a gaussian measurement, where the model has parameters mu and sigma. For
11-
illustration, we show how required nominal parameters can be added to the init sigma is fixed in
12-
this example.
10+
"""A model of a gaussian measurement, where the model has parameters mu and sigma. illustration,
11+
we show how required nominal parameters can be added to the init sigma is fixed in For this
12+
example.
1313
1414
Args:
1515
parameter_definition (dict or list, optional (default=None)):

alea/model.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ def _generate_data(self, **kwargs):
156156

157157
@_needs_data
158158
def ll(self, **kwargs) -> float:
159-
"""Likelihod function, returns the loglikelihood for the given parameters. The parameters
160-
are passed as keyword arguments, positional arguments are not possible. If a parameter is
159+
"""Likelihod function, returns the loglikelihood for the given parameters. are passed as
160+
keyword arguments, positional arguments are not possible. If a parameter is The parameters
161161
not given, the default value is used.
162162
163163
Keyword Args:
@@ -171,8 +171,8 @@ def ll(self, **kwargs) -> float:
171171
return self._ll(**parameters)
172172

173173
def generate_data(self, **kwargs) -> Union[dict, list]:
174-
"""Generate data for the given parameters. The parameters are passed as keyword arguments,
175-
positional arguments are not possible. If a parameter is not given, the default value is
174+
"""Generate data for the given parameters. positional arguments are not possible. If a
175+
parameter is not given, the default value is The parameters are passed as keyword arguments,
176176
used.
177177
178178
Raises:
@@ -324,8 +324,8 @@ def cost(args):
324324
def fit(
325325
self, verbose: Optional[bool] = False, fit_strategy: Optional[dict] = None, **kwargs
326326
) -> Tuple[dict, float]:
327-
"""Fit the model to the data by maximizing the likelihood. Return a dict containing best-fit
328-
values of each parameter, and the value of the likelihood evaluated there. While the
327+
"""Fit the model to the data by maximizing the likelihood. values of each parameter, and the
328+
value of the likelihood evaluated there. While the Return a dict containing best-fit
329329
optimization is a minimization, the likelihood returned is the __maximum__ of the
330330
likelihood.
331331
@@ -565,9 +565,9 @@ def confidence_interval(
565565
asymptotic_dof: Optional[int] = None,
566566
fit_strategy: Optional[dict] = None,
567567
) -> Tuple[float, float]:
568-
"""Uses self.fit to compute confidence intervals for a certain named parameter. If the
569-
parameter is a rate parameter, and the model has expectation values implemented, the bounds
570-
will be interpreted as bounds on the expectation value, so that the range in the fit is
568+
"""Uses self.fit to compute confidence intervals for a certain named parameter. parameter is
569+
a rate parameter, and the model has expectation values implemented, the bounds If the will
570+
be interpreted as bounds on the expectation value, so that the range in the fit is
571571
parameter_interval_bounds/mus. Otherwise the bound is taken as-is.
572572
573573
Args:
@@ -680,8 +680,8 @@ def get_model_from_name(statistical_model: str):
680680

681681

682682
class MinuitWrap:
683-
"""Wrapper for functions to be called by Minuit. Initialized with a function f and a Parameters
684-
instance.
683+
"""Wrapper for functions to be called by Minuit. instance. Initialized with a function f and a
684+
Parameters.
685685
686686
Attributes:
687687
func: function wrapped

alea/models/blueice_extended_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def data(self) -> Union[dict, list]:
8585

8686
@data.setter
8787
def data(self, data: Union[dict, list]):
88-
"""Overrides default setter. Will also set the data of the blueice ll. Data-sets are
89-
expected to be in the form of a list of one or more structured arrays representing the data-
90-
sets of one or more likelihood terms.
88+
"""Overrides default setter. expected to be in the form of a list of one or more structured
89+
arrays representing the data- Will also set the data of the blueice ll. Data-sets are sets
90+
of one or more likelihood terms.
9191
9292
Args:
9393
data (dict or list): Data of the statistical model.
@@ -127,9 +127,9 @@ def data(self, data: Union[dict, list]):
127127
self.is_data_set = True
128128

129129
def get_source_name_list(self, likelihood_name: str) -> list:
130-
"""Return a list of source names for a given likelihood term. The order is the same as used
131-
in the ``source`` column of the data, so this can be used to map the indices provided in the
132-
data to a source name.
130+
"""Return a list of source names for a given likelihood term. in the ``source`` column of
131+
the data, so this can be used to map the indices provided in the The order is the same as
132+
used data to a source name.
133133
134134
Args:
135135
likelihood_name (str): Name of the likelihood.

alea/parameters.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ def _check_parameter_consistency(self):
205205

206206

207207
class ConditionalParameter:
208-
"""This class is used to define a parameter that depends on another parameter. It has the same
209-
attributes as the Parameter class but each of them can be a dictionary with keys being the
210-
values of the conditioning parameter and values being the corresponding values of the
211-
conditional parameter. Calling the object with the conditioning parameter value as an argument
212-
will return a corresponding Parameter object with the correct values.
208+
"""This class is used to define a parameter that depends on another parameter. attributes as the
209+
Parameter class but each of them can be a dictionary with keys being the It has the same values
210+
of the conditioning parameter and values being the corresponding values of the conditional
211+
parameter. Calling the object with the conditioning parameter value as an argument will return a
212+
corresponding Parameter object with the correct values.
213213
214214
Attributes:
215215
name (str): The name of the parameter.
@@ -389,8 +389,8 @@ def from_config(cls, config: Dict[str, dict]):
389389

390390
@classmethod
391391
def from_list(cls, names: List[str]):
392-
"""Creates a Parameters object from a list of parameter names. Everything else is set to
393-
default values.
392+
"""Creates a Parameters object from a list of parameter names. default values. Everything
393+
else is set to.
394394
395395
Args:
396396
names (List[str]): List of parameter names.

alea/runner.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ def runner_arguments():
239239
def update_poi(
240240
model, poi: str, generate_values: Dict[str, float], nominal_values: Dict[str, float] = {}
241241
):
242-
"""Update the poi according to poi_expectation. First, it will check if poi_expectation is
243-
provided, if not so, it will do nothing. Second, it will check if poi is provided, if so, it
244-
will raise error. Third, it will check if poi ends with _rate_multiplier, if not so, it will
245-
raise error. Finally, it will update poi to the correct value according to poi_expectation
246-
using the get_expectation_values method of model, under specified nominal_values.
242+
"""Update the poi according to poi_expectation. provided, if not so, it will do nothing.
243+
Second, it will check if poi is provided, if so, it First, it will check if poi_expectation
244+
is will raise error. Third, it will check if poi ends with _rate_multiplier, if not so, it
245+
will raise error. Finally, it will update poi to the correct value according to
246+
poi_expectation using the get_expectation_values method of model, under specified
247+
nominal_values.
247248
248249
Args:
249250
poi (str): parameter of interest

alea/submitter.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323

2424
class Submitter:
25-
"""Submitter base class that generate the submission script from the configuration. It is
26-
initialized by the configuration file, and the configuration file should contain the arguments
27-
of __init__ method of the Submitter.
25+
"""Submitter base class that generate the submission script from the configuration. initialized
26+
by the configuration file, and the configuration file should contain the arguments It is of
27+
__init__ method of the Submitter.
2828
2929
Attributes:
3030
statistical_model (str): the name of the statistical model
@@ -323,8 +323,8 @@ def filename_kwargs(self, runner_args: dict) -> dict:
323323
return needed_kwargs
324324

325325
def computation_tickets_generator(self):
326-
"""Get the submission script for the current configuration. It generates the submission
327-
script for each combination of the computation options.
326+
"""Get the submission script for the current configuration. script for each combination of
327+
the computation options. It generates the submission.
328328
329329
For Runner from to_zip, to_vary and in_common:
330330
- First, generate the combined computational options directly.
@@ -390,8 +390,8 @@ def already_done(self, i_args: dict) -> bool:
390390
return is_done
391391

392392
def combined_tickets_generator(self):
393-
"""Get the combined submission script for the current configuration. ``self.combine_n_jobs``
394-
jobs will be combined into one submission script.
393+
"""Get the combined submission script for the current configuration. jobs will be combined
394+
into one submission script. ``self.combine_n_jobs``
395395
396396
Yields:
397397
(str, str): the combined submission script and name output_filename
@@ -454,8 +454,8 @@ def update_runner_args(
454454
parameters_fittable: List[str],
455455
parameters_not_fittable: List[str],
456456
):
457-
"""Update the runner arguments' generate_values and nominal_values. If the argument is
458-
fittable, it will be added to generate_values, otherwise it will be added to nominal_values.
457+
"""Update the runner arguments' generate_values and nominal_values. fittable, it will be
458+
added to generate_values, otherwise it will be added to nominal_values. If the argument is.
459459
460460
Args:
461461
runner_args (dict): the arguments of Runner

alea/submitters/local.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ def submit(
108108
true_name: str = "true",
109109
confidence_levels: List[float] = [0.6827, 0.8, 0.9, 0.95],
110110
):
111-
"""Read the likelihood ratio from the output files and calculate the Neyman threshold. The
111+
"""Read the likelihood ratio from the output files and calculate the Neyman threshold.
112112
threshold will be saved into a json file. The threshold will be sorted based on the elements
113-
of poi.
113+
The of poi.
114114
115115
Args:
116116
free_name: the name of the free hypothesis
@@ -443,10 +443,10 @@ def get_confidence_interval_thresholds(
443443
limit_threshold_interpolation,
444444
asymptotic_dof: Optional[int] = 1,
445445
):
446-
"""Get confidence interval threshold function from limit_threshold file. If the
447-
limit_threshold file does not contain the threshold, it will interpolate the threshold from
448-
the existing threshold, using the RegularGridInterpolator, so in this case the threshold is
449-
not exact.
446+
"""Get confidence interval threshold function from limit_threshold file. limit_threshold
447+
file does not contain the threshold, it will interpolate the threshold from If the the
448+
existing threshold, using the RegularGridInterpolator, so in this case the threshold is not
449+
exact.
450450
451451
Args:
452452
poi (str): parameter of interest

alea/submitters/slurm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222

2323
class SubmitterSlurm(Submitter):
24-
"""Submitter for slurm cluster, using utilix.batchq.submit_job. The default batchq arguments are
25-
defined in BATCHQ_DEFAULT_ARGUMENTS. You can also overwrite them by passing them inside
26-
configuration file.
24+
"""Submitter for slurm cluster, using utilix.batchq.submit_job. defined in
25+
BATCHQ_DEFAULT_ARGUMENTS. You can also overwrite them by passing them inside The default batchq
26+
arguments are configuration file.
2727
2828
Keyword Args:
2929
slurm_configurations (dict): The configurations for utilix.batchq.submit_job.
@@ -83,8 +83,8 @@ def _check_batchq_arguments(self):
8383
)
8484

8585
def submit(self, **kwargs):
86-
"""Submits job to batch queue which actually runs the analysis. Overwrite the
87-
BATCHQ_DEFAULT_ARGUMENTS by configuration file. If debug is True, only submit the first job.
86+
"""Submits job to batch queue which actually runs the analysis. BATCHQ_DEFAULT_ARGUMENTS by
87+
configuration file. If debug is True, only submit the first job. Overwrite the.
8888
8989
Keyword Args:
9090
jobname (str): The name of the job.

alea/template_source.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515

1616
class TemplateSource(HistogramPdfSource):
17-
"""A source defined with a template histogram. The parameters are set in self.config.
18-
"templatename", "histname", "analysis_space" must be in self.config.
17+
"""A source defined with a template histogram. "templatename", "histname", "analysis_space" must
18+
be in self.config. The parameters are set in self.config.
1919
2020
Attributes:
2121
config (dict): The configuration of the source.
@@ -273,8 +273,8 @@ def simulate(self, n_events: int):
273273

274274

275275
class CombinedSource(TemplateSource):
276-
"""Source that is a weighted sums of histograms. Useful e.g. for safeguard. The first histogram
277-
is the base histogram, and the rest are added to it with weights. The weights can be set as
276+
"""Source that is a weighted sums of histograms. is the base histogram, and the rest are added
277+
to it with weights. The weights can be set as Useful e.g. for safeguard. The first histogram
278278
shape parameters in the config.
279279
280280
Args:
@@ -364,8 +364,8 @@ def build_histogram(self):
364364

365365

366366
class SpectrumTemplateSource(TemplateSource):
367-
"""Reweighted template source by 1D spectrum. The first axis of the template is assumed to be
368-
reweighted.
367+
"""Reweighted template source by 1D spectrum. reweighted. The first axis of the template is
368+
assumed to be.
369369
370370
Args:
371371
spectrum_name:

alea/utils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ def clip_limits(value) -> Tuple[float, float]:
456456

457457

458458
def can_assign_to_typing(value_type, target_type) -> bool:
459-
"""Check if value_type can be assigned to target_type. This is useful when converting Runner's
460-
argument into strings.
459+
"""Check if value_type can be assigned to target_type. argument into strings. This is useful
460+
when converting Runner's.
461461
462462
Args:
463463
value_type: type of the value, might be float, int, etc.
@@ -483,8 +483,8 @@ def add_i_batch(filename: str) -> str:
483483

484484

485485
def search_filename_pattern(filename: str) -> str:
486-
"""Return pattern for a given existing filename. This is needed because sometimes the filename
487-
is not appended by "_{i_batch:d}". We need to distinguish between the two cases and return the
486+
"""Return pattern for a given existing filename. is not appended by "_{i_batch:d}". We need to
487+
distinguish between the two cases and return the This is needed because sometimes the filename
488488
correct pattern.
489489
490490
Returns:
@@ -625,8 +625,8 @@ def convert_to_vary(to_vary: Dict[str, List]) -> List[Dict[str, Any]]:
625625

626626

627627
def convert_to_in_common(in_common: Dict[str, Any]) -> Dict[str, Any]:
628-
"""Expand the values in in_common, according to the itertools.product method, if necessary. This
629-
usually happens to the hypotheses.
628+
"""Expand the values in in_common, according to the itertools.product method, if necessary.
629+
usually happens to the hypotheses. This.
630630
631631
Example:
632632
>>> convert_to_in_common({'hypotheses': ['free', {'a': [1, 2], 'b': [3, 4]}]})
@@ -653,9 +653,9 @@ def convert_to_in_common(in_common: Dict[str, Any]) -> Dict[str, Any]:
653653

654654

655655
def compute_variations(to_zip, to_vary, in_common) -> list:
656-
"""Compute variations of Runner from to_zip, to_vary and in_common. By priority, the order is
657-
to_zip, to_vary, in_common. The values in to_zip will overwrite the keys in to_vary and
658-
in_common. The values in to_vary will overwrite the keys in in_common.
656+
"""Compute variations of Runner from to_zip, to_vary and in_common. to_zip, to_vary, in_common.
657+
The values in to_zip will overwrite the keys in to_vary and By priority, the order is in_common.
658+
The values in to_vary will overwrite the keys in in_common.
659659
660660
Args:
661661
to_zip (dict): variations to be zipped
@@ -728,8 +728,8 @@ def signal_multiplier_estimator(
728728
iteration=100,
729729
diagnostic=False,
730730
) -> float:
731-
"""Estimate the best-fit signal multiplier using perturbation theory. The method tries to solve
732-
the critial point of the likelihood function by perturbation theory, where the likelihood
731+
"""Estimate the best-fit signal multiplier using perturbation theory. the critial point of the
732+
likelihood function by perturbation theory, where the likelihood The method tries to solve
733733
function is defined as the binned Poisson likelihood function, given signal, background models
734734
and data.
735735

0 commit comments

Comments
 (0)