def model_mag(self, pardict, use_cache=True):
if pardict == self._cache_key and use_cache:<EOL><INDENT>return self._cache_val<EOL><DEDENT>self._cache_key = pardict<EOL>p = []<EOL>for l in self.leaf_labels:<EOL><INDENT>p.extend(pardict[l])<EOL><DEDENT>assert len(p) == self.n_params<EOL>tot = np.inf<EOL>for i,m in enumerate(self.leaves):<EOL><INDENT>mag = m.evaluate(p[i*<NUM_LIT:5>:(i+<NUM_LIT:1>)*<NUM_LIT:5>], self.band)<EOL>tot = addmags(tot, mag)<EOL><DEDENT>self._cache_val = tot<EOL>return tot<EOL>
pardict is a dictionary of parameters for all leaves
gets converted back to traditional parameter vector