<commit_before># -*- coding: utf-8 -*-
# unittest.TestCase base class does not honor the following coding
# convention
# pylint: disable=C0103,R0904
# pylint: enable=W0511,W0142,I0011,E1101,E0611,F0401,E1103,R0801,W0232

# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.

"""
Test classical calculator post processing features
"""

import random
import numpy
import unittest
import itertools
import math
import mock

from tests.utils.helpers import random_location_generator

from openquake.calculators.hazard.classical.post_processing import (
    PostProcessor, PerSiteResultCalculator, PerSiteCurveCalculator,
    MeanCurveCalculator, QuantileCurveCalculator)


class MeanCurveCalculatorTestCase(unittest.TestCase):
    """
    Tests the mean curves calculator.
    """

    MAX_LOCATION_NR = 50
    MAX_CURVES_PER_LOCATION = 10
    MAX_LEVEL_NR = 10
    SIGMA = 0.001

    def setUp(self):
        self.location_nr = random.randint(1, self.__class__.MAX_LOCATION_NR)
        self.curves_per_location = random.randint(
            1,
            self.__class__.MAX_CURVES_PER_LOCATION)
        self.level_nr = random.randint(1, self.__class__.MAX_LEVEL_NR)
        # set level_nr to an odd value, such that we easily create
        # poes curves with median == mean
        if not self.level_nr % 2:
            self.level_nr += 1
        self.curve_db, self.location_db = _curve_db(
            self.location_nr,
            self.level_nr,<commit_msg>we don't need anymore an odd number of levels<commit_after># -*- coding: utf-8 -*-
# unittest.TestCase base class does not honor the following coding
# convention
# pylint: disable=C0103,R0904
# pylint: enable=W0511,W0142,I0011,E1101,E0611,F0401,E1103,R0801,W0232

# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.

"""
Test classical calculator post processing features
"""

import random
import numpy
import unittest
import itertools
import math
import mock

from tests.utils.helpers import random_location_generator

from openquake.calculators.hazard.classical.post_processing import (
    PostProcessor, PerSiteResultCalculator, PerSiteCurveCalculator,
    MeanCurveCalculator, QuantileCurveCalculator)


class MeanCurveCalculatorTestCase(unittest.TestCase):
    """
    Tests the mean curves calculator.
    """

    MAX_LOCATION_NR = 50
    MAX_CURVES_PER_LOCATION = 10
    MAX_LEVEL_NR = 10
    SIGMA = 0.001

    def setUp(self):
        self.location_nr = random.randint(1, self.__class__.MAX_LOCATION_NR)
        self.curves_per_location = random.randint(
            1,
            self.__class__.MAX_CURVES_PER_LOCATION)
        self.level_nr = random.randint(1, self.__class__.MAX_LEVEL_NR)
        self.curve_db, self.location_db = _curve_db(
            self.location_nr,
            self.level_nr,
{'fraction_non_alphanumeric': 0.07333994053518335, 'fraction_numerical': 0.03369672943508424, 'mean_word_length': 3.7271662763466042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6099938', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1183, 'n_words': 393}