Package pylal :: Module frutils :: Class AutoqueryingFrameCache
[hide private]
[frames] | no frames]

Class AutoqueryingFrameCache

source code

object --+    
         |    
FrameCache --+
             |
            AutoqueryingFrameCache


This subclass of FrameCache will query ligo_data_find automatically,
so no LAL-cache files are required. Limitation: you'll need one instance
per frame type.

Constructor:
    AutoqueryingFrameCache(frametype, hostPortString=None, scratchdir=None,
        verbose=False)

Inputs:
    frametype is the type of GWF frame you seek (e.g. RDS_R_L1).
    hostPortString is the name of the LDR server and optionally,
        with colon separation, the port (e.g. ldr.ligo.caltech.edu)
    scratchdir determines where to locally cache frames. If None, no
        caching is performed.

Example:
>>> from pylal import frutils
>>> d = frutils.AutoqueryingFrameCache(frametype="H1_RDS_C03_L2", scratchdir="/tmp", verbose=True)
>>> data = d.fetch("H1:LSC-STRAIN", 861417967, 861417969)
Copying /Users/nvf/temp/H-H1_RDS_C03_L2-861417967-128.gwf -->
          /tmp/H-H1_RDS_C03_L2-861417967-128.gwf.
>>> print(data)
[  1.68448009e-16   1.69713183e-16   1.71046196e-16 ...,   1.80974629e-16
   1.80911765e-16   1.80804879e-16] {'dt': 6.103515625e-05, 'segments': [segment(861417967, 861417969)], 'comments': [], 'name': 'H1:LSC-STRAIN'}
>>> exit()
Removing /tmp/H-H1_RDS_C03_L2-861417967-128.gwf.

Using AutoqueryingFrameCache outside of LDG clusters, using Caltech as a
gateway:
 * Just the first time you do this procedure: "sudo mkdir /data && sudo chown
   albert.einstein /data" (replace albert.einstein with your local username;
   /data may be different for different clusters)
 * Set the LIGO_DATAFIND_SERVER environment variable to ldr.ligo.caltech.edu
   (or the LDR server of the LDG cluster nearest you)
 * Use "sshfs -o ssh_command=gsissh
   albert.einstein@ldas-pcdev1.ligo.caltech.edu:/data /data" (replace
   albert.einstein with your cluster username)
 * Use "umount /data" when you're done. Unmounting cleanly will help prevent
   headaches the next time you want to set this up.
    

Instance Methods [hide private]
 
__init__(self, frametype, hostPortString=None, scratchdir=None, verbose=False)
Initializes interface to frame data.
source code
 
_query(self, channel, start, end)
Do we know where the frame file is?
source code

Inherited from FrameCache: __del__, add_cache, fetch, unfetch

Inherited from FrameCache (private): _fetch, _unfetch

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, frametype, hostPortString=None, scratchdir=None, verbose=False)
(Constructor)

source code 

Initializes interface to frame data. See .__class__.__doc__

Overrides: object.__init__
(inherited documentation)

_query(self, channel, start, end)

source code 

Do we know where the frame file is?

Overrides: FrameCache._query