def get_scan_by_time(self, time): """Retrieve the scan object for the specified scan time. This internally calls :meth:`get_scan_by_id` which will use its cache. Parameters ---------- time : float The time to get the nearest scan from Returns ------- Scan """ if time < self._first_scan_time: time = self._first_scan_time elif time > self._last_scan_time: time = self._last_scan_time scan_number = self._scan_time_to_scan_number(time) try: return self._scan_cache[scan_number] except KeyError: package = ThermoRawScanPtr(scan_number) scan = Scan(package, self) self._scan_cache[scan_number] = scan return scan
def get_scan_by_id(self, scan_id): """Retrieve the scan object for the specified scan id. If the scan object is still bound and in memory somewhere, a reference to that same object will be returned. Otherwise, a new object will be created. Parameters ---------- scan_id : str The unique scan id value to be retrieved Returns ------- Scan """ scan_number = int(str(scan_id).replace(_id_template, '')) - 1 try: return self._scan_cache[scan_number] except KeyError: package = ThermoRawScanPtr(scan_number) if not package.validate(self): raise KeyError(str(scan_id)) scan = Scan(package, self) self._scan_cache[scan_number] = scan return scan
def get_scan_by_index(self, index): """Retrieve the scan object for the specified scan index. This internally calls :meth:`get_scan_by_id` which will use its cache. Parameters ---------- index: int The index to get the scan for Returns ------- Scan """ scan_number = int(index) try: return self._scan_cache[scan_number] except KeyError: package = ThermoRawScanPtr(scan_number) if not package.validate(self): raise IndexError(index) scan = Scan(package, self) self._scan_cache[scan_number] = scan return scan
def get_scan_by_index(self, index): """Retrieve the scan object for the specified scan index. This internally calls :meth:`get_scan_by_id` which will use its cache. Parameters ---------- index: int The index to get the scan for Returns ------- Scan """ scan_number = int(index) try: return self._scan_cache[scan_number] except KeyError: package = AgilentDScanPtr(scan_number) scan = Scan(package, self) self._cache_scan(scan) return scan
def _make_scan(self, data): return Scan(data, self)