Buggy code:
public void setPhotons ( MemoryPeakResults results ) { } public double getSignal ( ) { } public int getMolecules ( ) { } public double getBackground ( ) { } } static CreateData . BenchmarkParameters benchmarkParameters = null ; static CreateData . SimulationParameters simulationParameters = null ; public void run ( String arg ) { } private void reportAndSaveFittingLimits ( SpatialDistribution dist ) { } private void saveSimulationParameters ( int particles , boolean fullSimulation , double signalPerFrame ) { } public static double getPrecisionN ( double a , double s , double N , double b2 , boolean emCCD ) { } private int checkTotalSteps ( int totalSteps , List < ? extends FluorophoreSequenceModel > fluorophores ) { } private SpatialDistribution createDistribution ( ) { } private SpatialDistribution createMaskDistribution ( ImagePlus imp , double sliceDepth ) { } private int [ ] extractMask ( ImageProcessor ip ) { } private UniformDistribution createUniformDistributionWithPSFWidthBorder ( ) { } private SpatialDistribution createFixedDistribution ( ) { } private double getHWHM ( ) { } private double getPsfSD ( ) { } private double getImageHWHM ( ) { } private UniformDistribution createUniformDistribution ( double border ) { } private SpatialDistribution createConfinementDistribution ( ) { } private SpatialIllumination createIllumination ( double intensity , int pulseInterval ) { } private List < LocalisationModelSet > filterToImageBounds ( List < LocalisationModelSet > localisationSets ) { } private RealDistribution createPhotonDistribution ( ) { } private List < LocalisationModelSet > combineSimulationSteps ( List < LocalisationModel > localisations ) { } private boolean isMoving ( List < LocalisationModel > subset ) { } private double getStartFrame ( LocalisationModel localisationModel , double simulationStepsPerFrame ) { } private double getEndFrame ( LocalisationModel localisationModel , double simulationStepsPerFrame ) { } private LocalisationModel getFraction ( LocalisationModel l , double fraction , int state ) { } private int [ ] getIds ( List < LocalisationModel > localisations ) { } private List < LocalisationModel > drawImage ( final List < LocalisationModelSet > localisationSets ) { } private synchronized void addPhotons ( double p ) { } private ImagePSFModel createImagePSF ( List < LocalisationModelSet > localisationSets ) { } public static float [ ] [ ] extractImageStack ( ImagePlus imp , int start , int end ) { } private PSFModel createPSFModel ( ImagePSFModel imagePSFModel ) { } private synchronized void showProgress ( ) { } private class Spot { final double [ ] psf ; final int x0min ; final int x0max ; final int x1min ; final int x1max ; final int [ ] samplePositions ; public Spot ( double [ ] psf , int x0min , int x0max , int x1min , int x1max , int [ ] samplePositions ) { } } private class ImageGenerator implements Runnable { final List < LocalisationModelSet > localisations ; final List < LocalisationModelSet > newLocalisations ; final int startIndex ; final int t ; final PSFModel psfModel ; final MemoryPeakResults results ; final ImageStack stack ; final boolean poissonNoise ; public ImageGenerator ( final List < LocalisationModelSet > localisationSets , List < LocalisationModelSet > newLocalisations , int startIndex , int t , PSFModel psfModel , MemoryPeakResults results , ImageStack stack , boolean poissonNoise ) { } public void run ( ) { } private void erase ( float [ ] data , CreateData . Spot spot ) { if ( ( spot . samplePositions ) != null ) { <START_BUG> psfModel . eraseSample ( data , settings . size , settings . size ) ; <END_BUG> } else { psfModel . erase ( data , settings . size , settings . size , spot . psf , spot . x0min , spot . x0max , spot . x1min , spot . x1max ) ; } } private double [ ] getStatistics ( float [ ] image1 , float [ ] image2 , int origX , int origY ) { } } private int limit ( int coord ) { } public boolean badLocalisation ( LocalisationModelSet localisationSet , double intensity , double noise ) { } private double getIntensity ( LocalisationModelSet localisationSet ) { } private String createConfiguration ( float psfWidth ) { } private float [ ] backgroundPixels = null ; private boolean uniformBackground = false ; private float [ ] createBackground ( RandomDataGenerator random ) { } private synchronized void createBackgroundPixels ( ) { } private int findIndexByTime ( List < LocalisationModelSet > localisations , int fromIndex , int t ) { } private int findLastIndexByTime ( List < LocalisationModelSet > localisations , int fromIndex , int t ) { } private int findIndexById ( List < LocalisationModel > localisations , int fromIndex , int id ) { } private int findLastIndexById ( List < LocalisationModel > localisations , int fromIndex , int id ) { } private List < LocalisationModel > toLocalisations ( List < LocalisationModelSet > localisationSets ) { } private List < ? extends FluorophoreSequenceModel > removeFilteredFluorophores ( List < ? extends FluorophoreSequenceModel > fluorophores , List < LocalisationModel > localisations ) { } private double showSummary ( List < ? extends FluorophoreSequenceModel > fluorophores , List < LocalisationModel > localisations ) { } private int runDensityCalculation ( ExecutorService threadPool , List < Future < ? > > futures , final ArrayList < float [ ] > coords , final Statistics densityStats , final float radius , final Rectangle bounds , final int [ ] allDensity , final int allIndex ) { } private int currentIndex ; private int finalIndex ; private synchronized void incrementProgress ( ) { } private synchronized void addDensity ( Statistics stats , int [ ] density ) { } private MemoryPeakResults copyMemoryPeakResults ( String nameSuffix ) { } private boolean [ ] getChoosenHistograms ( ) { }

Fix:
psfModel . eraseSample ( data , settings . size , settings . size , spot . samplePositions ) ;