def scans(self):
'''Gets the scan_info and caches it, to save extra trips to the server'''
if not self._scans:
self.crl.setopt(pycurl.HTTPGET, True)
self.crl.setopt(pycurl.URL, str(self.data_file + '/scan_info'))
# the scan_name is the URL of that scan, which is just the time
scan_url = self.data_file + '/scans/%s'
response = cStringIO.StringIO()
self.crl.setopt(pycurl.WRITEFUNCTION, response.write)
#self.crl.perform()
for i in range(5):
#print 'scans %d' % i
self.crl.perform()
if response.getvalue():
break
scans = response.getvalue().splitlines()
self._scans = []
for scan_line in scans:
time,mz,scan_type,scan_mode = scan_line.split()
self._scans.append((float(time),
float(mz),
scan_url % time,
scan_type.upper(),
scan_mode.lower()))
self._scans.sort()
return self._scans
评论列表
文章目录