== 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. [[http://software.ligo.org/docs/lalsuite/lalframe/|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 & }}} Add the following code, and if you login after the reboot, the program will run. {{{ $ sudo vi ~/.profile (sleep 10 && /usr/local/bin/python /home/detchar/Cache/mkcache.py ) & # Insert this line }}} BUT, If the latest cache file is not created, re-run mkCache.py using the nohup code above. === Cache file direction in KAGRA k1det1 === {{{ [detchar@k1det1~]$ cd /home/detchar/Cache [detchar@k1det1 Cache]$ ls K1-Cache.cache mkCache.py nohup.out }}} === Cache file direction in KAGRA seikai === In seikai, only the ikagra data cache is stored. {{{ [user@seikai~]$ cd /home/detchar/Cache/ikagra_cache/ [user@seikai Cache]$ ls ikagra_cachefile.cache mkCache.py }}} === Code of mkCache.py in k1det1 === {{{ #!python # Coded by Jung Pil-Jong :: scilavinka.aptunus@gmail.com from os import listdir import time ########## Making gwf Cache file ########## def job() : basedir = "/frames/full/" ls_out = [] full_listdir = sorted(listdir(basedir)) full_listdir.remove('99999') gwf_listdir = [] for n in range(len(full_listdir)) : try : if type(int(full_listdir[n])) == int and int(full_listdir[n]) < 99999 : gwf_listdir.append(full_listdir[n]) else : pass except ValueError as err : pass gwf_listdir.sort() for m in range(len(gwf_listdir)) : subdir = basedir + str(gwf_listdir[m]) gwf_lists = sorted(listdir(subdir)) for i in range(len(gwf_lists)) : if gwf_lists[i][-3:] == 'gwf' : ls_out.append(' '.join( gwf_lists[i].split('.')[0].split('-') ) + ' file://localhost'+subdir+'/'+gwf_lists[i] ) else : pass ls_out.sort() f = open('./K1-Cache.cache', 'w') f.write('\n'.join(ls_out)) f.close() ########## Auto run cache file maker during 300 second ########## if __name__ == '__main__' : while True : job() time.sleep(300) }}}