use of uk.ac.sussex.gdsc.test.junit5.SeededTest in project GDSC-SMLM by aherbert.
the class FastLogTest method canTestFloatSpeed.
@SpeedTag
@SeededTest
void canTestFloatSpeed(RandomSeed seed) {
// No assertions, this is just a report
Assumptions.assumeTrue(logger.isLoggable(Level.INFO));
Assumptions.assumeTrue(TestSettings.allow(TestComplexity.MEDIUM));
final UniformRandomProvider rng = RngUtils.create(seed.getSeed());
final float[] x = new float[1000000];
for (int i = 0; i < x.length; i++) {
x[i] = nextUniformFloat(rng);
}
final TimingService ts = new TimingService(5);
ts.execute(new FloatTimingTask(new TestLog(new MathLog()), 0, x));
ts.execute(new FloatTimingTask(new TestLog(new FastMathLog()), 0, x));
for (final int q : new int[] { 11 }) {
final int n = 23 - q;
final IcsiFastLog fl = IcsiFastLog.create(n, DataType.FLOAT);
ts.execute(new FloatTimingTask(new TestLog(fl), q, x));
ts.execute(new FloatTimingTask(new TestFastLog(fl), q, x));
final FFastLog ff = new FFastLog(n);
ts.execute(new FloatTimingTask(new TestLog(ff), q, x));
ts.execute(new FloatTimingTask(new TestFastLog(ff), q, x));
final DFastLog df = new DFastLog(n);
ts.execute(new FloatTimingTask(new TestLog(df), q, x));
ts.execute(new FloatTimingTask(new TestFastLog(df), q, x));
final TurboLog tf = new TurboLog(n);
ts.execute(new FloatTimingTask(new TestLog(tf), q, x));
ts.execute(new FloatTimingTask(new TestFastLog(tf), q, x));
// TurboLog2 tf2 = new TurboLog2(n);
// ts.execute(new FloatTimingTask(new TestLog(tf2), q, x));
// ts.execute(new FloatTimingTask(new TestFastLog(tf2), q, x));
// For the same precision we can reduce n
final TurboLog2 tf3 = new TurboLog2(n - 1);
ts.execute(new FloatTimingTask(new TestLog(tf3), q + 1, x));
ts.execute(new FloatTimingTask(new TestFastLog(tf3), q + 1, x));
}
final int size = ts.getSize();
ts.repeat(size);
logger.info(ts.getReport(size));
}
use of uk.ac.sussex.gdsc.test.junit5.SeededTest in project GDSC-SMLM by aherbert.
the class AreaAverageFilterTest method areaAverageUsingSumsInternalCorrectlyInterpolatesBetweenBlocks.
@SeededTest
void areaAverageUsingSumsInternalCorrectlyInterpolatesBetweenBlocks(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final int max = 50;
final float[] data = createData(rg, max, max);
final AreaAverageFilter filter = new AreaAverageFilter();
filter.setSimpleInterpolation(false);
final int n = 30;
final float[][] results = new float[n + 1][];
final double[] w = new double[n + 1];
int count = 0;
for (int i = 0; i <= n; i++) {
w[count] = i / 10.0;
results[count] = data.clone();
filter.areaAverageUsingSumsInternal(results[count], max, max, w[count]);
count++;
}
checkInterpolation(max, n, results, count);
}
use of uk.ac.sussex.gdsc.test.junit5.SeededTest in project GDSC-SMLM by aherbert.
the class AreaAverageFilterTest method areaAverageUsingSumsCorrectlyInterpolatesBetweenBlocks.
@SeededTest
void areaAverageUsingSumsCorrectlyInterpolatesBetweenBlocks(RandomSeed seed) {
final UniformRandomProvider rg = RngUtils.create(seed.getSeed());
final int max = 50;
final float[] data = createData(rg, max, max);
final AreaAverageFilter filter = new AreaAverageFilter();
filter.setSimpleInterpolation(false);
final int n = 30;
final float[][] results = new float[n + 1][];
final double[] w = new double[n + 1];
int count = 0;
for (int i = 0; i <= n; i++) {
w[count] = i / 10.0;
results[count] = data.clone();
filter.areaAverageUsingSums(results[count], max, max, w[count]);
count++;
}
checkInterpolation(max, n, results, count);
}
use of uk.ac.sussex.gdsc.test.junit5.SeededTest in project GDSC-SMLM by aherbert.
the class TraceManagerTest method canTraceSinglePulseWithMovingCoords.
@SeededTest
void canTraceSinglePulseWithMovingCoords(RandomSeed seed) {
final UniformRandomProvider rand = RngUtils.create(seed.getSeed());
final float distance = 0.5f;
final float[] params = createParams(rand);
final Trace trace = new Trace();
for (int i = 0; i < 5; i++) {
move(rand, params, distance);
trace.add(new PeakResult(i, 0, 0, 0, 0, 0, 0, params, null));
}
runTracing(rand, distance, 1, trace);
}
use of uk.ac.sussex.gdsc.test.junit5.SeededTest in project GDSC-SMLM by aherbert.
the class TraceManagerTest method canTraceSinglePulseWithFixedCoords.
@SeededTest
void canTraceSinglePulseWithFixedCoords(RandomSeed seed) {
final UniformRandomProvider rand = RngUtils.create(seed.getSeed());
final float[] params = createParams(rand);
final Trace trace = new Trace();
for (int i = 0; i < 5; i++) {
trace.add(new PeakResult(i, 0, 0, 0, 0, 0, 0, params, null));
}
runTracing(rand, 0, 1, trace);
}
Aggregations