Commits
Darrell Schiebel authored 38c622e4bc9 Merge
1451 1451 | |
1452 1452 | Block<CountedPtr<SIImageStore> > SynthesisImager::createChanChunkImageStoreList( |
1453 1453 | CountedPtr<SIImageStore> imagestore, |
1454 1454 | Int chanchunks) |
1455 1455 | { |
1456 1456 | LogIO os(LogOrigin("SynthesisImager", "createChanChunkImageStoreList")); |
1457 1457 | |
1458 1458 | Int extrachunks=0; |
1459 1459 | Int chunksize=imagestore->getShape()[3]/chanchunks; |
1460 1460 | Int rem=imagestore->getShape()[3] % chanchunks; |
1461 - | |
1461 + | ///Avoid an extra chunk with 1 channel as it cause bumps in linear interpolation |
1462 + | ///See CAS-12625 |
1463 + | while((rem==1) && (chunksize >1)){ |
1464 + | chanchunks +=1; |
1465 + | chunksize=imagestore->getShape()[3]/chanchunks; |
1466 + | rem=imagestore->getShape()[3] % chanchunks; |
1467 + | } |
1468 + | |
1469 + | |
1470 + | |
1462 1471 | if( rem>0 ) |
1463 1472 | { |
1464 1473 | // os << LogIO::WARN << "chanchunks ["+String::toString(chanchunks)+"] is not a divisor of nchan ["+String::toString(imagestore->getShape()[3])+"]."; |
1465 1474 | // os << "Therefore, "+String::toString(imagestore->getShape()[3] % chanchunks)+" channel(s) at the end of the cube will be treated as an extra chunk." << LogIO::POST ; |
1466 1475 | |
1467 1476 | if( rem < chunksize ) extrachunks=1; |
1468 1477 | else |
1469 1478 | { |
1470 1479 | extrachunks=rem/chunksize; |
1471 1480 | if( rem % chunksize > 0 ) extrachunks += 1; |
1472 1481 | } |
1473 1482 | } |
1474 1483 | |
1484 + | |
1475 1485 | os << "Creating " << chanchunks +extrachunks << " reference subCubes (channel chunks) for gridding " << LogIO::POST; |
1476 1486 | |
1477 1487 | Block<CountedPtr<SIImageStore> > chunkList( chanchunks + extrachunks ); |
1478 1488 | |
1479 1489 | if( chanchunks==1 ) { chunkList[0] = imagestore; return chunkList; } |
1480 1490 | |
1481 1491 | // Remember, only the FIRST field in each run can have chanchunks. So, check for this. |
1482 1492 | if( ! unChanChunkedImStore_p.null() ) { |
1483 1493 | throw( AipsError("A channel chunked image has already been set. Chanchunks are supported only for the main (first) field. Please submit a feature-request if you need multiple chanchunks for outlier fields as well. ") ); |
1484 1494 | } |
2704 2714 | } |
2705 2715 | } |
2706 2716 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
2707 2717 | |
2708 2718 | //Utility function to properly convert Double to String. |
2709 2719 | //With C++11 we can probably use STL to_string() function instead... |
2710 2720 | String SynthesisImager::doubleToString(const Double& df) { |
2711 2721 | std::ostringstream ss; |
2712 2722 | ss.precision(std::numeric_limits<double>::digits10+2); |
2713 2723 | ss << df; |
2714 - | return ss.str(); |
2724 + | //return ss.str(); |
2725 + | return to_string(df); |
2715 2726 | } |
2716 2727 | |
2717 2728 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
2718 2729 | |
2719 2730 | Bool SynthesisImager::makePB() |
2720 2731 | { |
2721 2732 | LogIO os( LogOrigin("SynthesisImager","makePB",WHERE) ); |
2722 2733 | |
2723 2734 | if( itsMakeVP==False ) |
2724 2735 | { |