Search in sources :

Example 81 with UniformRandomProvider

use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.

the class PeakResultDigestTest method sameResultsAreEqualWithDeviation.

@SeededTest
void sameResultsAreEqualWithDeviation(RandomSeed seed) {
    final UniformRandomProvider r = RngUtils.create(seed.getSeed());
    final PeakResult[] r1 = createResults(r, 10, 5, true, false, false, false);
    final PeakResultsDigest digest = new PeakResultsDigest(r1);
    Assertions.assertTrue(digest.matches(r1));
    Assertions.assertTrue(digest.matches(digest));
}
Also used : UniformRandomProvider(org.apache.commons.rng.UniformRandomProvider) SeededTest(uk.ac.sussex.gdsc.test.junit5.SeededTest)

Example 82 with UniformRandomProvider

use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.

the class PeakResultDigestTest method differentResultsAreNotEqual.

@SeededTest
void differentResultsAreNotEqual(RandomSeed seed) {
    final UniformRandomProvider r = RngUtils.create(seed.getSeed());
    final PeakResult[] r1 = createResults(r, 10, 5, false, false, false, false);
    final PeakResultsDigest digest = new PeakResultsDigest(r1);
    for (final int size : new int[] { 10, 1, 0 }) {
        final PeakResult[] r2 = createResults(r, size, 5, false, false, false, false);
        Assertions.assertFalse(digest.matches(r2));
        Assertions.assertFalse(digest.matches(new PeakResultsDigest(r2)));
    }
}
Also used : UniformRandomProvider(org.apache.commons.rng.UniformRandomProvider) SeededTest(uk.ac.sussex.gdsc.test.junit5.SeededTest)

Example 83 with UniformRandomProvider

use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.

the class PeakResultDigestTest method sameEmptyResultsAreEqual.

@SeededTest
void sameEmptyResultsAreEqual(RandomSeed seed) {
    final UniformRandomProvider r = RngUtils.create(seed.getSeed());
    final PeakResult[] r1 = createResults(r, 0, 5, false, false, false, false);
    final PeakResultsDigest digest = new PeakResultsDigest(r1);
    Assertions.assertTrue(digest.matches(r1));
    Assertions.assertTrue(digest.matches(digest));
}
Also used : UniformRandomProvider(org.apache.commons.rng.UniformRandomProvider) SeededTest(uk.ac.sussex.gdsc.test.junit5.SeededTest)

Example 84 with UniformRandomProvider

use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.

the class PeakResultDigestTest method sameResultsAreEqualWithId.

@SeededTest
void sameResultsAreEqualWithId(RandomSeed seed) {
    final UniformRandomProvider r = RngUtils.create(seed.getSeed());
    final PeakResult[] r1 = createResults(r, 10, 5, false, true, false, false);
    final PeakResultsDigest digest = new PeakResultsDigest(r1);
    Assertions.assertTrue(digest.matches(r1));
    Assertions.assertTrue(digest.matches(digest));
}
Also used : UniformRandomProvider(org.apache.commons.rng.UniformRandomProvider) SeededTest(uk.ac.sussex.gdsc.test.junit5.SeededTest)

Example 85 with UniformRandomProvider

use of org.apache.commons.rng.UniformRandomProvider in project GDSC-SMLM by aherbert.

the class PeakResultDigestTest method digestMatchesPeakResultDigest.

@SeededTest
void digestMatchesPeakResultDigest(RandomSeed seed) {
    final UniformRandomProvider r = RngUtils.create(seed.getSeed());
    for (int size = 1; size < 5; size++) {
        final PeakResult[] r1 = createResults(r, size, 5, false, false, false, false);
        final PeakResultsDigest digest = new PeakResultsDigest(r1);
        final PeakResultDigest d = new PeakResultDigest();
        for (final PeakResult rr : r1) {
            d.update(rr);
        }
        Assertions.assertEquals(d.digest(), digest.getDigest());
    }
}
Also used : UniformRandomProvider(org.apache.commons.rng.UniformRandomProvider) SeededTest(uk.ac.sussex.gdsc.test.junit5.SeededTest)

Aggregations

UniformRandomProvider (org.apache.commons.rng.UniformRandomProvider)213 SeededTest (uk.ac.sussex.gdsc.test.junit5.SeededTest)145 SharedStateContinuousSampler (org.apache.commons.rng.sampling.distribution.SharedStateContinuousSampler)17 TimingService (uk.ac.sussex.gdsc.test.utils.TimingService)14 Rectangle (java.awt.Rectangle)13 DoubleDoubleBiPredicate (uk.ac.sussex.gdsc.test.api.function.DoubleDoubleBiPredicate)13 SpeedTag (uk.ac.sussex.gdsc.test.junit5.SpeedTag)12 TDoubleArrayList (gnu.trove.list.array.TDoubleArrayList)10 ArrayList (java.util.ArrayList)10 NormalizedGaussianSampler (org.apache.commons.rng.sampling.distribution.NormalizedGaussianSampler)9 StoredDataStatistics (uk.ac.sussex.gdsc.core.utils.StoredDataStatistics)8 CalibrationWriter (uk.ac.sussex.gdsc.smlm.data.config.CalibrationWriter)8 ContinuousSampler (org.apache.commons.rng.sampling.distribution.ContinuousSampler)6 ImageExtractor (uk.ac.sussex.gdsc.core.utils.ImageExtractor)6 LocalList (uk.ac.sussex.gdsc.core.utils.LocalList)6 Gaussian2DFunction (uk.ac.sussex.gdsc.smlm.function.gaussian.Gaussian2DFunction)6 FloatProcessor (ij.process.FloatProcessor)5 ErfGaussian2DFunction (uk.ac.sussex.gdsc.smlm.function.gaussian.erf.ErfGaussian2DFunction)5 TimingResult (uk.ac.sussex.gdsc.test.utils.TimingResult)5 File (java.io.File)4