Ignore:
Timestamp:
08/20/10 18:03:31 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: read MS in reference table

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on is_scantable() and similar routine in the codes.
They are now able to recognize reference table correctly.

splitant() is working with reference table. Thus, performance
is a bit improved since deep copy is no longer necessary.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r1875 r1883  
    3737
    3838    """
    39     return (os.path.isdir(filename)
    40             and not os.path.exists(filename+'/table.f1')
    41             and os.path.exists(filename+'/table.info'))
    42 
    43 
     39    if ( os.path.isdir(filename)
     40         and os.path.exists(filename+'/table.info')
     41         and os.path.exists(filename+'/table.dat') ):
     42        f=open(filename+'/table.info')
     43        l=f.readline()
     44        f.close()
     45        #if ( l.find('Scantable') != -1 ):
     46        if ( l.find('Measurement Set') == -1 ):
     47            return True
     48        else:
     49            return False
     50    else:
     51        return False
     52##     return (os.path.isdir(filename)
     53##             and not os.path.exists(filename+'/table.f1')
     54##             and os.path.exists(filename+'/table.info'))
     55
     56def is_ms(filename):
     57    """Is the given file a MeasurementSet?
     58
     59    Parameters:
     60
     61        filename: the name of the file/directory to test
     62
     63    """
     64    if ( os.path.isdir(filename)
     65         and os.path.exists(filename+'/table.info')
     66         and os.path.exists(filename+'/table.dat') ):
     67        f=open(filename+'/table.info')
     68        l=f.readline()
     69        f.close()
     70        if ( l.find('Measurement Set') != -1 ):
     71            return True
     72        else:
     73            return False
     74    else:
     75        return False
     76   
    4477class scantable(Scantable):
    4578    """\
     
    87120        if antenna is not None:
    88121            asaplog.push("Antenna selection currently unsupported."
    89                          "Using '0'")
     122                         "Using ''")
    90123            asaplog.post('WARN')
    91124        if antenna is None:
     
    123156                    # do not reset to the default freqframe
    124157                    #self.set_freqframe(rcParams['scantable.freqframe'])
    125                 elif os.path.isdir(filename) \
    126                          and not os.path.exists(filename+'/table.f1'):
     158                #elif os.path.isdir(filename) \
     159                #         and not os.path.exists(filename+'/table.f1'):
     160                elif is_ms(filename):
     161                    self._fill([filename], unit, average, getpt, antenna)
     162                else:
    127163                    msg = "The given file '%s'is not a valid " \
    128164                          "asap table." % (filename)
    129165                    raise IOError(msg)
    130                 else:
    131                     self._fill([filename], unit, average, getpt, antenna)
    132166            elif (isinstance(filename, list) or isinstance(filename, tuple)) \
    133167                  and isinstance(filename[-1], str):
Note: See TracChangeset for help on using the changeset viewer.