Examples of HDF5Group


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

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;
        HDF5Dataset ds;
        int[][] emptyData = new int[][] { { 0 } };
        for (XRayTransition transition : transitions) {
            transitionName = transition.getIUPACName();

            ds = group.createDataset(transitionName, emptyData);

            ds.setAttribute("gnf", gnfIntensities.get(transition), 0.0);
            ds.setAttribute("enf", enfIntensities.get(transition), 0.0);
            ds.setAttribute("et", etIntensities.get(transition), 0.0);
        }
View Full Code Here

Examples of pymontecarlo.util.hdf5.HDF5Group

            mcss.runTrajectory();
        }

        // Save results
        report(1.0, "Saving results");
        HDF5Group rootGroup =
                createHDF5Group(mcss, 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(MonteCarloSS mcss,
            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 props = new Properties();
        createLog(props, mcss);
        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



    @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



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

Examples of pymontecarlo.util.hdf5.HDF5Group

        double[][] spectrumTotal =
                arrayFromSpectrum(detectorTotal.getSpectrum(1.0));
        double[][] spectrumBackground =
                arrayFromSpectrum(detectorBackground.getSpectrum(1.0));

        HDF5Group group = root.requireSubgroup(key);

        group.createDataset("total", spectrumTotal);
        group.createDataset("background", spectrumBackground);
    }
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 : przCharac.getTransitions()) {
            if (!trans.isWellKnown())
                continue;

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

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

            gnf[0] = zs;
            gnf[1] = przCharac.getGenerated(trans);

            gt[0] = zs;
            gt[1] = gnf[1].clone();

            enf[0] = zs;
            enf[1] = przCharac.getEmitted(trans);

            et[0] = zs;
            et[1] = enf[1].clone();

            transitionGroup.createDataset("gnf", transpose(gnf));
            transitionGroup.createDataset("gt", transpose(gt));
            transitionGroup.createDataset("enf", transpose(enf));
            transitionGroup.createDataset("et", transpose(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);

        Trajectory trajectory;
        String name;
        double[][] data;
        int interactionsSize;
        Double[] interaction;
        HDF5Dataset dataset;
        for (int i = 0; i < trajectories.size(); i++) {
            trajectory = trajectories.get(i);

            name = "trajectory" + i;

            interactionsSize = trajectory.interactions.size();
            data = new double[interactionsSize][6];
            for (int j = 0; j < interactionsSize; j++) {
                interaction = trajectory.interactions.get(j);
                data[j][0] = interaction[0];
                data[j][1] = interaction[1];
                data[j][2] = interaction[2];
                data[j][3] = interaction[3];
                data[j][4] = interaction[4];
                data[j][5] = interaction[5];
            }

            dataset = group.createDataset(name, data);

            dataset.setAttribute("primary", trajectory.primary ? 1 : 0);
            dataset.setAttribute("particle", 1); // Electron
            dataset.setAttribute("collision", trajectory.collision);
            dataset.setAttribute("exit_state", trajectory.exitState);
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
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.