Package glue :: Module lal :: Class Cache
[hide private]
[frames] | no frames]

Class Cache

source code

object --+    
         |    
      list --+
             |
            Cache

An object representing a LAL cache file. Currently it is possible to add anything to a Cache. This method should check that the thing you are adding is a CacheEntry and throw and error if it is not.

Nested Classes [hide private]
  entry_class
Instance Methods [hide private]
 
__and__(self, other)
Return a Cache containing the entries of self that are also in other.
source code
 
__getslice__(self, i, j)
x[i:j]
source code
 
__iand__(self, other)
Remove elements in self that are not in other.
source code
 
__ior__(self, other)
Append entries from other onto self without introducing (new) duplicates.
source code
 
__isub__(self, other)
Remove elements from self that are in other.
source code
 
__or__(self, other)
Return a Cache containing all entries of self and other.
source code
 
__sub__(self, other)
Return a Cache containing the entries of self that are not in other.
source code
 
checkfilesexist(self, on_missing='warn')
Runs through the entries of the Cache() object and checks each entry if the file which it points to exists or not.
source code
 
pfnlist(self)
Return a list of physical file names.
source code
 
sieve(self, ifos=None, description=None, segment=None, segmentlist=None, exact_match=False)
Return a Cache object with those CacheEntries that contain the given patterns (or overlap, in the case of segment or segmentlist).
source code
 
to_segmentlistdict(self)
Return a segmentlistdict object describing the instruments and times spanned by the entries in this Cache.
source code
 
tofile(self, fileobj)
write a cache object to the fileobj as a lal cache file
source code
 
topfnfile(self, fileobj)
write a cache object to filename as a plain text pfn file
source code
 
unique(self)
Return a Cache which has every element of self, but without duplication.
source code

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iadd__, __imul__, __init__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Methods [hide private]
 
from_urls(cls, urllist, coltype=<class 'glue.lal.LIGOTimeGPS'>)
Return a Cache whose entries are inferred from the URLs in urllist, if possible.
source code
 
fromfile(cls, fileobj, coltype=<class 'glue.lal.LIGOTimeGPS'>)
Return a Cache object whose entries are read from an open file.
source code
 
fromfilenames(cls, filenames, coltype=<class 'glue.lal.LIGOTimeGPS'>)
Read Cache objects from the files named and concatenate the results into a single Cache.
source code
Class Variables [hide private]

Inherited from list: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__getslice__(self, i, j)
(Slicling operator)

source code 

x[i:j]

Use of negative indices is not supported.

Overrides: list.__getslice__
(inherited documentation)

checkfilesexist(self, on_missing='warn')

source code 

Runs through the entries of the Cache() object and checks each entry
if the file which it points to exists or not. If the file does exist then 
it adds the entry to the Cache() object containing found files, otherwise it
adds the entry to the Cache() object containing all entries that are missing. 
It returns both in the follwing order: Cache_Found, Cache_Missed.

Pass on_missing to control how missing files are handled:
  "warn": print a warning message saying how many files
          are missing out of the total checked.
  "error": raise an exception if any are missing
  "ignore": do nothing

from_urls(cls, urllist, coltype=<class 'glue.lal.LIGOTimeGPS'>)
Class Method

source code 

Return a Cache whose entries are inferred from the URLs in urllist, if possible. PFN lists will also work; for PFNs, the path will be absolutized and "file://" and "localhost" will be assumed for the schemes and hosts.

The filenames must be in the format set forth by DASWG in T050017-00.

sieve(self, ifos=None, description=None, segment=None, segmentlist=None, exact_match=False)

source code 

Return a Cache object with those CacheEntries that contain the given patterns (or overlap, in the case of segment or segmentlist). If exact_match is True, then non-None ifos, description, and segment patterns must match exactly, and a non-None segmentlist must contain a segment which matches exactly).

It makes little sense to specify both segment and segmentlist arguments, but it is not prohibited.

Bash-style wildcards (*?) are allowed for ifos and description.

to_segmentlistdict(self)

source code 

Return a segmentlistdict object describing the instruments and times spanned by the entries in this Cache. The return value is coalesced.

unique(self)

source code 

Return a Cache which has every element of self, but without duplication. Preserve order. Does not hash, so a bit slow.