class_docstr: nobs iid compound poisson distributions, not a process in time
      
class_docstr_tok: ["nobs","iid","compound","poisson","distributions",",","not","a","process","in","time"]
code: def simulate(self, nobs, nrepl=1):
      nobj = self.nobj
      x = np.zeros((nrepl, nobs, nobj))
      N = np.random.poisson(
          self.lambd[None, None, :], size=(nrepl, nobs, nobj)
      )
      for io in range(nobj):
          randfnc = self.randfn[io]
  
          nc = N[:, :, io]
          # print nrepl,nobs,nc
          # xio = randfnc(size=(nrepl,nobs,np.max(nc))).cumsum(-1)[np.arange(nrepl)[:,None],np.arange(nobs),nc-1]
          rvs = randfnc(size=(nrepl, nobs, np.max(nc)))
          print("rvs.sum()", rvs.sum(), rvs.shape)
          xio = rvs.cumsum(-1)[
              np.arange(nrepl)[:, None], np.arange(nobs), nc - 1
          ]
          # print xio.shape
          x[:, :, io] = xio
      x[N == 0] = 0
      return x, N
  
imports: import numpy
  from scipy import stats, signal
  import matplotlib.pyplot
label_desc: Use image node_id 2 for calling the CompoundPoisson obj's underlying member method code with example usage: obj.simulate(nobs, nrepl) and returns: x,  N