Package gov.nist.microanalysis.Utility

Examples of gov.nist.microanalysis.Utility.Histogram


public class BSERadialDistributionListenerTest {

    @Test
    public void testRadialDistributionListenerEqualRadii() {
        BSERadialDistributionListener listener;
        Histogram h;

        listener = new BSERadialDistributionListener(Math2.ORIGIN_3D,
                Math2.Z_AXIS, 100.0, 10, false);
        h = listener.getDistribution();
        assertEquals(10, h.binCount());
        assertEquals(0.0, h.minValue(0), 1e-4);
        assertEquals(10.0, h.maxValue(0), 1e-4);
        assertEquals(10.0, h.minValue(1), 1e-4);
        assertEquals(20.0, h.maxValue(1), 1e-4);

        listener =
                new BSERadialDistributionListener(Math2.ORIGIN_3D,
                        Math2.Z_AXIS, 100.0, 10, true);
        h = listener.getDistribution();
        assertEquals(10, h.binCount());
        assertEquals(0.0, h.minValue(0), 1e-4);
        assertEquals(31.62278, h.maxValue(0), 1e-4);
        assertEquals(31.62278, h.minValue(1), 1e-4);
        assertEquals(44.72136, h.maxValue(1), 1e-4);
        assertEquals(Math.pow(h.maxValue(0), 2) - Math.pow(h.minValue(0), 2),
                Math.pow(h.maxValue(1), 2) - Math.pow(h.minValue(1), 2), 1e-4);
    }
View Full Code Here


        super(center, normal);

        double[] binMins =
                RadialDistributionUtil.calculateBinMins(rmax, nBins, equalArea);
        try {
            distribution = new Histogram(binMins, rmax);
        } catch (EPQException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

     * Return the radial distribution.
     *
     * @return radial distribution
     */
    public Histogram getDistribution() {
        return new Histogram(distribution);
    }
View Full Code Here

        super.saveResults(root, key);
       
        HDF5Group group = root.requireSubgroup(key);
       
        // Create array
        Histogram hist = radialDist.getDistribution();
        double[][] data = new double[channels][2];
       
        for (int i = 0; i < channels; i++) {
            data[i][0] = (hist.minValue(i) + hist.maxValue(i)) / 2.0;
            data[i][1] = hist.counts(i);
        }
       
        // Save dataset
        group.createDataset("data", data);
    }
View Full Code Here

TOP

Related Classes of gov.nist.microanalysis.Utility.Histogram

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.