Commit 8beff364 authored by Andrea Orlati's avatar Andrea Orlati
Browse files

fix issue #688: the keywords related to radial velocity were not properly...

fix issue #688: the keywords related to radial velocity were not properly reported in the fits file because the scheduler
parser ignored the source RVEL switch so the default values were. Now it's fixed. Also added a debug mode in 'scheduleChecker'
so that it will be easier to track down these errors.
parent 57bca55a
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ public:
			return false;
		}
	};

	static const char *map(const TVradDefinition& frame) {
		if (frame==Antenna::ANT_RADIO) {
			return "RD";
@@ -169,9 +168,23 @@ public:
			return "NULL";
		}
	};
	static const char *map(const TGeneratorType& gen) {
		if (gen==Antenna::ANT_SIDEREAL) {
			return "SIDEREAL";
		}
		else if (gen==Antenna::ANT_MOON) {
			return "MOON";
		}
		else if (gen==Antenna::ANT_OTF) {
			return "OTF";
		}
		else { // All other cases.....should be completed when further generators are supported.
			return "UNKNOWN";
		}
	};

};
};


#endif /* ANTENNAMODULE_H_ */
+56 −11
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public:
			const Antenna::TCoordinateFrame& subScanFrame,const Antenna::TsubScanDescription& description,
			const Antenna::TsubScanDirection& direction,const ACS::TimeInterval& subScanDuration);

	void OTFC(const Antenna::TCoordinateFrame& coordFrame,const Antenna::TsubScanGeometry& geometry,
	void otfc(const Antenna::TCoordinateFrame& coordFrame,const Antenna::TsubScanGeometry& geometry,
		const Antenna::TCoordinateFrame& subScanFrame,const Antenna::TsubScanDirection& direction,
		const double& span,const ACS::TimeInterval& subScanDuration,const Antenna::TTrackingParameters * const sec);

@@ -468,6 +468,12 @@ public:
	 */ 
	virtual bool getScan(const DWORD& id,TRecord& rec);
	
	/**
	* It outputs to standard out the definitions of the requested subscan
	* @param id id identifier of the subscan
	*/
	virtual bool printScan(const DWORD& id);
	
	/**
	 * Checks the existence of a scan by its identifier
	 * @param id identifier of the scan we are checking
@@ -494,7 +500,7 @@ private:
	void resetTrackingParameters(Antenna::TTrackingParameters *scan);
	 
	/**
	 * parse the list of parameters of an OTF.
	 * parse the list of parameters of an OTFC scan.
	 * @param val line to parse
	 * @param scan structure containing the OTF parameters
	 * @param id numeral identifier of the scan
@@ -504,15 +510,14 @@ private:
	bool parseOTF(const IRA::CString& val,Antenna::TTrackingParameters *scan,DWORD& id,IRA::CString& errMsg);

	/**
	 * parse the list of parameters of an OTFC scan.
	 * parse the list of parameters of an OTF.
	 * @param val line to parse
	 * @param scan structure containing the OTF parameters
	 * @param scanSec structure containing the parameters of the secondary scan which is the scan used to compute the center of the scan
	 * @param id numeral identifier of the scan
	 * @param errMsg error specification string in case of unsuccessful operation
	 * @pram binder binder (to subscan description structure) object
	 * @return the result of the parse
	 */
	bool parseOTFC(const IRA::CString& val,Antenna::TTrackingParameters *scan,Antenna::TTrackingParameters *secScan,DWORD& id,IRA::CString& errMsg);
	bool parseOTFC(const IRA::CString& val,DWORD& id,IRA::CString& errMsg,CSubScanBinder& binder);

	/**
	 * parse the list of parameters of a SKYDIP scan.
@@ -528,12 +533,12 @@ private:
	/**
	 * Parse the list of parameters of sidereal tracking.
	 * @param val line to parse
	 * @param otf structure containing the ORF parameters
	 * @param id numeral identifier of the scan
	 * @param errMsg error specification string in case of unsuccessful operation
	 * @pram binder binder (to subscan description structure) object
	 * @return the result of the parse
	 */
	bool parseSidereal(const IRA::CString& val,Antenna::TTrackingParameters *scan,DWORD& id,IRA::CString& errMsg);
	//bool parseSidereal(const IRA::CString& val,Antenna::TTrackingParameters *scan,DWORD& id,IRA::CString& errMsg);
	
	bool parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& errMsg,CSubScanBinder& binder);

