ratt-ru / lwimager

standalone radio interferometric imager derived from CASA
3 stars 1 forks source link

lwimager fixed=1 niter=0 operation=csclean no longer fills MODEL_DATA #1

Closed o-smirnov closed 9 years ago

o-smirnov commented 10 years ago

In version 1.2, we had the wonderful feature of being able to use "fixed=1 niter=0 operation=csclean" to populate the MODEL_DATA column with visibilities computed from an pre-existing model image.

(pyxis imager.predict_vis takes advantage of this, for example.)

As of the current version this no longer fills the MODEL_DATA column (although the status messages indicate everything is going on as usual).

Furthermore, telling it to continue clean from a fixed model (niter=1000 for example) causes the whole thing to bomb out ingloriously:

(/build/buildd/lwimager-1.3.0/synthesis/MeasurementComponents/CSCleanImageSkyModel.cc : 467) Failed AlwaysAssert imagePtr
o-smirnov commented 10 years ago

Possible solution to first problem: create Imager object with useModel=True at this line:

https://github.com/ska-sa/lwimager/blob/4df398bd0879cae0153931bfec531ef5355f0530/synthesis/apps/lwimager.cc#L487

o-smirnov commented 10 years ago

Fixed this -- note that I had to take out a conditional in CSCleanImageSkyModel as well (somebody seems to have explicitly killed this functionality, naughty naughty!)

IanHeywood commented 10 years ago

Perhaps related to CASA's clean task no longer storing the inversion of the clean component model in the MODEL_DATA column by default...

o-smirnov commented 10 years ago

Yeah it is related I guess -- they have a usescratch keyword for that in the task, and the default is False. I've added a fillmodel option to lwimager as of this fix (will show up in 1.3.1 release), use fillmodel=True to make sure the MODEL_DATA column is filled.

IanHeywood commented 10 years ago

I guess all the hollering about the MS format being a data hog finally found some traction. CASA workaround is the ft task with usescratch=True, for the record.

o-smirnov commented 10 years ago

Ahh that's good -- I plan to wrap CASA in pyxis next (to help preserve my sanity), this sort of stuff is exactly what I need to know!

IanHeywood commented 10 years ago

It already works pretty well from within Pyxis via tricks like this:

def imageMS(msName,imageName,dirty,fixedbeam):
    cc = 'clean('
    cc += 'vis="'+msName+'",'
    cc += 'imagename="'+imageName+'",'
    cc += 'mode="mfs",'
    cc += 'gridmode="widefield",'
    cc += 'wprojplanes=64,'
    if dirty:
        cc+='niter=0,'
    else:
        cc += 'niter=2500,'
    cc += 'imsize=[2240,2240],'
    cc += 'cell=["12.0arcsec"],'
    cc += 'multiscale=[],'
    cc += 'weighting="briggs",'
    if fixedbeam:
        cc += 'restoringbeam = ["2.097649468316E-02deg","1.559506416321E-02deg",
"-1.779342346191E+02deg"],' 
    cc += 'robust=0.0)\n'
    cc += 'exportfits(imagename="'+imageName+'.image",fitsimage="'+imageName+'.fits"
,overwrite=True)\n'
    cc += 'exportfits(imagename="'+imageName+'.psf",fitsimage="'+imageName+'.psf.fit
s",overwrite=True)'
    std.runcasapy(cc)
    deleteExtensions = ['.image','.flux','.residual','.model','.psf']
    for ext in deleteExtensions:
        syscall = 'rm -rf '+imageName+ext
        os.system(syscall)

but just being able to call the CASA routines would be neat. Ping me if I can help.

o-smirnov commented 9 years ago

Oops, not quite fixed yet...

o-smirnov commented 9 years ago

@IanHeywood thanks for the ft tip -- it's lightning fast, but I have a nasty suspicion it does not apply w-projection, just from looking at the status messages...

Anyway, this ought to work in 1.3.2 again. In the meantime, let me check if I can get the clean task to do a similarly sensible thing. UPDATE: no I can't, bless you CASA, can't handle IQUV polarized models...