code: def add_equad(psr, equad, flagid=None, flags=None, seed=None):
      
  
      if seed is not None:
          N.random.seed(seed)
      
      # default equadvec
      equadvec = N.zeros(psr.nobs)
  
      # check that equad is scalar if flags is None
      if flags is None:
          if not N.isscalar(equad):
              raise ValueError('ERROR: If flags is None, equad must be a scalar') 
          else:
              equadvec = N.ones(psr.nobs) * equad
  
      if flags is not None and flagid is not None and not N.isscalar(equad):
          if len(equad) == len(flags):
              for ct, flag in enumerate(flags):
                  ind = flag == N.array(psr.flagvals(flagid))
                  equadvec[ind] = equad[ct]
      
      psr.stoas[:] += (equadvec / day) * N.random.randn(psr.nobs)
docs: Add quadrature noise of rms `equad` [s].
      Optionally take a pseudorandom-number-generator seed.