Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

def wtstat needs ms.selectinit(reset=True) inside loop over more than 1 spectral window #1

Open
adeleplunkett opened this issue Sep 3, 2018 · 4 comments

Comments

@adeleplunkett
Copy link
Contributor

In def wtstat, I believe that there needs to be a line ms.selectinit(reset=True) inside the loop over several spectral windows. Otherwise, anytime I have a dataset with several spectral windows, I get an error
2018-09-03 13:04:31 WARN ms::selectinit selectinit failed for datadescid 1

# Define stat outputs
# -------------------
def wtstat(mslist,comment=''):
    print "%-4s%18s %4s %4s %4s %8s %8s %12s %12s %12s %12s" \
        % (comment,'name','spw#','npnt','npol','nvis',\
               'fwidth','min','max','mean','std')

    for ims in mslist:

        ms.open(ims,nomodify=True)          # open MS
        **ms.selectinit(reset=True)           # all spws**
        spwinfo= ms.getspectralwindowinfo() # get spw info
        spwlist= spwinfo.keys()             # list of SPWs

        for ispw in spwlist:                # get SPW info and WEIGHT
            **ms.selectinit(reset=True)           # all spws**
            spwid     = spwinfo[ispw]['SpectralWindowId']
            numchan   = spwinfo[ispw]['NumChan']
            chan1freq = spwinfo[ispw]['Chan1Freq'] / 1.0e9 # GHz
            chanwidth = spwinfo[ispw]['ChanWidth'] / 1.0e9 # GHz
@adeleplunkett
Copy link
Contributor Author

This should also be the case in L1348, called when using tp2vispl:

    # Loop over SPWs
    # --------------
    for ispw in spwlist:

        # SPW info and set constraints to reduce data to load
        ms.selectinit(reset=True)               # all spws

@adeleplunkett
Copy link
Contributor Author

Check near line L1000 also, when oper == 'beammatch':

    # Sumup the weights of INT visibilities [/GHz/pnt/arcmin2]
    # --------------------------------------------------------
    sumw = 0.0
    for ims in msINT:
        ms.open(ims,nomodify=True)              # open MS
        ms.selectinit(reset=True)               # all spws
        spwinfo   = ms.getspectralwindowinfo()  # get spw info
        spwlist   = spwinfo.keys()              # list of SPWs
        iarray    = guessarray(ims)             # array name [e.g. ALMA12]
        fwhm0 = t2v_arrays[iarray]['fwhm100']   # beam FHWM @100GHz[arcsec]
        for ispw in spwlist:                    # loop over SPWs
            ms.selectinit(reset=True)               # all spws
            spwid     = spwinfo[ispw]['SpectralWindowId']  # spw #

@teuben
Copy link
Collaborator

teuben commented Sep 3, 2018

In the development version there are numerous examples, they all highly splitting by SPW, partially because that's how we usually get the data. So Im not surprised these issues come up, we simply haven't been using it in this mode.

Do you have a good use case where you need to run it over spw's?

@adeleplunkett
Copy link
Contributor Author

In the datasets I have, then each execution is assigned a different spectral window (and therefore the concat *.ms file has several SPWs). All should have the same frequency. But, the tp2vispl and tp2viswt will not work with more than 1 "SPW" in the .ms file, at least that's my experience. So, the option is either to take only the first SPW, or actually loop over all of them. Right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants