Package gov.nist.microanalysis.EPQLibrary.MassAbsorptionCoefficient

Examples of gov.nist.microanalysis.EPQLibrary.MassAbsorptionCoefficient.UserSpecifiedCoefficient


            MassAbsorptionCoefficient baseMAC =
                    (MassAbsorptionCoefficient) baseStrategy
                            .getAlgorithm(MassAbsorptionCoefficient.class);

            // Read MAC values
            UserSpecifiedCoefficient mac =
                    new UserSpecifiedCoefficient(baseMAC);

            gov.nist.microanalysis.EPQLibrary.Element absorber;
            double energy, macValue;
            int z, src, dest;
            XRayTransition transition;
            for (Element subelement : modelElement.getChildren("mac")) {
                try {
                    absorber =
                            gov.nist.microanalysis.EPQLibrary.Element
                                    .byAtomicNumber(subelement.getAttribute(
                                            "absorber").getIntValue());
                } catch (DataConversionException e) {
                    throw new IOException(e);
                }

                if (subelement.getAttribute("energy") != null) {
                    try {
                        energy =
                                subelement.getAttribute("energy")
                                        .getDoubleValue();
                    } catch (DataConversionException e) {
                        throw new IOException(e);
                    }

                } else {
                    try {
                        z = subelement.getAttribute("z").getIntValue();
                        src = subelement.getAttribute("src").getIntValue() - 1;
                        dest =
                                subelement.getAttribute("dest").getIntValue() - 1;
                    } catch (DataConversionException e) {
                        throw new IOException(e);
                    }

                    transition =
                            new XRayTransition(
                                    gov.nist.microanalysis.EPQLibrary.Element
                                            .byAtomicNumber(z),
                                    src, dest);

                    try {
                        energy = transition.getEnergy_eV();
                    } catch (EPQException e) {
                        throw new IOException(e);
                    }
                }

                macValue = Double.parseDouble(subelement.getText());

                mac.put(absorber, ToSI.eV(energy), macValue);
            }

            Strategy st = new Strategy();
            st.addAlgorithm(MassAbsorptionCoefficient.class, mac);
            return st;
View Full Code Here

TOP

Related Classes of gov.nist.microanalysis.EPQLibrary.MassAbsorptionCoefficient.UserSpecifiedCoefficient

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.