def makeRateParams(self, bprobs): params = [] for param_name in self.parameter_order: if bprobs is None or param_name not in self.partitioned_params: defn = ParamDefn(param_name) else: e_defn = ParamDefn(param_name, dimensions=['edge', 'locus']) # should be weighted by bprobs*rates not bprobs b_defn = self._makeBinParamDefn(param_name, param_name + '_factor', bprobs) defn = ProductDefn(b_defn, e_defn, name=param_name + '_BE') params.append(defn) return params
def _makeBinParamDefn(self, edge_par_name, bin_par_name, bprob_defn): # if no ordered param defined, behaves as old, everything indexed by and edge if edge_par_name not in self.partitioned_params: return ParamDefn(dimensions=['bin'], name=bin_par_name) if edge_par_name == self.ordered_param: whole = self.distrib_class(bprob_defn, bin_par_name) else: # this forces them to average to one, but no forced order # this means you can't force a param value to be shared across bins # so 1st above approach has to be used whole = WeightedPartitionDefn(bprob_defn, bin_par_name + '_partn') whole.bin_names = bprob_defn.bin_names return SelectForDimension(whole, 'bin', name=bin_par_name)