/** * Tests whether phase shifts are correctly implemented. */ @Test public void testPhaseShift() { SineIntensity si = (SineIntensity) IntensityFunctions.sineIntensity() .phaseShift(0).build(); nonZeroCheck(Range.closed(0d, 1d), si, Range.open(0d, .5)); si = (SineIntensity) IntensityFunctions.sineIntensity().phaseShift(.5) .build(); nonZeroCheck(Range.closed(0d, 1d), si, Range.open(.25, .75)); // check default assertEquals(IntensityFunctions.sineIntensity().build(), si); si = (SineIntensity) IntensityFunctions.sineIntensity().phaseShift(1) .build(); nonZeroCheck(Range.closed(0d, 1d), si, Range.open(.5, 1d)); si = (SineIntensity) IntensityFunctions.sineIntensity().phaseShift(1.5) .build(); nonZeroCheck(Range.closed(0d, 1d), si, Range.closedOpen(0d, .25), Range.openClosed(.75, 1d)); si = (SineIntensity) IntensityFunctions.sineIntensity().phaseShift(2) .build(); nonZeroCheck(Range.closed(0d, 1d), si, Range.open(0d, .5)); }
/** * @return The test configs. */ @Parameters public static Collection<Object[]> data() { return Arrays .asList(new Object[][] { {IntensityFunctions.sineIntensity().area(10).period(20).build()}, {IntensityFunctions.sineIntensity().area(10).height(.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(-.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).phaseShift(0) .period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(1).period(20) .build()} }); }
/** * @return Test configs */ @Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {TimeSeries.homogenousPoisson(60d, 10)}, {TimeSeries.homogenousPoisson(60d, 100)}, {TimeSeries.homogenousPoisson(180d, 10)}, {TimeSeries.homogenousPoisson(180d, 100)}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).phaseShift(2).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(300d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(600d, IntensityFunctions .sineIntensity() .period(600).area(200).height(1).build())} }); }