alea.submitters package

Submodules

alea.submitters.htcondor module

alea.submitters.local module

class alea.submitters.local.NeymanConstructor(*args, **kwargs)[source]

Bases: SubmitterLocal

Neyman threshold constructor.

Will not really submit a job.

_read_metadata(output_filename_pattern)[source]

Read metadata from the output files.

_read_poi(metadata, **kwargs)[source]

Read poi and poi_expectation from metadata.

Checks that the poi_expectation is consistent with the value derived from the model.

allowed_special_args: List[str] = ['free_name', 'true_name', 'confidence_levels']
static build_interpolator(poi, threshold, generate_values, nominal_values, confidence_level)[source]

Build interpolator from the limit_threshold file.

Parameters
  • poi (str) – parameter of interest

  • generate_values (dict) – generate values assumed to be in the limit_threshold file, but is actually hypothesis. It should not contain poi or poi_expectation.

  • nominal_values (dict) – nominal values of parameters

  • confidence_level (float) – confidence level

  • threshold (dict) – threshold read directly from limit_threshold file

Raises

ValueError – if the limit_threshold file does not contain the thresholds for the generate_values

static get_confidence_interval_thresholds(poi, hypotheses_values, limit_threshold, nominal_values, confidence_interval_kind, confidence_level, limit_threshold_interpolation, asymptotic_dof: Optional[int] = 1)[source]

Get confidence interval threshold functions from a limit_threshold file.

If the threshold for a given hypothesis is not found directly, it will be interpolated from existing thresholds using RegularGridInterpolator, in which case the threshold is approximate.

Parameters
  • poi (str) – parameter of interest

  • hypotheses_values (list) – hypotheses values for statistical model, only contains Dict[str, float]

  • limit_threshold (str) – path to the limit_threshold file

  • nominal_values (dict) – nominal values of parameters

  • confidence_level (float) – confidence level

  • limit_threshold_interpolation (bool) – whether to interpolate the threshold from the existing threshold, if the limit_threshold file does not contain the threshold

  • asymptotic_dof (int, optional (default=1)) – degrees of freedom for asymptotic critical value

submit(free_name: str = 'free', true_name: str = 'true', confidence_levels: List[float] = [0.6827, 0.8, 0.9, 0.95])[source]

Read the likelihood ratio from output files and calculate the Neyman threshold.

The threshold is saved into a json file and sorted based on the elements of poi.

Parameters
  • free_name – the name of the free hypothesis

  • true_name – the name of the true hypothesis

  • confidence_levels – the confidence levels to calculate the threshold 0.6827 = stats.norm.cdf(1) - stats.norm.cdf(-1)

Example

>>> data = json.load(open("limit_threshold.json")); print(json.dumps(data, indent=4))
{
    "oyldh6bczx": {
        "hashed_keys": {
            "poi": "wimp_rate_multiplier",
            "nominal_values": {
                "wimp_mass": 0,
                "livetime": 0.0
            },
            "generate_values": {},
            "confidence_level": 0.9
        },
        "wimp_rate_multiplier": [
            0.0,
            1.0,
            2.0
        ],
        "threshold": [
            0.0,
            0.0,
            0.0
        ],
        "poi_expectation": [
            null,
            null,
            null
        ]
    },
}
class alea.submitters.local.SubmitterLocal(*args, **kwargs)[source]

Bases: Submitter

Submitter for local machine.

__init__(*args, **kwargs)[source]

Initialize the SubmitterLocal class.

static initialized_runner(script: str, pop_limit_threshold: bool = False)[source]

Initialize a Runner from a script.

Parameters
  • script – the script to initialize the Runner

  • pop_limit_threshold – whether to pop the limit_threshold from the statistical_model_args, this is needed for the NeymanConstructor, to initialize runner when the limit_threshold does not exist yet.

submit(*args, **kwargs)[source]

Run job in subprocess locally.

If debug is True, only return the first instance of Runner.

alea.submitters.slurm module

Module contents