Exemple #1
0
    def setup_method(self, method):
        self.test_dict = {
            'one': {
                'A': np.array([10.])
            },
            'two': {
                'centre':
                np.array([0., 1.]),
                'sigma':
                np.array([
                    -3., 0., 3., 1., 1.5, 2., 3.0, 3.05, 3.1, 3.15, 4., 4., 5.,
                    17., 30.
                ])
            }
        }

        self.test_database = {
            'one': {
                'A': None
            },
            'two': {
                'centre': None,
                'sigma': None
            }
        }

        self.test_database['one']['A'] = np.histogram(
            self.test_dict['one']['A'], 10)
        self.test_database['two']['centre'] = np.histogram(
            self.test_dict['two']['centre'], 10)
        self.test_database['two']['sigma'] = histogram(
            self.test_dict['two']['sigma'], 'blocks')
        self.s = HistogramSegmenter()
Exemple #2
0
    def update(self, value_dict):
        """Recalculates the database, given value dictionary (with all values!)

        Parameters
        ----------
        value_dict : dict
            dictionary of all already calculated values in the form of
            {component_name: {parameter_name: values, ...}, ...}
        """
        # recalculate with values. All values are passed, not just new
        self.database = {}
        for component_name, component in value_dict.items():
            comp_dict = {}
            for par_name, par in component.items():
                if par.size <= self._min_points:
                    comp_dict[par_name] = np.histogram(
                        par, max(10, self._min_points))
                else:
                    comp_dict[par_name] = histogram(par, bins=self.bins)
            self.database[component_name] = comp_dict
    def setUp(self):
        self.test_dict = {'one': {'A': np.array([10.])},
                          'two': {'centre': np.array([0., 1.]),
                                  'sigma': np.array([-3., 0., 3., 1., 1.5, 2.,
                                                     3.0, 3.05, 3.1, 3.15, 4.,
                                                     4., 5., 17., 30.])}
                          }

        self.test_database = {'one': {'A': None},
                              'two': {'centre': None, 'sigma': None}}

        self.test_database['one']['A'] = np.histogram(
            self.test_dict['one']['A'],
            10)
        self.test_database['two']['centre'] = np.histogram(
            self.test_dict['two']['centre'],
            10)
        self.test_database['two']['sigma'] = histogram(
            self.test_dict['two']['sigma'],
            'blocks')
        self.s = HistogramSegmenter()
Exemple #4
0
    def update(self, value_dict):
        """Recalculates the database, given value dictionary (with all values!)

        Parameters
        ----------
        value_dict : dict
            dictionary of all already calculated values in the form of
            {component_name: {parameter_name: values, ...}, ...}
        """
        # recalculate with values. All values are passed, not just new
        self.database = {}
        for component_name, component in value_dict.items():
            comp_dict = {}
            for par_name, par in component.items():
                if par.size <= self._min_points:
                    comp_dict[par_name] = np.histogram(par,
                                                       max(10,
                                                           self._min_points))
                else:
                    comp_dict[par_name] = histogram(par, bins=self.bins)
            self.database[component_name] = comp_dict