Changeset 12946 for trunk/Mars/mcore/DrsCalib.h
- Timestamp:
- 02/27/12 14:23:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/DrsCalib.h
r12924 r12946 155 155 } 156 156 157 157 158 static void ApplyCh(float *vec, const int16_t *val, int16_t start, uint32_t roi, 158 159 const int32_t *offset, const uint32_t scaleabs, … … 229 230 p[i] = (p[i-1]+p[i+2])/2; 230 231 p[i+1] = p[i]; 232 } 233 } 234 } 235 } 236 237 static void RemoveSpikes2(float *vec, uint32_t roi)//from Werner 238 { 239 if (roi<4) 240 return; 241 242 for (size_t ch=0; ch<1440; ch++) 243 { 244 float *p = vec + ch*roi; 245 246 std::vector<float> Ameas(p, p+roi); 247 248 std::vector<float> N1mean(roi); 249 for (size_t i=2; i<roi-2; i++) 250 { 251 N1mean[i] = (p[i-1] + p[i+1])/2.; 252 } 253 254 const float fract = 0.8; 255 float x, xp, xpp; 256 257 for (size_t i=0; i<roi-3; i++) 258 { 259 x = Ameas[i] - N1mean[i]; 260 if ( x > -5.) 261 continue; 262 263 xp = Ameas[i+1] - N1mean[i+1]; 264 xpp = Ameas[i+2] - N1mean[i+2]; 265 266 if(Ameas[i+2] - (Ameas[i] + Ameas[i+3])/2. > 10.) 267 { 268 p[i+1]=(Ameas[i] + Ameas[i+3])/2.; 269 p[i+2]=(Ameas[i] + Ameas[i+3])/2.; 270 271 i += 3; 272 273 continue; 274 } 275 if ( (xp > -2.*x*fract) && (xpp < -10.) ) 276 { 277 p[i+1] = N1mean[i+1]; 278 N1mean[i+2] = (Ameas[i+1] - Ameas[i+3] / 2.); 279 280 i += 2; 231 281 } 232 282 } … … 622 672 { 623 673 std::ostringstream msg; 624 msg << "Could not open file " << str << ": " << strerror(errno);674 msg << "Could not open file '" << str << "': " << strerror(errno); 625 675 return msg.str(); 626 676 } … … 629 679 { 630 680 std::ostringstream msg; 631 msg << "Reading " << str << "failed: Not a valid FACT file (TELESCOP not FACT in header)";681 msg << "Reading '" << str << "' failed: Not a valid FACT file (TELESCOP not FACT in header)"; 632 682 return msg.str(); 633 683 } … … 636 686 { 637 687 std::ostringstream msg; 638 msg << "Reading " << str << "failed: Is not a DRS calib file (STEP not found in header)";688 msg << "Reading '" << str << "' failed: Is not a DRS calib file (STEP not found in header)"; 639 689 return msg.str(); 640 690 } … … 643 693 { 644 694 std::ostringstream msg; 645 msg << "Reading " << str << "failed: Number of rows in table is not 1.";695 msg << "Reading '" << str << "' failed: Number of rows in table is not 1."; 646 696 return msg.str(); 647 697 }
Note:
See TracChangeset
for help on using the changeset viewer.