def randomize_parameters(self, ptp=<NUM_LIT>, fourier=False, vmin=None, vmax=None):
if vmin is not None and vmax is not None:<EOL><INDENT>ptp = vmax - vmin<EOL><DEDENT>elif vmax is not None and vmin is None:<EOL><INDENT>vmin = vmax - ptp<EOL><DEDENT>elif vmin is not None and vmax is None:<EOL><INDENT>vmax = vmin + ptp<EOL><DEDENT>else:<EOL><INDENT>vmax = <NUM_LIT:1.0><EOL>vmin = vmax - ptp<EOL><DEDENT>self.set_values(self.category+'<STR_LIT>', <NUM_LIT:1.0>)<EOL>self.set_values(self.category+'<STR_LIT>', <NUM_LIT:0.0>)<EOL>for k, v in iteritems(self.poly_params):<EOL><INDENT>norm = (self.zorder + <NUM_LIT:1.0>)*<NUM_LIT:2><EOL>self.set_values(k, ptp*(np.random.rand() - <NUM_LIT:0.5>) / norm)<EOL><DEDENT>for i, p in enumerate(self.barnes_params):<EOL><INDENT>N = len(p)<EOL>if fourier:<EOL><INDENT>t = ((np.random.rand(N)-<NUM_LIT:0.5>) + <NUM_LIT>*(np.random.rand(N)-<NUM_LIT:0.5>))/(np.arange(N)+<NUM_LIT:1>)<EOL>q = np.real(np.fft.ifftn(t)) / (i+<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>t = ptp*np.sqrt(N)*(np.random.rand(N)-<NUM_LIT:0.5>)<EOL>q = np.cumsum(t) / (i+<NUM_LIT:1>)<EOL><DEDENT>q = ptp * q / q.ptp() / len(self.barnes_params)<EOL>q -= q.mean()<EOL>self.set_values(p, q)<EOL><DEDENT>self._norm_stat = [ptp, vmin]<EOL>if self.shape:<EOL><INDENT>self.initialize()<EOL><DEDENT>if self._parent:<EOL><INDENT>param = self.category+'<STR_LIT>'<EOL>self.trigger_update(param, self.get_values(param))<EOL><DEDENT>
Create random parameters for this ILM that mimic experiments
as closely as possible without real assumptions.