Example #1
0
 def on_return(self):
     ''' Called when the ms filename LineEdit widget gets a carriage-return.
         Trys to connect to the ms and return some info (no data read at this time)
     '''
     self.fname = self.msentry.text()
     self.msdata = None
     try:
         if self.ms:
             self.ms.close()
         else:
             self.ms = mstool()
         self.ms.open(self.fname)
         self.msentry.setText(self.fname)
         lines = pr_summary(self.ms)
         self.infoEdit.setPlainText('\n'.join(lines))
     except:
         self.statusBar.showMessage('Filename is not a valid ms', 2000)
         self.fname = '<Select or enter a valid ms filename>'
         self.msentry.setText(self.fname)
         self.infoEdit.setPlainText('')
     try:
         t1str, t2str = lines[2].replace('-', '/').split(': ')[1:3]
         trange = t1str[0:10] + '/' + t1str[11:21] + '~' + t2str[
             0:10] + '/' + t2str[11:21]
     except:
         trange = '<unset>'
     try:
         spwstr = lines[-1].strip().split(' ')[0]
         spw = '0~' + spwstr
     except:
         spw = '<unset>'
     self.trangeEdit.setText(trange)
     self.spwEdit.setText(spw)
     self.baselineEdit.setText('0~12&0~12')
     self.stokesEdit.setText('XX')
     self.uvrangeEdit.setText('0~2km')
     if spwstr == '30':
         self.ignore_gaps.setChecked(True)
     else:
         self.ignore_gaps.setChecked(False)
Example #2
0
from datetime import datetime
from math import *
# import jdutil
import bisect
try:
    ## CASA version < 6
    from taskinit import ms, tb, qa, iatool, rgtool
except:
    ## CASA version >=6
    from casatools import table as tbtool
    from casatools import ms as mstool
    from casatools import quanta as qatool
    from casatools import regionmanager as rgtool
    from casatools import image as iatool
    tb = tbtool()
    ms = mstool()
    qa = qatool()
    ia = iatool()
from astropy.time import Time
import sunpy
# check sunpy version
sunpyver = int(sunpy.__version__.split('.')[0])
if sunpyver <= 1:
    from sunpy import sun
else:
    from sunpy.coordinates import sun
import astropy.units as u
import warnings
from suncasa.utils import fitsutils as fu

try: