Search in sources :

Example 1 with PoissonGaussianFisherInformation

use of uk.ac.sussex.gdsc.smlm.function.PoissonGaussianFisherInformation in project GDSC-SMLM by aherbert.

the class CameraModelFisherInformationAnalysis method createPoissonGaussianFisherInformation.

private static PoissonGaussianFisherInformation createPoissonGaussianFisherInformation(double sd) {
    if (sd < 0) {
        IJ.error(TITLE, "CCD noise must be positive");
        return null;
    }
    final int sampling = PoissonGaussianFisherInformation.DEFAULT_SAMPLING;
    // sampling <<= 2;
    final PoissonGaussianFisherInformation fi = new PoissonGaussianFisherInformation(sd, sampling);
    // fi.setCumulativeProbability(1 - 1e-12);
    // fi.setMinRange(5);
    fi.setMeanThreshold(1000);
    return fi;
}
Also used : PoissonGaussianFisherInformation(uk.ac.sussex.gdsc.smlm.function.PoissonGaussianFisherInformation)

Example 2 with PoissonGaussianFisherInformation

use of uk.ac.sussex.gdsc.smlm.function.PoissonGaussianFisherInformation in project GDSC-SMLM by aherbert.

the class CreateData method createLikelihoodFunction.

/**
 * Creates the likelihood function. This is used for CRLB computation.
 */
private void createLikelihoodFunction() {
    final CameraType cameraType = settings.getCameraType();
    final boolean isCcd = CalibrationProtosHelper.isCcdCameraType(cameraType);
    fiFunction = new BasePoissonFisherInformation[settings.getSize() * settings.getSize()];
    if (isCcd) {
        BasePoissonFisherInformation fi;
        final CreateDataSettingsHelper helper = new CreateDataSettingsHelper(settings);
        final double readNoise = helper.getReadNoiseInCounts();
        if (cameraType == CameraType.EMCCD) {
            // We only want the amplification (without QE applied)
            final double amp = helper.getAmplification();
            // This should be interpolated from a stored curve
            final InterpolatedPoissonFisherInformation i = CameraModelFisherInformationAnalysis.loadFunction(CameraModelFisherInformationAnalysis.CameraType.EM_CCD, amp, readNoise);
            if (i == null) {
                throw new IllegalStateException("No stored Fisher information for EM-CCD camera with gain " + amp + " and noise " + readNoise + "\n \nPlease generate using the " + CameraModelFisherInformationAnalysis.TITLE);
            }
            fi = i;
        } else {
            // This is fast enough to compute dynamically.
            // Read noise is in electrons so use directly.
            fi = new PoissonGaussianFisherInformation(settings.getReadNoise());
        }
        Arrays.fill(fiFunction, fi);
    } else if (cameraType == CameraType.SCMOS) {
        // Build per-pixel likelihood function.
        // Get the normalised variance per pixel.
        final float[] v = cameraModel.getNormalisedVariance(cameraModel.getBounds());
        // Build the function
        for (int i = 0; i < fiFunction.length; i++) {
            fiFunction[i] = new PoissonGaussianFisherInformation(Math.sqrt(v[i]));
        }
    } else {
        throw new IllegalArgumentException("Unsupported camera type: " + CalibrationProtosHelper.getName(cameraType));
    }
}
Also used : CreateDataSettingsHelper(uk.ac.sussex.gdsc.smlm.ij.settings.CreateDataSettingsHelper) BasePoissonFisherInformation(uk.ac.sussex.gdsc.smlm.function.BasePoissonFisherInformation) PoissonGaussianFisherInformation(uk.ac.sussex.gdsc.smlm.function.PoissonGaussianFisherInformation) CameraType(uk.ac.sussex.gdsc.smlm.data.config.CalibrationProtos.CameraType) InterpolatedPoissonFisherInformation(uk.ac.sussex.gdsc.smlm.function.InterpolatedPoissonFisherInformation)

Aggregations

PoissonGaussianFisherInformation (uk.ac.sussex.gdsc.smlm.function.PoissonGaussianFisherInformation)2 CameraType (uk.ac.sussex.gdsc.smlm.data.config.CalibrationProtos.CameraType)1 BasePoissonFisherInformation (uk.ac.sussex.gdsc.smlm.function.BasePoissonFisherInformation)1 InterpolatedPoissonFisherInformation (uk.ac.sussex.gdsc.smlm.function.InterpolatedPoissonFisherInformation)1 CreateDataSettingsHelper (uk.ac.sussex.gdsc.smlm.ij.settings.CreateDataSettingsHelper)1