Changeset 2640
- Timestamp:
- 08/10/12 20:18:03 (12 years ago)
- Location:
- branches/hpc34
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hpc34/CMakeLists.txt
r2577 r2640 5 5 # minimum requirement for cmake version 6 6 cmake_minimum_required( VERSION 2.8 ) 7 8 set( MY_OPT_FLAGS "-O3 -funroll-loops -m64 -march=native -msse4.1 -floop-interchange" ) 7 9 8 10 # options … … 85 87 # default flags 86 88 set( DEFAULT_CXX_FLAGS 87 " -pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )89 "${MY_OPT_FLAGS} -pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" ) 88 90 89 91 find_package( OpenMP ) -
branches/hpc34/python/scantable.py
r2574 r2640 2440 2440 clipniter=None, plot=None, 2441 2441 getresidual=None, showprogress=None, 2442 minnrow=None, outlog=None, blfile=None ):2442 minnrow=None, outlog=None, blfile=None, csvformat=None): 2443 2443 """\ 2444 2444 Return a scan which has been baselined (all rows) with sinusoidal … … 2498 2498 parameter values to be written 2499 2499 (default is '': no file/logger output) 2500 csvformat: if True blfile is csv-formatted, default is False. 2500 2501 2501 2502 Example: … … 2534 2535 if outlog is None: outlog = False 2535 2536 if blfile is None: blfile = '' 2536 2537 if csvformat is None: csvformat = False 2538 2539 if csvformat: 2540 scsvformat = "T" 2541 else: 2542 scsvformat = "F" 2543 2537 2544 #CURRENTLY, PLOT=true is UNAVAILABLE UNTIL sinusoidal fitting is implemented as a fitter method. 2538 2545 workscan._sinusoid_baseline(mask, applyfft, fftmethod.lower(), 2539 2546 str(fftthresh).lower(), 2540 2547 workscan._parse_wn(addwn), 2541 workscan._parse_wn(rejwn), clipthresh, 2542 clipniter, getresidual, 2548 workscan._parse_wn(rejwn), 2549 clipthresh, clipniter, 2550 getresidual, 2543 2551 pack_progress_params(showprogress, 2544 minnrow), outlog,2545 blfile)2552 minnrow), 2553 outlog, scsvformat+blfile) 2546 2554 workscan._add_history('sinusoid_baseline', varlist) 2547 2555 … … 2562 2570 chan_avg_limit=None, plot=None, 2563 2571 getresidual=None, showprogress=None, 2564 minnrow=None, outlog=None, blfile=None ):2572 minnrow=None, outlog=None, blfile=None, csvformat=None): 2565 2573 """\ 2566 2574 Return a scan which has been baselined (all rows) with sinusoidal … … 2642 2650 parameter values to be written 2643 2651 (default is "": no file/logger output) 2652 csvformat: if True blfile is csv-formatted, default is False. 2644 2653 2645 2654 Example: … … 2678 2687 if outlog is None: outlog = False 2679 2688 if blfile is None: blfile = '' 2689 if csvformat is None: csvformat = False 2690 2691 if csvformat: 2692 scsvformat = "T" 2693 else: 2694 scsvformat = "F" 2680 2695 2681 2696 #CURRENTLY, PLOT=true is UNAVAILABLE UNTIL sinusoidal fitting is implemented as a fitter method. … … 2691 2706 pack_progress_params(showprogress, 2692 2707 minnrow), 2693 outlog, blfile)2708 outlog, scsvformat+blfile) 2694 2709 workscan._add_history("auto_sinusoid_baseline", varlist) 2695 2710 … … 2706 2721 clipthresh=None, clipniter=None, plot=None, 2707 2722 getresidual=None, showprogress=None, minnrow=None, 2708 outlog=None, blfile=None ):2723 outlog=None, blfile=None, csvformat=None): 2709 2724 """\ 2710 2725 Return a scan which has been baselined (all rows) by cubic spline … … 2735 2750 parameter values to be written 2736 2751 (default is "": no file/logger output) 2752 csvformat: if True blfile is csv-formatted, default is False. 2737 2753 2738 2754 Example: … … 2767 2783 if outlog is None: outlog = False 2768 2784 if blfile is None: blfile = '' 2785 if csvformat is None: csvformat = False 2786 2787 if csvformat: 2788 scsvformat = "T" 2789 else: 2790 scsvformat = "F" 2769 2791 2770 2792 #CURRENTLY, PLOT=true UNAVAILABLE UNTIL cubic spline fitting is implemented as a fitter method. … … 2772 2794 getresidual, 2773 2795 pack_progress_params(showprogress, 2774 minnrow), outlog,2775 blfile)2796 minnrow), 2797 outlog, scsvformat+blfile) 2776 2798 workscan._add_history("cspline_baseline", varlist) 2777 2799 … … 2790 2812 getresidual=None, plot=None, 2791 2813 showprogress=None, minnrow=None, outlog=None, 2792 blfile=None ):2814 blfile=None, csvformat=None): 2793 2815 """\ 2794 2816 Return a scan which has been baselined (all rows) by cubic spline … … 2841 2863 parameter values to be written 2842 2864 (default is "": no file/logger output) 2865 csvformat: if True blfile is csv-formatted, default is False. 2843 2866 2844 2867 Example: … … 2873 2896 if outlog is None: outlog = False 2874 2897 if blfile is None: blfile = '' 2898 if csvformat is None: csvformat = False 2899 2900 if csvformat: 2901 scsvformat = "T" 2902 else: 2903 scsvformat = "F" 2875 2904 2876 2905 #CURRENTLY, PLOT=true UNAVAILABLE UNTIL cubic spline fitting is implemented as a fitter method. … … 2882 2911 pack_progress_params(showprogress, 2883 2912 minnrow), 2884 outlog, blfile)2913 outlog, scsvformat+blfile) 2885 2914 workscan._add_history("auto_cspline_baseline", varlist) 2886 2915 … … 2896 2925 def poly_baseline(self, mask=None, order=None, insitu=None, plot=None, 2897 2926 getresidual=None, showprogress=None, minnrow=None, 2898 outlog=None, blfile=None ):2927 outlog=None, blfile=None, csvformat=None): 2899 2928 """\ 2900 2929 Return a scan which has been baselined (all rows) by a polynomial. … … 2919 2948 parameter values to be written 2920 2949 (default is "": no file/logger output) 2950 csvformat: if True blfile is csv-formatted, default is False. 2921 2951 2922 2952 Example: … … 2946 2976 if outlog is None: outlog = False 2947 2977 if blfile is None: blfile = "" 2978 if csvformat is None: csvformat = False 2979 2980 if csvformat: 2981 scsvformat = "T" 2982 else: 2983 scsvformat = "F" 2948 2984 2949 2985 if plot: … … 2990 3026 blpars["fixed"], 2991 3027 rms, str(masklist), 2992 r, True )3028 r, True, csvformat) 2993 3029 blf.write(dataout) 2994 3030 … … 3002 3038 pack_progress_params(showprogress, 3003 3039 minnrow), 3004 outlog, blfile)3040 outlog, scsvformat+blfile) 3005 3041 3006 3042 workscan._add_history("poly_baseline", varlist) … … 3019 3055 plot=None, insitu=None, 3020 3056 getresidual=None, showprogress=None, 3021 minnrow=None, outlog=None, blfile=None ):3057 minnrow=None, outlog=None, blfile=None, csvformat=None): 3022 3058 """\ 3023 3059 Return a scan which has been baselined (all rows) by a polynomial. … … 3065 3101 parameter values to be written 3066 3102 (default is "": no file/logger output) 3103 csvformat: if True blfile is csv-formatted, default is False. 3067 3104 3068 3105 Example: … … 3092 3129 if outlog is None: outlog = False 3093 3130 if blfile is None: blfile = '' 3131 if csvformat is None: csvformat = False 3132 3133 if csvformat: 3134 scsvformat = "T" 3135 else: 3136 scsvformat = "F" 3094 3137 3095 3138 edge = normalise_edge_param(edge) … … 3145 3188 blpars["fixed"], 3146 3189 rms, str(masklist), 3147 r, True )3190 r, True, csvformat) 3148 3191 blf.write(dataout) 3149 3192 … … 3157 3200 pack_progress_params(showprogress, 3158 3201 minnrow), 3159 outlog, blfile)3202 outlog, scsvformat+blfile) 3160 3203 3161 3204 workscan._add_history("auto_poly_baseline", varlist) -
branches/hpc34/src/Scantable.cpp
r2575 r2640 2333 2333 bool hasSameNchan = true; 2334 2334 bool outTextFile = false; 2335 bool csvFormat = false; 2335 2336 2336 2337 if (blfile != "") { 2337 ofs.open(blfile.c_str(), ios::out | ios::app); 2338 csvFormat = (blfile.substr(0, 1) == "T"); 2339 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 2338 2340 if (ofs) outTextFile = true; 2339 2341 } … … 2359 2361 fitBaseline(chanMask, whichrow, fitter); 2360 2362 setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 2361 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "polyBaseline()", fitter);2363 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "polyBaseline()", fitter); 2362 2364 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 2363 2365 } … … 2377 2379 bool hasSameNchan = true; 2378 2380 bool outTextFile = false; 2381 bool csvFormat = false; 2379 2382 2380 2383 if (blfile != "") { 2381 ofs.open(blfile.c_str(), ios::out | ios::app); 2384 csvFormat = (blfile.substr(0, 1) == "T"); 2385 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 2382 2386 if (ofs) outTextFile = true; 2383 2387 } … … 2431 2435 setSpectrum((getResidual ? fitter.getResidual() : fitter.getFit()), whichrow); 2432 2436 2433 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoPolyBaseline()", fitter);2437 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoPolyBaseline()", fitter); 2434 2438 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 2435 2439 } … … 2449 2453 bool hasSameNchan = true; 2450 2454 bool outTextFile = false; 2455 bool csvFormat = false; 2451 2456 2452 2457 if (blfile != "") { 2453 ofs.open(blfile.c_str(), ios::out | ios::app); 2458 csvFormat = (blfile.substr(0, 1) == "T"); 2459 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 2454 2460 if (ofs) outTextFile = true; 2455 2461 } … … 2484 2490 // 2485 2491 2486 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "cubicSplineBaseline()", pieceEdges, params, nClipped);2492 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "cubicSplineBaseline()", pieceEdges, params, nClipped); 2487 2493 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 2488 2494 } … … 2503 2509 bool hasSameNchan = true; 2504 2510 bool outTextFile = false; 2511 bool csvFormat = false; 2505 2512 2506 2513 if (blfile != "") { 2507 ofs.open(blfile.c_str(), ios::out | ios::app); 2514 csvFormat = (blfile.substr(0, 1) == "T"); 2515 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 2508 2516 if (ofs) outTextFile = true; 2509 2517 } … … 2564 2572 // 2565 2573 2566 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoCubicSplineBaseline()", pieceEdges, params, nClipped);2574 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoCubicSplineBaseline()", pieceEdges, params, nClipped); 2567 2575 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 2568 2576 } … … 3007 3015 bool hasSameNchan = true; 3008 3016 bool outTextFile = false; 3017 bool csvFormat = false; 3009 3018 3010 3019 if (blfile != "") { 3011 ofs.open(blfile.c_str(), ios::out | ios::app); 3020 csvFormat = (blfile.substr(0, 1) == "T"); 3021 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 3012 3022 if (ofs) outTextFile = true; 3013 3023 } … … 3059 3069 // 3060 3070 3061 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "sinusoidBaseline()", params, nClipped);3071 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "sinusoidBaseline()", params, nClipped); 3062 3072 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 3063 3073 } … … 3077 3087 bool hasSameNchan = true; 3078 3088 bool outTextFile = false; 3089 bool csvFormat = false; 3079 3090 3080 3091 if (blfile != "") { 3081 ofs.open(blfile.c_str(), ios::out | ios::app); 3092 csvFormat = (blfile.substr(0, 1) == "T"); 3093 ofs.open(blfile.substr(1).c_str(), ios::out | ios::app); 3082 3094 if (ofs) outTextFile = true; 3083 3095 } … … 3140 3152 // 3141 3153 3142 outputFittingResult(outLogger, outTextFile, c hanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoSinusoidBaseline()", params, nClipped);3154 outputFittingResult(outLogger, outTextFile, csvFormat, chanMask, whichrow, coordInfo, hasSameNchan, ofs, "autoSinusoidBaseline()", params, nClipped); 3143 3155 showProgressOnTerminal(whichrow, nRow, showProgress, minNRow); 3144 3156 } … … 3422 3434 3423 3435 /* for poly. the variations of outputFittingResult() should be merged into one eventually (2011/3/10 WK) */ 3424 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, Fitter& fitter)3436 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, Fitter& fitter) 3425 3437 { 3426 3438 if (outLogger || outTextFile) { … … 3432 3444 if (outLogger) { 3433 3445 LogIO ols(LogOrigin("Scantable", funcName, WHERE)); 3434 ols << formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, false ) << LogIO::POST ;3446 ols << formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, false, csvFormat) << LogIO::POST ; 3435 3447 } 3436 3448 if (outTextFile) { 3437 ofs << formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, true ) << flush;3449 ofs << formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, true, csvFormat) << flush; 3438 3450 } 3439 3451 } … … 3441 3453 3442 3454 /* for cspline. will be merged once cspline is available in fitter (2011/3/10 WK) */ 3443 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, const std::vector<int>& edge, const std::vector<float>& params, const int nClipped)3455 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, const std::vector<int>& edge, const std::vector<float>& params, const int nClipped) 3444 3456 { 3445 3457 if (outLogger || outTextFile) { … … 3451 3463 if (outLogger) { 3452 3464 LogIO ols(LogOrigin("Scantable", funcName, WHERE)); 3453 ols << formatPiecewiseBaselineParams(edge, params, fixed, rms, nClipped, masklist, whichrow, false ) << LogIO::POST ;3465 ols << formatPiecewiseBaselineParams(edge, params, fixed, rms, nClipped, masklist, whichrow, false, csvFormat) << LogIO::POST ; 3454 3466 } 3455 3467 if (outTextFile) { 3456 ofs << formatPiecewiseBaselineParams(edge, params, fixed, rms, nClipped, masklist, whichrow, true ) << flush;3468 ofs << formatPiecewiseBaselineParams(edge, params, fixed, rms, nClipped, masklist, whichrow, true, csvFormat) << flush; 3457 3469 } 3458 3470 } … … 3460 3472 3461 3473 /* for sinusoid. will be merged once sinusoid is available in fitter (2011/3/10 WK) */ 3462 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, const std::vector<float>& params, const int nClipped)3474 void Scantable::outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, ofstream& ofs, const casa::String& funcName, const std::vector<float>& params, const int nClipped) 3463 3475 { 3464 3476 if (outLogger || outTextFile) { … … 3470 3482 if (outLogger) { 3471 3483 LogIO ols(LogOrigin("Scantable", funcName, WHERE)); 3472 ols << formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, false ) << LogIO::POST ;3484 ols << formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, false, csvFormat) << LogIO::POST ; 3473 3485 } 3474 3486 if (outTextFile) { 3475 ofs << formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, true ) << flush;3487 ofs << formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, true, csvFormat) << flush; 3476 3488 } 3477 3489 } … … 3574 3586 3575 3587 3576 std::string Scantable::formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose) const 3577 { 3578 ostringstream oss; 3579 3588 std::string Scantable::formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose, bool csvformat) const 3589 { 3580 3590 if (verbose) { 3581 oss << " Scan[" << getScan(whichrow) << "]"; 3582 oss << " Beam[" << getBeam(whichrow) << "]"; 3583 oss << " IF[" << getIF(whichrow) << "]"; 3584 oss << " Pol[" << getPol(whichrow) << "]"; 3585 oss << " Cycle[" << getCycle(whichrow) << "]: " << endl; 3586 oss << "Fitter range = " << masklist << endl; 3587 oss << "Baseline parameters" << endl; 3591 ostringstream oss; 3592 3593 if (csvformat) { 3594 oss << getScan(whichrow) << ","; 3595 oss << getBeam(whichrow) << ","; 3596 oss << getIF(whichrow) << ","; 3597 oss << getPol(whichrow) << ","; 3598 oss << getCycle(whichrow) << ","; 3599 String commaReplacedMasklist = masklist; 3600 string::size_type pos = 0; 3601 while (pos = commaReplacedMasklist.find(","), pos != string::npos) { 3602 commaReplacedMasklist.replace(pos, 1, ";"); 3603 pos++; 3604 } 3605 oss << commaReplacedMasklist << ","; 3606 } else { 3607 oss << " Scan[" << getScan(whichrow) << "]"; 3608 oss << " Beam[" << getBeam(whichrow) << "]"; 3609 oss << " IF[" << getIF(whichrow) << "]"; 3610 oss << " Pol[" << getPol(whichrow) << "]"; 3611 oss << " Cycle[" << getCycle(whichrow) << "]: " << endl; 3612 oss << "Fitter range = " << masklist << endl; 3613 oss << "Baseline parameters" << endl; 3614 } 3588 3615 oss << flush; 3589 } 3590 3591 return String(oss);3592 } 3593 3594 std::string Scantable::formatBaselineParamsFooter(float rms, int nClipped, bool verbose) const 3595 { 3596 ostringstream oss; 3597 3616 3617 return String(oss); 3618 } 3619 3620 return ""; 3621 } 3622 3623 std::string Scantable::formatBaselineParamsFooter(float rms, int nClipped, bool verbose, bool csvformat) const 3624 { 3598 3625 if (verbose) { 3599 oss << "Results of baseline fit" << endl; 3600 oss << " rms = " << setprecision(6) << rms << endl; 3601 if (nClipped >= 0) { 3602 oss << " Number of clipped channels = " << nClipped << endl; 3603 } 3604 for (int i = 0; i < 60; ++i) { 3605 oss << "-"; 3626 ostringstream oss; 3627 3628 if (csvformat) { 3629 oss << rms << ","; 3630 if (nClipped >= 0) { 3631 oss << nClipped; 3632 } 3633 } else { 3634 oss << endl; 3635 oss << "Results of baseline fit" << endl; 3636 oss << " rms = " << setprecision(6) << rms << endl; 3637 if (nClipped >= 0) { 3638 oss << " Number of clipped channels = " << nClipped << endl; 3639 } 3640 for (int i = 0; i < 60; ++i) { 3641 oss << "-"; 3642 } 3606 3643 } 3607 3644 oss << endl; 3608 3645 oss << flush; 3609 } 3610 3611 return String(oss); 3646 3647 return String(oss); 3648 } 3649 3650 return ""; 3612 3651 } 3613 3652 … … 3619 3658 int whichrow, 3620 3659 bool verbose, 3660 bool csvformat, 3621 3661 int start, int count, 3622 3662 bool resetparamid) const … … 3629 3669 3630 3670 ostringstream oss; 3631 oss << formatBaselineParamsHeader(whichrow, masklist, verbose );3671 oss << formatBaselineParamsHeader(whichrow, masklist, verbose, csvformat); 3632 3672 3633 3673 if (start < 0) start = 0; … … 3642 3682 } 3643 3683 std::string sFix = ((fixed.size() > 0) && (fixed[i]) && verbose) ? "(fixed)" : ""; 3644 oss << " p" << (i+paramidoffset) << sFix << "= " << right << setw(13) << setprecision(6) << params[i]; 3645 } 3646 3647 oss << endl; 3648 oss << formatBaselineParamsFooter(rms, nClipped, verbose); 3684 if (csvformat) { 3685 oss << params[i] << sFix; 3686 } else { 3687 oss << " p" << (i+paramidoffset) << sFix << "= " << right << setw(13) << setprecision(6) << params[i]; 3688 } 3689 } 3690 3691 if (csvformat) { 3692 oss << ","; 3693 } 3694 oss << formatBaselineParamsFooter(rms, nClipped, verbose, csvformat); 3649 3695 3650 3696 return String(oss); … … 3653 3699 } 3654 3700 3655 std::string Scantable::formatPiecewiseBaselineParams(const std::vector<int>& ranges, const std::vector<float>& params, const std::vector<bool>& fixed, float rms, int nClipped, const std::string& masklist, int whichrow, bool verbose) const3701 std::string Scantable::formatPiecewiseBaselineParams(const std::vector<int>& ranges, const std::vector<float>& params, const std::vector<bool>& fixed, float rms, int nClipped, const std::string& masklist, int whichrow, bool verbose, bool csvformat) const 3656 3702 { 3657 3703 int nOutParam = (int)(params.size()); … … 3661 3707 return(" Not fitted"); 3662 3708 } else if (nPiece < 0) { 3663 return formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, verbose );3709 return formatBaselineParams(params, fixed, rms, nClipped, masklist, whichrow, verbose, csvformat); 3664 3710 } else if (nPiece < 1) { 3665 3711 return(" Bad count of the piece edge info"); … … 3671 3717 3672 3718 ostringstream oss; 3673 oss << formatBaselineParamsHeader(whichrow, masklist, verbose); 3674 3675 stringstream ss; 3676 ss << ranges[nPiece] << flush; 3677 int wRange = ss.str().size() * 2 + 5; 3678 3679 for (int i = 0; i < nPiece; ++i) { 3680 ss.str(""); 3681 ss << " [" << ranges[i] << "," << (ranges[i+1]-1) << "]"; 3682 oss << left << setw(wRange) << ss.str(); 3683 oss << formatBaselineParams(params, fixed, rms, 0, masklist, whichrow, false, i*nParam, nParam, true); 3684 } 3685 3686 oss << formatBaselineParamsFooter(rms, nClipped, verbose); 3719 oss << formatBaselineParamsHeader(whichrow, masklist, verbose, csvformat); 3720 3721 if (csvformat) { 3722 for (int i = 0; i < nPiece; ++i) { 3723 oss << ranges[i] << "," << (ranges[i+1]-1) << ","; 3724 oss << formatBaselineParams(params, fixed, rms, 0, masklist, whichrow, false, csvformat, i*nParam, nParam, true); 3725 } 3726 } else { 3727 stringstream ss; 3728 ss << ranges[nPiece] << flush; 3729 int wRange = ss.str().size() * 2 + 5; 3730 3731 for (int i = 0; i < nPiece; ++i) { 3732 ss.str(""); 3733 ss << " [" << ranges[i] << "," << (ranges[i+1]-1) << "]"; 3734 oss << left << setw(wRange) << ss.str(); 3735 oss << formatBaselineParams(params, fixed, rms, 0, masklist, whichrow, false, csvformat, i*nParam, nParam, true); 3736 oss << endl; 3737 } 3738 } 3739 3740 oss << formatBaselineParamsFooter(rms, nClipped, verbose, csvformat); 3687 3741 3688 3742 return String(oss); -
branches/hpc34/src/Scantable.h
r2435 r2640 579 579 int whichrow, 580 580 bool verbose=false, 581 bool csvformat=false, 581 582 int start=-1, 582 583 int count=-1, … … 589 590 const std::string& masklist, 590 591 int whichrow, 591 bool verbose=false) const; 592 bool verbose=false, 593 bool csvformat=false) const; 592 594 593 595 … … 754 756 bool verbose=false); 755 757 std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask); 756 std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose ) const;757 std::string formatBaselineParamsFooter(float rms, int nClipped, bool verbose ) const;758 std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose, bool csvformat) const; 759 std::string formatBaselineParamsFooter(float rms, int nClipped, bool verbose, bool csvformat) const; 758 760 std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask); 759 761 //std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask, const std::vector<int>& edge, const int minEdgeSize, STLineFinder& lineFinder); 760 void outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, Fitter& fitter);761 void outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<int>& edge, const std::vector<float>& params, const int nClipped);762 void outputFittingResult(bool outLogger, bool outTextFile, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<float>& params, const int nClipped);762 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, Fitter& fitter); 763 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<int>& edge, const std::vector<float>& params, const int nClipped); 764 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<float>& params, const int nClipped); 763 765 void parseProgressInfo(const std::string& progressInfo, bool& showProgress, int& minNRow); 764 766 void showProgressOnTerminal(const int nProcessed, const int nTotal, const bool showProgress=true, const int nTotalThreshold=1000); -
branches/hpc34/src/ScantableWrapper.h
r2435 r2640 292 292 { return table_->getRms(mask, whichrow); } 293 293 294 std::string formatBaselineParams(const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false )295 { return table_->formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, verbose); }296 297 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges, const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false )298 { return table_->formatPiecewiseBaselineParams(ranges, params, fixed, rms, -1, masklist, whichrow, verbose ); }294 std::string formatBaselineParams(const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false, bool csvformat=false) 295 { return table_->formatBaselineParams(params, fixed, rms, -1, masklist, whichrow, verbose, csvformat); } 296 297 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges, const std::vector<float>& params, const std::vector<bool>& fixed, float rms, const std::string& masklist, int whichrow, bool verbose=false, bool csvformat=false) 298 { return table_->formatPiecewiseBaselineParams(ranges, params, fixed, rms, -1, masklist, whichrow, verbose, csvformat); } 299 299 300 300 bool getFlagtraFast(int whichrow=0) const
Note:
See TracChangeset
for help on using the changeset viewer.