Commits
Sanjay Bhatnagar authored d1d29efd137 Merge
212 212 | itsNPolChunks = 1; |
213 213 | itsPolId = 0; |
214 214 | |
215 215 | itsOverWrite=False; |
216 216 | |
217 217 | itsImageName = imagename; |
218 218 | |
219 219 | // The PSF or Residual images must exist. ( TODO : and weight ) |
220 220 | if( doesImageExist(itsImageName+String(".residual")) || |
221 221 | doesImageExist(itsImageName+String(".psf")) || |
222 + | // doesImageExist(itsImageName+String(".model")) || |
222 223 | doesImageExist(itsImageName+String(".gridwt")) ) |
223 224 | { |
224 225 | SHARED_PTR<ImageInterface<Float> > imptr; |
225 226 | if( doesImageExist(itsImageName+String(".psf")) ) |
226 227 | { |
227 228 | // imptr.reset( new PagedImage<Float> (itsImageName+String(".psf")) ); |
228 229 | buildImage( imptr, (itsImageName+String(".psf")) ); |
229 230 | itsMiscInfo=imptr->miscInfo(); |
230 231 | } |
231 232 | else if ( doesImageExist(itsImageName+String(".residual")) ){ |
494 495 | // Check if coordsys and shape of this image are consistent with current ones (if filled) |
495 496 | |
496 497 | if( useShape.product()>0 && ! useShape.isEqual( imPtr->shape() ) ) |
497 498 | { |
498 499 | ostringstream oo1,oo2; |
499 500 | oo1 << useShape; oo2 << imPtr->shape(); |
500 501 | throw( AipsError( "There is a shape mismatch between existing images ("+oo2.str()+") and current parameters ("+oo1.str()+"). If you are attempting to restart a run with a new image shape, please change imagename and supply the old model or mask as inputs (via the startmodel or mask parameters) so that they can be regridded to the new shape before continuing." ) ); |
501 502 | } |
502 503 | if( itsParentCoordSys.nCoordinates()>0 && ! itsParentCoordSys.near( imPtr->coordinates() ) ) |
503 504 | { |
504 - | throw( AipsError( "There is a coordinate system mismatch between existing images on disk and current parameters ("+itsParentCoordSys.errorMessage()+"). If you are attempting to restart a run, please change imagename and supply the old model or mask as inputs (via the startmodel or mask parameters) so that they can be regridded to the new coordinate system before continuing. " ) ); |
505 + | |
506 + | /// Implement an exception to get CAS-9977 to work. |
507 + | /// "The DirectionCoordinates have differing latpoles" |
508 + | if( itsParentCoordSys.errorMessage().contains("differing latpoles") ) |
509 + | { |
510 + | LogIO os( LogOrigin("SIImageStore","Open existing Images",WHERE) ); |
511 + | os << LogIO::DEBUG1 << " !!!! WARNING !!!!! Mismatch in Csys between existing image on disk and current parameters : " << itsParentCoordSys.errorMessage() << LogIO::POST; |
512 + | } |
513 + | else |
514 + | { |
515 + | throw( AipsError( "There is a coordinate system mismatch between existing images on disk and current parameters ("+itsParentCoordSys.errorMessage()+"). If you are attempting to restart a run, please change imagename and supply the old model or mask as inputs (via the startmodel or mask parameters) so that they can be regridded to the new coordinate system before continuing. " ) ); |
516 + | } |
505 517 | } |
506 518 | }// not dosumwt |
507 519 | } |
508 520 | catch (AipsError &x){ |
509 521 | throw( AipsError("Cannot open existing image : "+imagenamefull+" : " + x.getMesg() ) ); |
510 522 | } |
511 523 | }// is table writable |
512 524 | else // table exists but not writeable |
513 525 | { |
514 526 | if(dbg)cout << "Table exists but not writeable : " << imagenamefull << " --- Open : " << Table::isOpened( imagenamefull ) << endl; |
807 819 | if(nterm>-1)multiterm=True; |
808 820 | if(nterm==-1)nterm=0; |
809 821 | |
810 822 | Directory immodel( modelname ); // +String(".model") ); |
811 823 | if( !immodel.exists() ) |
812 824 | { |
813 825 | os << "Starting model image " << modelname << " does not exist. No initial prediction will be done" << ((multiterm)?String(" for term")+String::toString(nterm) :"") << LogIO::POST; |
814 826 | return; |
815 827 | } |
816 828 | |
817 - | SHARED_PTR<PagedImage<Float> > newmodel( new PagedImage<Float>( modelname ) ); //+String(".model") ) ); |
829 + | //SHARED_PTR<PagedImage<Float> > newmodel( new PagedImage<Float>( modelname ) ); //+String(".model") ) ); |
830 + | SHARED_PTR<ImageInterface<Float> > newmodel; |
831 + | buildImage(newmodel, modelname); |
818 832 | |
819 833 | Bool hasMask = newmodel->isMasked(); /// || newmodel->hasPixelMask() ; |
820 834 | |
821 835 | if( hasMask ) |
822 836 | { |
823 837 | |
824 838 | os << "Input startmodel has an internal mask. Setting masked pixels to zero" << LogIO::POST; |
825 839 | |
826 840 | try { |
827 841 | |