Examples of HDF5Group


Examples of pymontecarlo.util.hdf5.HDF5Group



    @Test
    public void testSaveResults() throws Exception {
        HDF5Group root = HDF5Group.createRoot();
        det.saveResults(root, "det1");
        HDF5FileWriter.write(root, resultsFile, true);
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        super.saveResults(root, key);

        HDF5Group group = root.requireSubgroup(key);

        long elapsedTime = System.currentTimeMillis() - startSimulationTime;
        group.setAttribute("simulation_time_s", elapsedTime / 1000.0);

        double mean = sum / count;
        double std = Math.sqrt(sumSquare / count - Math.pow(mean, 2.0));
        group.setAttribute("simulation_speed_s", mean / 1000.0, std / 1000.0);
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group



    @Test
    public void testSaveResults() throws Exception {
        HDF5Group root = HDF5Group.createRoot();
        det.saveResults(root, "det1");
        HDF5FileWriter.write(root, resultsFile, true);
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        super.saveResults(root, key);

        HDF5Group group = root.requireSubgroup(key);

        String transitionName;
        double[][][] gnf, gt, enf, et;
        HDF5Group transitionGroup;
        for (XRayTransition trans : mapTotal.getTransitions()) {
            if (!trans.isWellKnown())
                continue;

            transitionName = trans.getIUPACName();
            transitionGroup = group.createSubgroup(transitionName);

            gnf = mapCharac.getGeneratedDistribution(trans).getArray();
            gt = mapTotal.getGeneratedDistribution(trans).getArray();
            enf = mapCharac.getEmittedDistribution(trans).getArray();
            et = mapTotal.getGeneratedDistribution(trans).getArray();

            transitionGroup.createDataset("gnf", gnf);
            transitionGroup.createDataset("gt", gt);
            transitionGroup.createDataset("enf", enf);
            transitionGroup.createDataset("et", et);
        }
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        super.saveResults(root, key);

        HDF5Group group = root.requireSubgroup(key);

        String transitionName;
        double[][] gnf, enf;
        HDF5Group transitionGroup;
        for (XRayTransition trans : transitions) {
            transitionName = trans.getIUPACName();
            transitionGroup = group.createSubgroup(transitionName);

            gnf = new double[2][channels];
            enf = new double[2][channels];

            gnf[0] = zPZS.get(trans);
            gnf[1] = gnfPZs.get(trans);

            enf[0] = zPZS.get(trans);
            enf[1] = enfPZs.get(trans);

            transitionGroup.createDataset("gnf", transpose(gnf));
            transitionGroup.createDataset("enf", transpose(enf));
        }
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

            detector.run();
        }

        // Save results
        report(1.0, "Saving results");
        HDF5Group rootGroup =
                createHDF5Group(props, detectors, rootElement, name);
        File resultsH5 = new File(resultsDir, name + ".h5");
        HDF5FileWriter.write(rootGroup, resultsH5, true);
        report(1.0, "Complete");
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group


    private HDF5Group createHDF5Group(SpectrumProperties props,
            Map<String, Detector> detectors,
            Element rootElement, String name) throws IOException {
        HDF5Group rootGroup = HDF5Group.createRoot();

        // Save version, class
        rootGroup.setAttribute("version", VERSION);
        rootGroup.setAttribute("_class", "Results");

        // Create results group
        String identifier = rootElement.getAttributeValue("uuid");
        rootGroup.setAttribute("identifiers", new String[] { identifier });

        HDF5Group resultsGroup =
                rootGroup.createSubgroup("result-" + identifier);

        // Save results from detectors
        String key;
        Detector detector;
        for (Entry<String, Detector> entry : detectors.entrySet()) {
            key = entry.getKey();
            detector = entry.getValue();
            detector.saveResults(resultsGroup, key);
        }

        // Save overall log
        Properties logProps = new Properties();
        logProps.putAll(props.getPropertyMap());
        createLog(logProps);
        resultsGroup.setAttribute("log", props.toString());

        // Save options
        XMLOutputter outputter = new XMLOutputter(Format.getCompactFormat());
        String optionsStr = outputter.outputString(rootElement);
        resultsGroup.setAttribute("options", optionsStr);
        rootGroup.setAttribute("options", optionsStr);

        return rootGroup;
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        super.saveResults(root, key);

        HDF5Group group = root.requireSubgroup(key);

        String transitionName;
        double[][] gnf, gt, enf, et;
        HDF5Group transitionGroup;
        for (XRayTransition trans : radialTotal.getTransitions()) {
            if (!trans.isWellKnown())
                continue;

            transitionName = trans.getIUPACName();
            transitionGroup = group.createSubgroup(transitionName);

            gnf = radialCharac.getGeneratedDistribution(trans).getArray();
            gt = radialTotal.getGeneratedDistribution(trans).getArray();
            enf = radialCharac.getEmittedDistribution(trans).getArray();
            et = radialTotal.getEmittedDistribution(trans).getArray();

            transitionGroup.createDataset("gnf", gnf);
            transitionGroup.createDataset("gt", gt);
            transitionGroup.createDataset("enf", enf);
            transitionGroup.createDataset("et", et);
        }
    }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        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

Examples of pymontecarlo.util.hdf5.HDF5Group



    @Override
    public void saveResults(HDF5Group root, String key) throws IOException {
        HDF5Group group = root.requireSubgroup(key);

        // Set Python class
        group.setAttribute("_class", getPythonResultClass());

        // Save log
        Properties props = new Properties();
        createLog(props);
        group.setAttribute("log", props.toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.