#ifndef SUNSENSORRECORD_H_ #define SUNSENSORRECORD_H_ /** @file SunSensorRecord.h @brief Header file for the SunSensorRecord Class, which contains the data for 1 Sun Sensor reading @class SunSensorRecord @brief SunSensorRecord contains one record of the SOFIE Sun Sensor data @author John Burton @date Thu Apr 20 09:17:10 2006 @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. */ // //----------------------------------------------------------------------- // Include Files: //----------------------------------------------------------------------- // #include "SunSensorRegion.h" #include "EventVar.h" // //----------------------------------------------------------------------- // Type Definitions: //----------------------------------------------------------------------- // enum RecordType { BADDATA = 0, PIXELS = 1, SUMS = 2 }; static int ALL_SUMS_LEN = 31; static int CTR_SUMS_LEN = 7; // //----------------------------------------------------------------------- // Class Definitions: //----------------------------------------------------------------------- // class SunSensorRecord { // //----------------------------------------------------------------------- // Private Members: //----------------------------------------------------------------------- // private: void init(); RecordType type_; int status_; int event_number_; double track_timestamp_; double pixel_timestamp_; double corr_lo_X_; double corr_hi_X_; double corr_lo_Y_; double corr_hi_Y_; double solar_hi_el_; double solar_lo_el_; double solar_hi_az_; double solar_lo_az_; double solar_extent_; double detector_lockdown_az_; double detector_lockdown_el_; SunSensorRegion *lowX_; SunSensorRegion *highX_; SunSensorRegion *lowY_; SunSensorRegion *highY_; SunSensorRegion *center_; EventVar *sums_; EventVar *locs_; EventVar *center_sums_; EventVar *center_sums_rows_; EventVar *center_sums_X_; EventVar *center_sums_el_; EventVar *center_sums_rel_el_; EventVar *center_ave_pix_vals_; EventVar *ave_pix_vals_; void writeFlatFieldData(std::ofstream& outfile, int event_n); // void calcROI(double ctr, int len, int inc_2, int &lo, int &hi, int &inc); // //----------------------------------------------------------------------- // Public Members: //----------------------------------------------------------------------- // public: /// /// Default constructor /// SunSensorRecord(); /// /// Constructs a SunSensorRecord object with tracking data initialized /// @param[in] tts - tracking timestamp /// @param[in] lox - Low X tracking data /// @param[in] hix - High X tracking data /// @param[in] loy - Low Y tracking data /// @param[in] hiy - High Y tracking data /// SunSensorRecord(double tts, double lox, double hix, double loy, double hiy); /// /// Constructs a SunSensorRecord object with tracking and pixel data initialized /// @param[in] tts - tracking timestamp /// @param[in] lox - Low X tracking data /// @param[in] hix - High X tracking data /// @param[in] loy - Low Y tracking data /// @param[in] hiy - High Y tracking data /// @param[in] pts - pixel timestamp /// @param[in] pixs - EventVar with pixel / sum data /// SunSensorRecord(double tts, double lox, double hix, double loy, double hiy, double pts, EventVar &sums); /// /// Constructs a SunSensorRecord object with tracking and pixel data initialized /// @param[in] tts - tracking timestamp /// @param[in] lox - Low X tracking data /// @param[in] hix - High X tracking data /// @param[in] loy - Low Y tracking data /// @param[in] hiy - High Y tracking data /// @param[in] pts - pixel timestamp /// @param[in] pixs - EventVar with pixel / sum data /// @param[in] status - Status value returned from the tracking subsystem /// SunSensorRecord(double tts, double lox, double hix, double loy, double hiy, double pts, EventVar &sums, int status); /// /// Default destructor /// virtual ~SunSensorRecord(); /// /// Detects the type of sun sensor data for this record and sets the type_ /// property accordingly. /// int detectType(); /// /// Sets the tracking timestamp property of the SunSensorRecord object /// @param[in] tts - tracking timestamp /// void setTrackTimeStamp(double tts) { track_timestamp_ = tts; } /// /// Sets the Pixel Timestamp property of the SunSensorRecord object /// @param[in] pts - pixel timestamp value /// void setPixelTimeStamp(double pts) { pixel_timestamp_ = pts; } /// /// Sets the tracking system status property of the SunSensorRecord object /// @param[in] retval - tracking system status word value // void setStatusWord(int status) { status_ = status; } /// /// Sets the pixels property of the SunSensorRecord object /// @param[in] pixs - Integer EventVar containing Pixels / sums values /// void setSums(EventVar &sums); /// /// Returns the tracking timestamp property of the SunSensorRecord object /// @retval double - tracking timestamp /// double getTrackTimeStamp() { return track_timestamp_; } /// /// Returns the tracking Low X location property of the SunSensorRecord object /// @retval double - tracking Low X location /// double getTrackLoX() { return corr_lo_X_; } /// /// Returns the tracking High X location property of the SunSensorRecord object /// @retval double - tracking High X location /// double getTrackHiX() { return corr_hi_X_; } /// /// Returns the tracking Low Y location property of the SunSensorRecord object /// @retval double - tracking Low Y location /// double getTrackLoY() { return corr_lo_Y_; } /// /// Returns the tracking High Ylocation property of the SunSensorRecord object /// @retval double - tracking High Y location /// double getTrackHiY() { return corr_hi_Y_; } /// /// Returns the status property of the SunSensorRecord object /// @retval retval - tracking system status value /// int getStatusWord() { return status_; } /// /// Returns the status property of the SunSensorRecord object /// @retval retval - tracking system status value /// int getRecordType() { return type_; } /// /// Returns the tracking Low X location property of the SunSensorRecord object /// @retval double - tracking Low X location /// double getSolarLoEl() { return solar_lo_el_; } /// /// Returns the tracking High X location property of the SunSensorRecord object /// @retval double - tracking High X location /// double getSolarHiEl() { return solar_hi_el_; } /// /// Returns the tracking Low Y location property of the SunSensorRecord object /// @retval double - tracking Low Y location /// double getSolarLoAz() { return solar_lo_az_; } /// /// Returns the Solar High Azimuth Edge location property of the SunSensorRecord object /// @retval double - Solar High Azimuth location /// double getSolarHiAz() { return solar_hi_az_; } /// /// Returns the Solar Extent, measured from solar_hi_el_ to solar_lo_el_ in units of arcmins /// @retval double - Solar High Azimuth location /// double getSolarExtent() { return solar_extent_; } /// /// Returns the Science Detector Azimuth Offset from the Solar High Elevation Edge azimuth /// location /// @retval double - Science Detector Azimuth offset location /// double getDetectorAz() { return detector_lockdown_az_; } /// /// Returns the Science Detector Elevation Offset from the Solar High Elevation Edge elevation /// location /// @retval double - Science Detector Elevation offset location /// double getDetectorEl() { return detector_lockdown_el_; } /// /// Returns the pixel timestamp property of the SunSensorRecord object /// @retval double - pixel timestamp /// double getPixelTimeStamp() { return pixel_timestamp_; } /// /// Returns the pixels property of the SunSensorRecord object /// @param[out] pixs - Integer EventVar containing pixel / sum data /// void getSums(EventVar &sums); void getAvePixVals(EventVar &ave); void getCenterAvePixVals(EventVar &ave); /// /// Returns the center_sums property of the SunSensorRecord object /// @param[out] sums - Integer EventVar containing pixel / sum data /// void getCenterSums(EventVar &sums); /// /// Returns the Center Sums Elevation Offset property of the SunSensorRecord object /// @param[out] pixs - Integer EventVar containing pixel / sum data /// void getCenterSumsElevationOffsets(EventVar &offsets) {offsets.copy(*center_sums_rel_el_);} /// /// Returns the Center Sums Elevation Offset property of the SunSensorRecord object /// @param[out] pixs - Integer EventVar containing pixel / sum data /// void getCenterSumsX(EventVar &offsets) {offsets.copy(*center_sums_X_);} /// /// Returns the Center Sums Rows property of the SunSensorRecord object /// @param[out] pixs - Integer EventVar containing pixel / sum data /// void getCenterSumsRows(EventVar &offsets) {offsets.copy(*center_sums_rows_);} /// /// Returns the Center Sums Rows property of the SunSensorRecord object /// @param[out] pixs - Integer EventVar containing pixel / sum data /// void getAverageLocations(EventVar &offsets) {offsets.copy(*locs_);} /// /// Performs the Flat Field correction on the sum data . /// If the first value of "SolarImages" is 0xFEED, it is considered packed /// pixel data and written to the file specified by the \c outfile parameter /// @param[in] rel_resp - Relative pixel response. /// @param[in] outfile - Output file for pixel (not sum) data /// @param[in] en - Event Number written with each record of the output file /// void doFlatField(EventVar &rel_resp, std::ofstream& outfile, int en); /// /// Corrects the values of the average pixel intensities due to different integration times /// relative to the center sums integration time /// void doIntegrationTimeCorrection(int en); /// /// Corrects the locations of the 4 "edges" of the solar image based on the /// "sums" values. /// void correctEdgeLocations(); /// /// Determines the location (in FPA coordinates) of the 7 Center Sums /// void determineCenterSumsLocation(); /// /// Transforms locations from the FPA pixel coordinate system to elevation / azimuth /// coordinates in units of arcmins. /// void transformCoordinateSystem(EventVar &xmap, EventVar &ymap); /// /// Determines the location of the various science detectors relative to the top /// edge of the solar image on the FPA (in arcmins) /// void determineDetectorLockDownPosition(double det_az, double det_el); /// /// Determines the location of the 7 center sums relative to the top edge of the solar /// image on the FPA (in arcmins) /// void determineCenterSumsElevation(double det_el); /// /// Determines the extent of the solar image on the FPA (in arcmins) /// void determineSolarExtent(); /// /// Performs the Pixel Spacing correction on the tracking data . /// @param[in] rel_space - Relative pixel spacing. /// void doPixelSpacing(EventVar &rel_space); /// /// Clears & initializes the SunSensorRecord object . /// void clear(); void correctNonLinearity(EventVar &Intensity, EventVar &Counts); }; // end class SunSensorRecord #endif