Here you can find the source of SumDiffErr(float Term1Err, float Term2Err)
Parameter | Description |
---|---|
Term1Err | Error estimate for the Term1 |
Term2Err | Error estimate for the Term2 |
public static float SumDiffErr(float Term1Err, float Term2Err)
//package com.java2s; /*/*from w w w . j av a 2 s.c om*/ * File: SAS_Util.java * * Copyright (C) 2004, Ruth Mikkelson, Alok Chatterjee and Dennis Mikkelson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Contact : Ruth Mikkelson <mikkelsonr@uwstout.edu> * Department of Mathematics, Statistics and Computer Science * University of Wisconsin-Stout * Menomonie, WI 54751, USA * * This work was supported by the Intense Pulsed Neutron Source Division * of Argonne National Laboratory, Argonne, IL 60439-4845, USA. * * For further information, see <http://www.pns.anl.gov/ISAW/> * * Modified: * * $Log$ * Revision 1.15 2007/07/06 21:34:07 dennis * Changed methods SumQs_1D(), SumQs_2D() adn CalcRatios() to take * the upstream monitor index as a parameter, instead of an array * of indices, since only one monitor is used. * * Revision 1.14 2006/07/11 21:20:17 dennis * Fixed xDELTAQ problem in second location. * * Revision 1.13 2006/07/11 19:57:06 dennis * Fixed typo that used xDELTAQ, where yDELTAQ should have been * used. This would create problems, if the "Q" step size * in the x direction was different than the "Q" step size in * the y direction. * * Revision 1.12 2005/05/27 03:15:12 dennis * Changed to use get attribute method from AttrUtil, rather than * the old get attribute method from DataSet and Data * * Revision 1.11 2005/05/26 15:51:17 dennis * Fixed one javadoc comment and changed Data.SMOOTH_LINEAR to * IData.SOOTH_LINEAR to access the field directly. * * Revision 1.10 2005/05/13 00:43:04 dennis * Added new versions of methods SumQs_1D() and SumQs_2D() that accept * a list of boolean flags indicating whether or not a particular channel * should be used. The new version of SumQs_2D() is essentially the same as * the previous version, except for the extra parameter. The new version * of SumQs_1D() is quite different from the previous version. The previous * version converted the spectra to Q before summing. This version processes * each bin individually, like the 2D version, to allow omitting individual * bins in a logical way. * * Revision 1.9 2005/05/11 22:54:39 dennis * Completed javadocs. * Added some additional internal documentation. * * Revision 1.8 2005/03/30 01:46:54 dennis * Removed unneeded semicolon. * * Revision 1.7 2004/08/02 21:13:42 rmikk * Removed unused imports * * Revision 1.6 2004/07/26 14:58:06 rmikk * Fixed the ConvertToWL to fix the data set operators to correspond * to those from wave length * * Revision 1.5 2004/04/28 18:58:21 dennis * Now only print debug information in CalcRatios() method for the * first group, and only if debugging is turned on. * Turned off debugging. * * Revision 1.4 2004/04/27 21:50:13 dennis * Added InterpolateDataSet() to interpolate and extend * a DataSet over a new xscale. If the new xscale covers a * larger range than the current xscale, the first (or last) * y-value will be used for x's beyond the current xscale. * Added some debug prints. * * Revision 1.3 2004/04/27 15:23:23 dennis * Added RemoveAreaDetectorData() method for use by Reduce_LPSD. * * Revision 1.2 2004/04/26 18:54:16 dennis * Added method Build2D_Difference_DS() that subtracts the sample * and background S(Qx,Qy) faster than the general DataSet subtract * operator. This works, assuming each operand has exactly the same * detector grid. (This cut execution time for batch_reduce from * 37 seconds to 15 seconds in the 2D case, on a 2.8 Ghz P4). * Removed two unused parameters from Build2D_DS(). * * Revision 1.1 2004/04/26 13:56:54 dennis * Extracted and restructured calculations from Reduce_KCL. * Changed SumQs_1D() and SumQs_2D() methods to step through all * groups in a DataSet and coordinate groups with other DataSets * based on Group_ID, so these no longer require an area detector. * Extracted calculation of 2D Q region to cover from SumQs_2D() * and put it in GetQRegion(). * Improved efficiency of ConvertXsToWL(). * Added method, FixGroupIDs(), to get groupIDs for sensitivity * data set from the area detector grid, if using area detector. * (The legacy sensitivity file format did not include enough * information.) * Added method, BuildIndexOFID_Table(), to allow efficient access * to Data blocks based on group ID. (Needed, since SumQs*() now * are based on group ID, not area detector row, col.) * * */ public class Main { /** * Calculate the error in a sum or difference, based on the * error in the two terms * @param Term1Err Error estimate for the Term1 * @param Term2Err Error estimate for the Term2 * * @return the square root of the sum of the squares of the errors in * term1 and term2. */ public static float SumDiffErr(float Term1Err, float Term2Err) { return (float) Math.sqrt(Term1Err * Term1Err + Term2Err * Term2Err); } }