Differences between revisions 2 and 3
Revision 2 as of 2018-01-11 11:13:43
Size: 2529
Editor: PJJung
Comment:
Revision 3 as of 2018-01-11 11:14:11
Size: 2543
Editor: PJJung
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== lalframe Cache maker tool == == lalframe Cache maker tool using python ==
 

lalframe Cache maker tool using python

lalframe

LALFrame is LAL wrapping of the LIGO/Virgo Frame library and, is necessary to read / write GWF files.

LALFrame Documentation

lalframe Chache file structure

K K1_C 1195700000 32 file://localhost/frames/full/11957/K-K1_C-1195700000-32.gwf
K K1_C 1195700032 32 file://localhost/frames/full/11957/K-K1_C-1195700032-32.gwf
K K1_C 1195700064 32 file://localhost/frames/full/11957/K-K1_C-1195700064-32.gwf
K K1_C 1195700096 32 file://localhost/frames/full/11957/K-K1_C-1195700096-32.gwf
K K1_C 1195700128 32 file://localhost/frames/full/11957/K-K1_C-1195700128-32.gwf
K K1_C 1195700160 32 file://localhost/frames/full/11957/K-K1_C-1195700160-32.gwf
.
.
.

mkCache.py

This code creates the Cache file every 300 seconds.

To use this Python tool continuously in the background, run it in the following way.

$ nohup python -u mkCache.py &

code in KAGRA mine

[detchar@k1det1~]$ cd /home/detchar/Cache
[detchar@k1det1 Cache]$ ls
K1-Cache.cache  mkCache.py  nohup.out

   1 # Coded by Jung Pil-Jong   ::  scilavinka.aptunus@gmail.com
   2 
   3 from os import listdir
   4 from numpy import arange
   5 import time
   6 
   7 
   8 ########## Making gwf Cache file ##########
   9 
  10 def job() :
  11 
  12     basedir = "/frames/full/"
  13 
  14     ls_out = []
  15 
  16     full_listdir = sorted(listdir(basedir))
  17     full_listdir.remove('99999')
  18     gwf_listdir = []
  19 
  20     for n in range(len(full_listdir)) :
  21         try :
  22             if type(int(full_listdir[n])) == int and int(full_listdir[n]) < 99999 :
  23                 gwf_listdir.append(full_listdir[n])            
  24             else :
  25                 pass
  26         except ValueError as err :
  27             pass
  28         
  29     gwf_listdir.sort()
  30 
  31     for m in range(len(gwf_listdir)) :
  32         subdir = basedir + str(gwf_listdir[m])
  33         gwf_lists = sorted(listdir(subdir)) 
  34         for i in range(len(gwf_lists)) :
  35             if gwf_lists[i][-3:] == 'gwf' :
  36                ls_out.append(' '.join( gwf_lists[i].split('.')[0].split('-') ) + ' file://localhost'+subdir+'/'+gwf_lists[i] )
  37             else :
  38                 pass
  39     ls_out.sort()
  40 
  41     f = open('./K1-Cache.cache', 'w')
  42     f.write('\n'.join(ls_out))
  43     f.close()
  44 
  45 
  46 ########## Auto run cache file maker during 60 second ##########
  47 
  48 if __name__ == '__main__' :
  49     while True :
  50         job()
  51         time.sleep(300)

KAGRA/Subgroups/DET/gwpy/cache (last edited 2018-01-18 13:53:03 by PJJung)