/** @class CalcDarkDiff @author Brian Magill @creation date 4/19/2007 $Date:$ $Revision:$ @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief Calculates the dark signal for the difference signal Note: this is a stopgap measure for calculating the dark signal offset of the difference signal. For the moment it uses the index location of the dark signal value for the high signal to determine where this offset is. Eventually a more robust method will be developed. */ #include #include #include #include "CalcDarkDiff.h" #include "ValReversi.hpp" using namespace std; double CalcDarkDiff::operator()(valarray const &strongSig, valarray const &diffSig) const { unsigned long index = 0; unsigned long i; assert(strongSig.size() == diffSig.size()); double strongMin = strongSig.min(); for(i = 0; i < strongSig.size(); i++) { if (strongSig[i] <= strongMin) { index = i; break; } } return diffSig[index]; } double CalcDarkDiff::timeAtMin(valarray const &strongSig, valarray const &time) const { unsigned long index = 0; unsigned long i; assert(strongSig.size() == time.size()); double strongMin = strongSig.min(); for(i = 0; i < strongSig.size(); i++) { if (strongSig[i] <= strongMin) { index = i; break; } } return time[index]; }