// // $Id$ //----------------------------------------------------------------------- // // (c) 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. // //----------------------------------------------------------------------- // // Module: FPACorrection.cpp // // Author: John Burton // // Date: Thu May 4 17:01:31 2006 // //----------------------------------------------------------------------- // // Modification History: // // $Log$ // //----------------------------------------------------------------------- // //----------------------------------------------------------------------- // Include Files: //----------------------------------------------------------------------- // #include "ConfigFile.h" #include "EventVar.h" #include "FPACorrection.h" #include "Level0Profiles.h" #include "SunSensorEvent.h" #include "Level1Profiles.h" //#include "lmFPAMinimize.h" #include // //----------------------------------------------------------------------- // Defines and Macros: //----------------------------------------------------------------------- // // //----------------------------------------------------------------------- // Global Variables: //----------------------------------------------------------------------- // // //----------------------------------------------------------------------- // Utility Routines: //----------------------------------------------------------------------- // using namespace std; int FPACorrection_Testing(Event& L0, Event& L1, Event& Tmp, Event& SD, ConfigFile& cf) { int retCode = 0; // lmFPAInitialize(L0,L1,Tmp,SD,cf); // lmFPAMinimize(L0,L1,Tmp,SD,cf); return retCode; } int FPACorrection_Production(Event& L0, Event& L1, Event& Tmp, Event& SD, ConfigFile& cf) { string Section = "FPACorrection"; string strMsg; int retCode = 0; try { Level0Profiles l0p(L0,L1,cf,Section); L1.addLogEntry(" FPACorrection::Level0Profiles::ConvertFixed2FloatingPoint"); l0p.convertFixed2FloatingPoint(); L1.addLogEntry(" FPACorrection::Level0Profiles::SelectFineTrackData"); l0p.selectFineTrackData(); l0p.correctTimeStamp(); // L1.addLogEntry(" FPACorrection::Level0Profiles::FilterSumsData"); // l0p.filterSumsData(); // l0p.doChainSawFilter(); // l0p.alignTrackingData2TimeGrid(); // L1.addLogEntry(" FPACorrection::Level0Profiles::alignSumsData2TimeGrid"); // l0p.alignSumsData2TimeGrid(); SunSensorEvent sse(l0p); L1.addLogEntry(" FPACorrection::SunSensorEvent::doFlatFieldCorrections"); sse.doFlatFieldCorrections(SD); if(cf.GetFlag(Section,"doNonLinearityCorrection")) { L1.addLogEntry(" FPACorrection::SunSensorEvent::doFlatFieldCorrections"); sse.doNonLinearityCorrections(SD); } L1.addLogEntry(" FPACorrection::SunSensorEvent::doIntegrationTimeCorrection"); sse.doIntegrationTimeCorrection(); L1.addLogEntry(" FPACorrection::SunSensorEvent::determineLocations"); sse.determineLocations(); //exit(23); if(cf.GetFlag(Section,"plotAzCenter")) { L1.addLogEntry(" FPACorrection::SunSensorEvent::pltAzCenter"); sse.plotAzCenter(); } Level1Profiles l1p(sse,L1); l1p.doChainSawFilter(); l1p.ChainSawFilterAvePixVect(); l1p.adjustPixelIntensities(); l1p.transformCoordinates(SD); l1p.determineDetectorLockDownPosition(); l1p.determineCenterSumsElevation(); l1p.determineSolarExtent(); l1p.correctCenterSumsLocations(); l1p.copyDataToEvent(Tmp); l1p.adjustToScienceTimeStamp(L1); l1p.copyDataToEvent(L1); if(cf.GetFlag(Section,"WriteFPACorrectionData")) l1p.dumpData(std::string("FPACorrection"),1); // l1p.selectSumsData(std::string("selectSums"),30.0,80.0); } catch (exception &ex) { strMsg = string("Error Occurred in ") + Section + string(" : ") + ex.what(); L1.addLogEntry(strMsg); cerr << strMsg << endl; retCode = -100; } return retCode; } int FPACorrection(Event& L0, Event& L1, Event& Tmp, Event& SD, ConfigFile& cf) { if(cf.GetFlag("FPACorrection","UseTestDriver")) return FPACorrection_Testing(L0,L1,Tmp,SD,cf); else return FPACorrection_Production(L0,L1,Tmp,SD,cf); }