Changeset 2251
- Timestamp:
- 07/28/11 12:55:49 (13 years ago)
- Location:
- trunk/external-alma/asdm2ASAP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/asdm2ASAP/ASDMReader.cc
r2250 r2251 1141 1141 vector< vector<float> > ASDMReader::getTsys( unsigned int idx ) 1142 1142 { 1143 unsigned int index = dataIdList_[idx] ;1144 Tag anttag( antennaId_, TagType::Antenna ) ;1145 int feedid = vmsData_->v_feedId1[index] ;1146 //ArrayTimeInterval tint( vmsData_->v_time[index]*s2d, vmsData_->v_interval[index]*s2d ) ;1147 double startSec = vmsData_->v_time[index] - 0.5 * vmsData_->v_interval[index] ;1148 ArrayTimeInterval tint( startSec*s2d, vmsData_->v_interval[index]*s2d ) ;1149 Tag ddtag( vmsData_->v_dataDescId[index], TagType::DataDescription ) ;1150 Tag spwtag = asdm_->getDataDescription().getRowByKey(ddtag)->getSpectralWindowId() ;1151 //int nchan = asdm_->getSpectralWindow().getRowByKey(spwtag)->getNumChan() ;1152 1143 vector< vector<float> > defaultTsys( 1, vector<float>( 1, 1.0 ) ) ; 1153 SysCalTable &sctab = asdm_->getSysCal() ; 1154 if ( sctab.size() == 0 ) 1155 return defaultTsys ; 1156 SysCalRow *scrow = sctab.getRowByKey( anttag, spwtag, tint, feedid ) ; 1144 SysCalRow *scrow = getSysCalRow( idx ) ; 1157 1145 if ( scrow != 0 && scrow->isTsysSpectrumExists() ) { 1158 1146 vector< vector<Temperature> > tsysSpec = scrow->getTsysSpectrum() ; … … 1182 1170 vector< vector<float> > ASDMReader::getTcal( unsigned int idx ) 1183 1171 { 1184 unsigned int index = dataIdList_[idx] ;1185 Tag anttag( antennaId_, TagType::Antenna ) ;1186 int feedid = vmsData_->v_feedId1[index] ;1187 //ArrayTimeInterval tint( vmsData_->v_time[index]*s2d, vmsData_->v_interval[index]*s2d ) ;1188 double startSec = vmsData_->v_time[index] - 0.5 * vmsData_->v_interval[index] ;1189 ArrayTimeInterval tint( startSec*s2d, vmsData_->v_interval[index]*s2d ) ;1190 Tag ddtag( vmsData_->v_dataDescId[index], TagType::DataDescription ) ;1191 Tag spwtag = asdm_->getDataDescription().getRowByKey(ddtag)->getSpectralWindowId() ;1192 //int nchan = asdm_->getSpectralWindow().getRowByKey(spwtag)->getNumChan() ;1193 1172 vector< vector<float> > defaultTcal( 1, vector<float>( 1, 1.0 ) ) ; 1194 SysCalTable &sctab = asdm_->getSysCal() ; 1195 if ( sctab.size() == 0 ) 1196 return defaultTcal ; 1197 SysCalRow *scrow = sctab.getRowByKey( anttag, spwtag, tint, feedid ) ; 1173 SysCalRow *scrow = getSysCalRow( idx ) ; 1198 1174 if ( scrow != 0 && scrow->isTcalSpectrumExists() ) { 1199 1175 vector< vector<Temperature> > tcalSpec = scrow->getTcalSpectrum() ; … … 1220 1196 } 1221 1197 } 1198 1199 void ASDMReader::getTcalAndTsys( unsigned int idx, 1200 vector< vector<float> > &tcal, 1201 vector< vector<float> > &tsys ) 1202 { 1203 String funcName = "getTcalAndTsys" ; 1204 1205 vector< vector<float> > defaultT( 1, vector<float>( 1, 1.0 ) ) ; 1206 SysCalRow *scrow = getSysCalRow( idx ) ; 1207 if ( scrow == 0 ) { 1208 tcal = defaultT ; 1209 tsys = defaultT ; 1210 } 1211 else { 1212 if ( scrow->isTsysSpectrumExists() ) { 1213 vector< vector<Temperature> > tsysSpec = scrow->getTsysSpectrum() ; 1214 unsigned int numReceptor = tsysSpec.size() ; 1215 unsigned int numChan = tsysSpec[0].size() ; 1216 tsys.resize( numReceptor ) ; 1217 for ( unsigned int ir = 0 ; ir < numReceptor ; ir++ ) { 1218 tsys[ir].resize( numChan ) ; 1219 for ( unsigned int ic = 0 ; ic < numChan ; ic++ ) { 1220 tsys[ir][ic] = tsysSpec[ir][ic].get() ; 1221 } 1222 } 1223 } 1224 else { 1225 tsys = defaultT ; 1226 } 1227 if ( scrow->isTcalSpectrumExists() ) { 1228 vector< vector<Temperature> > tcalSpec = scrow->getTcalSpectrum() ; 1229 unsigned int numReceptor = tcalSpec.size() ; 1230 unsigned int numChan = tcalSpec[0].size() ; 1231 tcal.resize( numReceptor ) ; 1232 for ( unsigned int ir = 0 ; ir < numReceptor ; ir++ ) { 1233 tcal[ir].resize( numReceptor ) ; 1234 for ( unsigned int ic = 0 ; ic < numChan ; ic++ ) { 1235 tcal[ir][ic] = tcalSpec[ir][ic].get() ; 1236 } 1237 } 1238 } 1239 else { 1240 tcal = defaultT ; 1241 } 1242 } 1243 } 1222 1244 1223 1245 vector<float> ASDMReader::getOpacity( unsigned int idx ) … … 1852 1874 return nif ; 1853 1875 } 1876 1877 SysCalRow *ASDMReader::getSysCalRow( unsigned int idx ) 1878 { 1879 String funcName = "getSysCalRow" ; 1880 1881 SysCalRow *row = 0 ; 1882 unsigned int index = dataIdList_[idx] ; 1883 Tag anttag( antennaId_, TagType::Antenna ) ; 1884 int feedid = vmsData_->v_feedId1[index] ; 1885 //ArrayTimeInterval tint( vmsData_->v_time[index]*s2d, vmsData_->v_interval[index]*s2d ) ; 1886 double startSec = vmsData_->v_time[index] - 0.5 * vmsData_->v_interval[index] ; 1887 ArrayTimeInterval tint( startSec*s2d, vmsData_->v_interval[index]*s2d ) ; 1888 Tag ddtag( vmsData_->v_dataDescId[index], TagType::DataDescription ) ; 1889 Tag spwtag = asdm_->getDataDescription().getRowByKey(ddtag)->getSpectralWindowId() ; 1890 //int nchan = asdm_->getSpectralWindow().getRowByKey(spwtag)->getNumChan() ; 1891 vector< vector<float> > defaultTsys( 1, vector<float>( 1, 1.0 ) ) ; 1892 SysCalTable &sctab = asdm_->getSysCal() ; 1893 //vector<SysCalRow *> rows = sctab.get() ; 1894 vector<SysCalRow *> *rows = sctab.getByContext( anttag, spwtag, feedid ) ; 1895 //if ( nrow == 0 ) { 1896 if ( rows == 0 ) { 1897 //logsink_->postLocally( LogMessage("no rows in SysCal table",LogOrigin(className_,funcName,WHERE)) ) ; 1898 row = 0 ; 1899 } 1900 else { 1901 unsigned int nrow = rows->size() ; 1902 //logsink_->postLocally( LogMessage("nrow = "+String::toString(nrow),LogOrigin(className_,funcName,WHERE)) ) ; 1903 int scindex = -1 ; 1904 if ( nrow == 1 ) { 1905 scindex = 0 ; 1906 } 1907 else if ( getEndTime( tint ) <= getStartTime( (*rows)[0]->getTimeInterval() ) ) 1908 scindex = 0 ; 1909 else { 1910 for ( unsigned int irow = 0 ; irow < nrow-1 ; irow++ ) { 1911 ArrayTime t = getMidTime( tint ) ; 1912 if ( t > getStartTime( (*rows)[irow]->getTimeInterval() ) 1913 && t <= getStartTime( (*rows)[irow+1]->getTimeInterval() ) ) { 1914 scindex = irow ; 1915 break ; 1916 } 1917 } 1918 if ( scindex == -1 ) 1919 scindex = nrow-1 ; 1920 } 1921 //logsink_->postLocally( LogMessage("irow = "+String::toString(scindex),LogOrigin(className_,funcName,WHERE)) ) ; 1922 row = (*rows)[scindex] ; 1923 } 1924 return row ; 1925 } -
trunk/external-alma/asdm2ASAP/ASDMReader.h
r2227 r2251 316 316 **/ 317 317 std::vector< std::vector<float> > getTcal( unsigned int idx ) ; 318 319 /** 320 * get Tcal and Tsys for given index 321 * 322 * @param idx for vmsData_ 323 * @param tcal Tcal 324 * @param tsys Tsys 325 **/ 326 void getTcalAndTsys( unsigned int idx, 327 std::vector< std::vector<float> > &tcal, 328 std::vector< std::vector<float> > &tsys ) ; 318 329 319 330 /** … … 529 540 **/ 530 541 int getNumIFs() ; 542 543 /** 544 * get appropriate row from SysCal table 545 * 546 * @param idx for vmsData_ 547 * @return pointer to SysCalRow object (0 when no appropriate row) 548 **/ 549 asdm::SysCalRow *getSysCalRow( unsigned int idx ) ; 531 550 532 551 asdm::ASDM *asdm_ ; // pointer to ASDM object
Note:
See TracChangeset
for help on using the changeset viewer.