/** * {@inheritDoc} * <p> * <strong>Algorithm Description</strong>: * <ul><li> For small means, uses simulation of a Poisson process * using Uniform deviates, as described * <a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"> here.</a> * The Poisson process (and hence value returned) is bounded by 1000 * mean.</li> * * <li> For large means, uses the rejection algorithm described in <br/> * Devroye, Luc. (1981).<i>The Computer Generation of Poisson Random Variables</i> * <strong>Computing</strong> vol. 26 pp. 197-207.</li></ul></p> */ public long nextPoisson(double mean) throws NotStrictlyPositiveException { return delegate.nextPoisson(mean); }
/** * {@inheritDoc} * <p> * <strong>Algorithm Description</strong>: * <ul><li> For small means, uses simulation of a Poisson process * using Uniform deviates, as described * <a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"> here.</a> * The Poisson process (and hence value returned) is bounded by 1000 * mean.</li> * * <li> For large means, uses the rejection algorithm described in <br/> * Devroye, Luc. (1981).<i>The Computer Generation of Poisson Random Variables</i> * <strong>Computing</strong> vol. 26 pp. 197-207.</li></ul></p> */ public long nextPoisson(double mean) throws NotStrictlyPositiveException { return delegate.nextPoisson(mean); }
/** * {@inheritDoc} * <p> * <strong>Algorithm Description</strong>: * <ul><li> For small means, uses simulation of a Poisson process * using Uniform deviates, as described * <a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"> here.</a> * The Poisson process (and hence value returned) is bounded by 1000 * mean.</li> * * <li> For large means, uses the rejection algorithm described in <br/> * Devroye, Luc. (1981).<i>The Computer Generation of Poisson Random Variables</i> * <strong>Computing</strong> vol. 26 pp. 197-207.</li></ul></p> */ public long nextPoisson(double mean) throws NotStrictlyPositiveException { return delegate.nextPoisson(mean); }
/** * Generate an integer from the Poisson distribution, with the specified mean * * @param meanCount * the mean * @param ensureAtLeastOne * whether to "scale" the distribution to the right in order to ensure that a zero return is impossible * @return the randomly generated value */ protected final int generatePoissonInt(double mean, boolean ensureAtLeastOne) { int scaleFactor = ensureAtLeastOne ? 1 : 0; long count = randomGenerator.nextPoisson(mean); if (count >= Integer.MAX_VALUE - 1) { // this will occur like 1 in a trillion times, given meanCounts less than 10 or so (typical values)...but still... count = 0; } return (int) (count + scaleFactor); }
public long generateTime() { TimeUnit tu = SimulationUtils.getTimeUnit(data); long mean = (long)SimulationUtils.asDouble(data.get(SimulationConstants.MEAN)); mean = timeUnit.convert(mean, tu); if(mean > 0) { return (long) generator.nextPoisson(mean); } else { return 0; } }
public long generateTime() { TimeUnit tu = SimulationUtils.getTimeUnit(data); long mean = (long)SimulationUtils.asDouble(data.get(SimulationConstants.MEAN)); mean = timeUnit.convert(mean, tu); if(mean > 0) { return (long) generator.nextPoisson(mean); } else { return 0; } }
public FloatProcessor generatePoissonNoise(int width, int height, double stddev_photons) { FloatProcessor img = new FloatProcessor(width, height); for(int x = 0; x < width; x++) for(int y = 0; y < height; y++) img.setf(x, y, (float)(rand.nextPoisson(stddev_photons))) ; return img; }
/** * Replaces each pixel value with a sample from a poisson distribution with mean value equal to the pixel original value. */ FloatProcessor samplePoisson(FloatProcessor fp){ for(int i = 0; i < fp.getPixelCount(); i ++){ float mean = fp.getf(i); double value = mean > 0 ? (rand.nextPoisson(mean)) : 0; fp.setf(i, (float)value); } return fp; }
long repeats = rand.nextPoisson(sampleRatio); if (rescaled && repeats > 0) { repeats *= rand.nextPoisson(1.0 / sampleRatio);
for(int y = 0; y < mask.getHeight(); y++) { int nMols = p_px > 0 ? (int) rand.nextPoisson(p_px) : 0; //actual number of molecules inside a pixel for(int i = 0; i < nMols; i++) { double z = getNextUniform(zFrom, zTo);