Commits
339 339 | if set(spwlist) <= set(subms_spws): |
340 340 | isSelected = True |
341 341 | |
342 342 | return isSelected |
343 343 | |
344 344 | def __getScanIds(self, msfile, scansel): |
345 345 | """ Get the scan IDs of the scan selection. |
346 346 | Keyword arguments: |
347 347 | msfile -- MS or MMS name |
348 348 | scansel -- scan selection |
349 - | |
349 + | |
350 350 | Returns a list of the scan IDs (list of strings) or [] in case of failure. |
351 351 | """ |
352 352 | scanlist = [] |
353 353 | if scansel.isspace() or scansel.__len__() == 0: |
354 354 | # Get all the scan ids |
355 355 | mymsmd = msmetadata( ) |
356 356 | mymsmd.open(msfile) |
357 357 | scans = mymsmd.scannumbers() |
358 358 | mymsmd.close() |
359 359 | scanlist = map(str,scans) |
360 360 | else: |
361 - | try: |
361 + | myms = ms() |
362 + | try: |
362 363 | myms.open(msfile) |
363 364 | myms.msselect({'scan':scansel}) |
364 365 | scans = myms.msselectedindices()['scan'] |
365 366 | scanlist = map(str,scans) |
366 - | myms.close() |
367 367 | except: |
368 - | myms.close() |
369 368 | scanlist = [] |
370 - | |
369 + | finally: |
370 + | myms.close() |
371 + | |
371 372 | return scanlist |
372 373 | |
373 374 | def __isScanContained(self, subms, scanlist, tbin): |
374 375 | """ Check if subMS contains all the selected scans |
375 376 | and if the duration of the subMS scans is larger or |
376 377 | equal to the timebin. |
377 378 | |
378 379 | Keyword arguments: |
379 380 | subms -- subMS name |
380 381 | scanlist -- list with selected scans for the MMS |