code: def sdm2ms(sdmfile, msfile, scan, inttime='0'):
      
  
      # fill ms file
      if os.path.exists(msfile):
          logger.debug('%s already set.' % msfile)
      else:
          logger.info('No %s found. Creating anew.' % msfile)
          if inttime != '0':
              logger.info('Filtering by int time.')
              call(['asdm2MS', '--ocm', 'co',
                               '--icm', 'co', '--lazy', '--scans',
                               scan, sdmfile, msfile + '.tmp'])
              cfg = tasklib.SplitConfig()  # configure split
              cfg.vis = msfile + '.tmp'
              cfg.out = msfile
              cfg.timebin = inttime
              cfg.col = 'data'
              cfg.antenna = '*&*'  # discard autos
              tasklib.split(cfg)  # run task
              # clean up
              rmtree(msfile+'.tmp')
          else:
              call(['asdm2MS', '--ocm', 'co',
                               '--icm', 'co', '--lazy', '--scans',
                               scan, sdmfile, msfile])
  
      return msfile
docs: Converts sdm to ms format for a single scan.
      msfile defines the name template for the ms. Should end in .ms,
      but "s<scan>" will be put in.
      scan is string of (sdm counted) scan number.
      inttime is string to feed to split command.
      gives option of integrated data down in time.