@@ -559,6 +564,36 @@ private:
	 */
	bool parseVRADSwitch(const IRA::CString& val,int& start,double& vrad,Antenna::TReferenceFrame& frame,Antenna::TVradDefinition& ref,IRA::CString& errMsg);

	 /**
	 * Parse the input string looking for a vRAD switch in order to configure a radial velocity
	 * @param val line to parse
	 * @param start point inside the line where to start parsing
	 * @param vrad output radial velocity
	 * @param frame output radial velocity frame
	 * @param ref radial velocity definition
	 * @param result true if the offset switch has been identified 
	 * @errMsg error message in case of errors
	 * @return the result of the parsing
	 */
	bool parseVRADSwitch(const IRA::CString& val,int& start,double& vrad,Antenna::TReferenceFrame& frame,
	  Antenna::TVradDefinition& ref,bool& result,IRA::CString& errMsg);

	/**
	 * Parse teh input string looking for the OFF switches in order to configure a subscan offset
	 * @param val line to parse
	 * @param start point inside the line where to start parsing
	 * @param sw token containing the specific OFF token.
	 * @param offsetFrame frame of the offset
	 * @param lonoff longitude offset in radians
	 * @param latoff latitude offset in radians
	 * @param result true if the offset switch has been identified 
	 * @errMsg error message in case of errors
	 * @return the result of the parsing is correct or not
	 */
	bool parseOffsetSwitch(const IRA::CString& val,int& start,Antenna::TCoordinateFrame& offsetFrame,
	  double& lonoff,double& latoff,bool& result,IRA::CString& errMsg);


	/**
	 * This method is called by the parser in order to read the scan list of a main schedule
	 * @param line input line to be parsed
@@ -721,6 +756,11 @@ public:
	 */
	bool getSubScan(const DWORD& counter,TRecord& rec);
	
	/** 
	 * Print all significant information from a schedule
	*/
	bool printAll();	
	
	/**
	 * Can be called to know the subscan counter given the scanid and the subscanid.
	 * @param scanid identifier of the scan
@@ -931,6 +971,11 @@ private:
	 * @return false if the line contains parsing errors
	 */
	virtual bool parseScans(const IRA::CString& line,const DWORD& lnNumber,IRA::CString& errorMsg);
	/**
	 * Prints the subscan
	 * @param rec subscan record to be printed
	 */	
	bool printSubScan(const TRecord& rec);

};

+25 −0
Original line number Diff line number Diff line
@@ -626,6 +626,31 @@ bool CSchedule::getSubScan(const DWORD& counter,TRecord& rec)
	}
}

bool CSchedule::printAll() {
	TIterator p;
	for (p=m_schedule.begin();p<m_schedule.end();p++) {
		if (!printSubScan(*(*p))) {
			return false;
		}
	}
	return true;
}

bool CSchedule::printSubScan(const TRecord& rec) {
	cout << "subscan: " << rec.scanid << "_" << rec.subscanid;	
	cout << " duration: " << rec.duration;
	cout << " suffix: " << rec.suffix;		
	cout << " pre: " << rec.preScan << "(" << rec.preScanArgs << ")";
	cout << " post: " << rec.postScan << "(" << rec.postScanArgs << ")";
	cout << " bck: " << rec.backendProc << " writer : " << rec.writerInstance;
	cout << endl;
	if (!m_scanListUnit->printScan(rec.scan)) {
		return false;
	}
	cout << endl;
	return true;
}

DWORD CSchedule::getSubScanCounter(const DWORD& scanid,const DWORD& subscanid)
{
	TIterator p;
+13 −4
Original line number Diff line number Diff line
@@ -18,11 +18,13 @@ void printMessage(const char *msg)
void printHelp() {
	printMessage("Check the correctness of a schedule\n");
	printMessage("\n");
	printMessage("ScheduleChecker [-h] [-b] scheduleFile \n");
	printMessage("ScheduleChecker [-h] [-b] [-d] scheduleFile \n");
	printMessage("\n");
	printMessage("-h	Shows this help\n");
	printMessage("-b	Selects the batch mode, no output message are shown. In that case the program will exit with 0\n");
	printMessage("    if the schedule is correct, with -1 if not \n");
	printMessage("-d  Sets the debug mode, the subscans parameters and configuration from the schedule are printed out \n");
	printMessage("    '-b' overloads this argument");	
	printMessage("\n");
}

@@ -32,12 +34,13 @@ int main(int argc, char *argv[])
	char scheduleFile[256];
	char dir[256];
	char name[256];
	bool debugmode=false;
	if (argc==1) {
		printMessage("Arguments are missing....\n\n");
		printHelp();
		exit(-1);
	}
	while ((out=getopt(argc,argv,"vb"))!=-1) {
	while ((out=getopt(argc,argv,"vbd"))!=-1) {
		switch (out) {
			case 'h' : {
				printHelp();
@@ -47,6 +50,10 @@ int main(int argc, char *argv[])
				g_batch=true;
				break;
			}
			case 'd': {
				debugmode=true;
				break;
			}
			default: {
				printMessage("Invalid argument....\n\n");
				printHelp();
@@ -54,6 +61,7 @@ int main(int argc, char *argv[])
			}
		}
	}
	if (g_batch) debugmode=false;
	strcpy(scheduleFile,argv[optind]);
	if (strlen(scheduleFile)==0) {
		printMessage("A schedule file must be provided....\n\n");
@@ -73,9 +81,10 @@ int main(int argc, char *argv[])
	}
	if (sched.isComplete()) {
		CString msg;
		msg.Format("%u subscans were succesfully parsed!\n",sched.getSubScansNumber());
		msg.Format("%u subscans were successfully parsed!\n",sched.getSubScansNumber());
		printMessage((const char *)msg);
		printMessage("Schedule is correct\n");
		if (debugmode) sched.printAll();
		return 0;
	}
	else {
+238 −191

File changed.

Preview size limit exceeded, changes collapsed.

Loading