Changeset 2286 for trunk/python


Ignore:
Timestamp:
09/02/11 19:05:11 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No (performance tuning)

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: a parameter "filename" is added to Scantable::summary. scantable.summary doesn't return a string anymore

Test Programs: sdlist unittest/ scantable.summary("summary.txt")

Put in Release Notes: Yes

Module(s): sdlist, asap.summary

Description:

scantable.summary is very slow for large data sets (in row number) often outputted
by modern telescopes. It takes > 1.5 hours to list OTF raster scan with 350,000 rows.

This was because, the methods accumulates the whole text string (~700,000 lines) and
returns it as a string. Once the summary string exceed several tens thousands lines,
elapse time increases non-linearly, may be because very massive output string starts
to overweigh the memory.

I updated scantable.summary so that it flushes the summary string more often to file/logger.
After the modification, scantable.summary could list the data mentioned above in ~ 7 minutes.
The side effect of it is that scantable.summary doesn't return summary string anymore.
(But people may not happy with sub-million lines of string anyway.)


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2277 r2286  
    445445
    446446        """
    447         info = Scantable._summary(self)
     447#         info = Scantable._summary(self)
    448448        if filename is not None:
    449449            if filename is "":
     
    451451            from os.path import expandvars, isdir
    452452            filename = expandvars(filename)
    453             if not isdir(filename):
    454                 data = open(filename, 'w')
    455                 data.write(info)
    456                 data.close()
    457             else:
     453#             if not isdir(filename):
     454#                 data = open(filename, 'w')
     455#                 data.write(info)
     456#                 data.close()
     457#             else:
     458            if isdir(filename):
    458459                msg = "Illegal file name '%s'." % (filename)
    459460                raise IOError(msg)
    460         return page(info)
     461        else:
     462            filename = ""
     463        Scantable._summary(self, filename)
     464#         return page(info)
    461465
    462466    def get_spectrum(self, rowno):
Note: See TracChangeset for help on using the changeset viewer.