rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
flines[:,i]=asin(flines[:,i])
flines[:,i]=arcsin(flines[:,i])
def loadDataFile(filename): print filename infile=open(filename,'r') formatstr=infile.readline().lstrip() header=formatstr.split() llines=[] import re dec=re.compile(r'[^\d.-]+') for line in infile: sline=line.split() proceed=True for s in sline: if dec.search(s) is not None: print 'Warning! Ignoring non-numeric data a...
flines[:,i]=acos(flines[:,i])
flines[:,i]=arccos(flines[:,i])
def loadDataFile(filename): print filename infile=open(filename,'r') formatstr=infile.readline().lstrip() header=formatstr.split() llines=[] import re dec=re.compile(r'[^\d.-]+') for line in infile: sline=line.split() proceed=True for s in sline: if dec.search(s) is not None: print 'Warning! Ignoring non-numeric data a...
def add(self, *args): packing.Bin.add(self, *args)
def add(self, cache_entry): packing.Bin.add(self, cache_entry, cache_entry.to_segmentlistdict())
def add(self, *args): packing.Bin.add(self, *args) self.extent = self.size.extent_all() return self
new.add(cache_entry, cache_entry.to_segmentlistdict())
new.add(cache_entry)
def pack(self, cache_entry): """ Find all bins in which this glue.lal.CacheEntry instance belongs, merge them, and add this cache entry to the result. Create a new bin for this cache entry if it does not belong in any of the existing bins.
splits = [-segments.infinity()] + [lsctables.LIGOTimeGPS(origbin.extent[0] + i * float(origbin.extent[1] - origbin.extent[0]) / n) for i in range(1, n)] + [+segments.infinity()]
extents = [-segments.infinity()] + [lsctables.LIGOTimeGPS(origbin.extent[0] + i * float(abs(origbin.extent)) / n) for i in range(1, n)] + [+segments.infinity()]
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
print >>sys.stderr, "\tsplitting cache spanning %s at %s" % (str(origbin.extent), ", ".join(str(split) for split in splits[1:-1])) splits = [segments.segmentlist([segments.segment(*bounds)]) for bounds in zip(splits[:-1], splits[1:])] splits = [segments.segmentlistdict.fromkeys(origbin.size, seglist) for seglist in spl...
print >>sys.stderr, "\tsplitting cache spanning %s at %s" % (str(origbin.extent), ", ".join(str(extent) for extent in extents[1:-1])) extents = [segments.segment(*bounds) & origbin.extent for bounds in zip(extents[:-1], extents[1:])]
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
for split in splits:
for extent in extents:
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
newbins[-1].size = origbin.size & split for key in tuple(newbins[-1].size): if not newbins[-1].size[key]: del newbins[-1].size[key] newbins[-1].extent = newbins[-1].size.extent_all() for bin in newbins: bin_extent_plus_max_gap = bin.extent.protract(cafepacker.max_gap)
extent_plus_max_gap = extent.protract(cafepacker.max_gap)
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
if cache_entry.segment.disjoint(bin_extent_plus_max_gap):
if cache_entry.segment.disjoint(extent_plus_max_gap):
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
if cache_entry_segs.intersects_segment(bin.extent):
if cache_entry_segs.intersects_segment(extent):
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
bin.objects.append(cache_entry)
newbins[-1].add(cache_entry)
def split_bins(cafepacker, extentlimit, verbose = False): """ Split bins in CafePacker so that each bin has an extent no longer than extentlimit. """ # # loop over all bins in cafepacker.bins # idx = 0 while idx < len(cafepacker.bins): # # retrieve bin # origbin = cafepacker.bins[idx] # # how many pieces? if bin d...
injection_area=bin_size*i
injection_area=bin_size*(i+1)
def _greedy_bin(greedyHist,greedyPoints,injection_bin_index,bin_size,Nsamples,confidence_levels): """ An interal function representing the common, dimensionally-independent part of the greedy binning algorithms. """ #Now call confidence level C extension function to determine top-ranked pixels (injectionconfidence,top...
for (ifo,epoch) in ifoEpochList:
except: backgroundPickle=False sys.stderr.write("Error importing the pickle file! %s\n"\ %(pickleLocale)) return for (ifo,epoch) in ifoEpochList:
def createDQbackground(self,ifoEpochList=list(),pickleLocale=None): """ Two inputs a list of tuples (ifo,epochname) for each instrument. Also a place to save the potential pickle to for quick access later. """ if type(ifoEpochList) != type(list()): raise Exception, \ "Invalid input argument ifoEpochList,%s type(%s)"\ %...
generated background %s"%self.__backgroundDict__["ifoepoch"] except: backgroundPickle=False sys.stderr.write("Error importing the pickle file!\n") if os.access(os.path.split(pickleLocal)[0],os.W_OK): os.path.rename(pickleLocale,pickleLocale+".corrupt")
generated background expected %s got %s"%(\ self.__backgroundDict__["ifoepoch"], ifoEpochList)
def createDQbackground(self,ifoEpochList=list(),pickleLocale=None): """ Two inputs a list of tuples (ifo,epochname) for each instrument. Also a place to save the potential pickle to for quick access later. """ if type(ifoEpochList) != type(list()): raise Exception, \ "Invalid input argument ifoEpochList,%s type(%s)"\ %...
ifoEpochList=[(x,getRunEpoch(self.triggerTime,x)) for x in uniqIfos]
ifoEpochList=[(x,getRunEpoch(self.triggerTime,x)) for x in self.ifos]
def estimateDQbackground(self): """ This method looks at the self.resultlist inside the instance. Using this and 1000 generated time stamp it tabulates a ranking of flag prevelance, binomial probability 'p' """ if len(self.resultList) < 1: self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__bac...
sys.stderr.write("Aborting tabulate of binomial P\n")
sys.stderr.write("Aborting tabulation of binomial P\n")
def estimateDQbackground(self): """ This method looks at the self.resultlist inside the instance. Using this and 1000 generated time stamp it tabulates a ranking of flag prevelance, binomial probability 'p' """ if len(self.resultList) < 1: self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__bac...
for myIfo,flagList in seenFlags.iteritems():
for myIfo in seenFlags.keys():
def estimateDQbackground(self): """ This method looks at the self.resultlist inside the instance. Using this and 1000 generated time stamp it tabulates a ranking of flag prevelance, binomial probability 'p' """ if len(self.resultList) < 1: self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__bac...
for backgroundTime,backgroundFlags in \ self.__backgroundDict__[myIfo.strip()].iteritems(): tmpFlags.extend([name for ifo,name,ver,com,start,stop in backgroundFlags]) if myIfo not in self.__backgroundResults__.keys(): self.__backgroundResults__[myIfo]=dict() for myFlag in seenFlags[myIfo]: self.__backgroundResults__[my...
if myIfo.strip() not in self.__backgroundDict__.keys(): if myIfo not in self.__backgroundResults__.keys(): self.__backgroundResults__[myIfo]=dict() for outsideFlag in seenFlags[myIfo]: self.__backgroundResults__[myIfo][outsideFlag]=float(-0.0) else: for backgroundTime,backgroundFlags in \ self.__backgroundDict__[myIfo...
def estimateDQbackground(self): """ This method looks at the self.resultlist inside the instance. Using this and 1000 generated time stamp it tabulates a ranking of flag prevelance, binomial probability 'p' """ if len(self.resultList) < 1: self.__backgroundResults__=list() self.__backgroundTimesDict__=dict() self.__bac...
tableString+=rowString%(myColor,ifo,name,version,start,offset1,stop,offset2,size)
tableString+=rowString%(myColor,ifo,name,version,\ start,offset1,stop,offset2,\ size,myBackgroundRank,myCategory)
def generateHTMLTable(self,tableType="BOTH"): """ Return a HTML table already formatted using the module MARKUP to keep the HTML tags complient. This method does nothing but return the result of the last call to self.fetchInformation() The flag names associated with LIGO will have links to the channel wiki in them als...
tableString+=emptyRowString%myColor
tableString+=emptyRowString
def generateMOINMOINTable(self,tableType="BOTH"): """ Return a MOINMOIN table. """ ligo=["L1","H1","H2","V1"] channelWiki="https://ldas-jobs.ligo.caltech.edu/cgi-bin/chanwiki?%s" if self.triggerTime==int(-1): return "" myColor="grey" tableString="" titleString="" emptyRowString="" rowString="" for i,col in enumerate(se...
myAngle=arcsin(dY/dX)
myAngle=arctan(dY/dX)
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
myAngle=pi-arcsin(dY/dX)
myAngle=pi-arctan(dY/dX)
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
myAngle=arcsin(dY/dX)+pi
myAngle=arctan(dY/dX)+pi
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
myAngle=(2.0*pi)-arcsin(dY/dX)
myAngle=(2.0*pi)-arctan(dY/dX)
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
type="string",default=None,\
type="string",default="dummy",\
def convert2DHistTo3ColVectors(myMatrix,xBins=None,yBins=None): """ Create three vectors X,Y,Z for ease of use in functs like contour, and scatter instead of imshow! If [x,y]Bins==None use bin index for X, Y Input matrix assumed square!! """ if xBins==None: xBins=range(len(myMatrix)) if yBins==None: yBins=range(len(myM...
origData=dict() origData["beam"]=beamSpigot.getDataStream(beamName,gpsStart,gpsEnd)
origData=dict()
def convert2DHistTo3ColVectors(myMatrix,xBins=None,yBins=None): """ Create three vectors X,Y,Z for ease of use in functs like contour, and scatter instead of imshow! If [x,y]Bins==None use bin index for X, Y Input matrix assumed square!! """ if xBins==None: xBins=range(len(myMatrix)) if yBins==None: yBins=range(len(myM...
tmpData=beamSpigot.getDataStream(myLabel[myKey],gpsA,gpsB) mySnipData[myKey]=interp(mySnipData["time"], getTimeStamps(tmpData), tmpData)
if beamName == "dummy" and myKey == "beam": mySnipData[myKey]=ones(size(mySnipData["time"])) else: tmpData=beamSpigot.getDataStream(myLabel[myKey],gpsA,gpsB) mySnipData[myKey]=interp(mySnipData["time"], getTimeStamps(tmpData), tmpData)
def convert2DHistTo3ColVectors(myMatrix,xBins=None,yBins=None): """ Create three vectors X,Y,Z for ease of use in functs like contour, and scatter instead of imshow! If [x,y]Bins==None use bin index for X, Y Input matrix assumed square!! """ if xBins==None: xBins=range(len(myMatrix)) if yBins==None: yBins=range(len(myM...
size=50,color='white')
size=starSize,color='white')
def convert2DHistTo3ColVectors(myMatrix,xBins=None,yBins=None): """ Create three vectors X,Y,Z for ease of use in functs like contour, and scatter instead of imshow! If [x,y]Bins==None use bin index for X, Y Input matrix assumed square!! """ if xBins==None: xBins=range(len(myMatrix)) if yBins==None: yBins=range(len(myM...
facecolor=None,\
def convert2DHistTo3ColVectors(myMatrix,xBins=None,yBins=None): """ Create three vectors X,Y,Z for ease of use in functs like contour, and scatter instead of imshow! If [x,y]Bins==None use bin index for X, Y Input matrix assumed square!! """ if xBins==None: xBins=range(len(myMatrix)) if yBins==None: yBins=range(len(myM...
for offset_vector in self.offset_vectors:
for offset_vector in cafepacker.offset_vectors:
def split_bins(cafepacker, extentlimit): """ Split bins of stored in CafePacker until each bin has an extent no longer than extentlimit. """ # # loop overall the bins in cafepacker.bins. we pop items out of # cafepacker.bins and append new ones to the end so need a while loop # checking the extent of each bin in cafep...
num_days = int(round((duration)/86400))
num_days = int(round((int(duration))/86400))
def daily_ihope_cache(start,end,ifo,cluster=None): """ Generates cache list of daily ihope INSPIRAL xml files for give ifo and clustering (None,'30ms','100ms', or '16s') between start and end time """ #== daily path ihope_daily_path = '/archive/home/cbc/ihope_daily' #== set clustering tag if cluster==None or cluster....
cellString=cellString+" %s "%self.linkedRemoteImage(thumbs[ifo][myOmegaIndex],
cellString=cellString+" %s "%self.linkedRemoteImage(thumbs[ifo][myOmegaIndexT],
def insertAnalyzeQscanTable(self, images=None, thumbs=None, indexes=None, imagesAQ=None, thumbsAQ=None, indexesAQ=None, channelRanks=None): """ Insert a multiple IFO table with 5 cols with the AQ underneath this depends on the numer of IFO keys in indexes dictionary. The option channelRanks is not required to change th...
cellString=cellString+" %s "%self.linkedRemoteImage(thumbsAQ[ifo][myAQIndex],
cellString=cellString+" %s "%self.linkedRemoteImage(thumbsAQ[ifo][myAQIndexT],
def insertAnalyzeQscanTable(self, images=None, thumbs=None, indexes=None, imagesAQ=None, thumbsAQ=None, indexesAQ=None, channelRanks=None): """ Insert a multiple IFO table with 5 cols with the AQ underneath this depends on the numer of IFO keys in indexes dictionary. The option channelRanks is not required to change th...
self.FAR = 99
self.FAR = -1
def __init__(self): """ here are all the things we need """ #start with data needed for every coinc self.ifo_list = [] self.ifo_coincs = [] self.snr = {} self.gps = {} self.eff_distances = {} self.mass1 = {} self.mass2 = {} self.time = None self.FAR = 99 #this stuff is only needed for injections self.is_injection = ...
def set_FAR(self,FAR_per_day): self.FAR=FAR_per_day
def set_inj_params(self,lat,lon,m1,m2,dist,effDs): """ set all of the injection parameters at once """ self.latitude_inj = lat self.longitude_inj = lon self.mass1_inj = m1 self.mass2_inj = m2 self.distance_inj = dist self.eff_distances_inj = effDs
if ctab[0].false_alarm_rate is not None: coinc.set_FAR(ctab[0].false_alarm_rate)
def get_coincs_from_coinctable(self,files): """ read data from coinc tables (xml format) FIXME: currently assumes one coinc per file!!! """ for file in files: coinc = CoincData() xmldoc = utils.load_filename(file) sngltab = tab.get_table(xmldoc,lsctables.SnglInspiralTable.tableName) coinc.set_snr(dict((row.ifo, row.sn...
while os.path.isfile(base_name): base_name = base_name + '_' + str(counter) + ext
while os.path.isfile(name): name = base_name + '_' + str(counter) + ext
def get_unique_filename(name): """ use this to avoid name collisions """ counter = 1 base_name, ext = os.path.splitext(name) while os.path.isfile(base_name): base_name = base_name + '_' + str(counter) + ext counter += 1 return base_name + ext
return base_name + ext
return name
def get_unique_filename(name): """ use this to avoid name collisions """ counter = 1 base_name, ext = os.path.splitext(name) while os.path.isfile(base_name): base_name = base_name + '_' + str(counter) + ext counter += 1 return base_name + ext
def append_process(xmldoc, comment = None, force = None, ds_sq_threshold = None, save_small_coincs = None, vetoes_name = None, verbose = None):
def append_process(xmldoc, comment = None, force = None, ds_sq_threshold = None, save_small_coincs = None, vetoes_name = None, coinc_end_time_segment = None, verbose = None):
def append_process(xmldoc, comment = None, force = None, ds_sq_threshold = None, save_small_coincs = None, vetoes_name = None, verbose = None): process = llwapp.append_process(xmldoc, program = process_program_name, version = __version__, cvs_repository = u"lscsoft", cvs_entry_time = __date__, comment = comment) param...
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events):
def append_coinc(self, process_id, node, coinc_def_id, events):
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events): # # populate the coinc_event and coinc_event_map tables #
time_slide_id = node.time_slide_id
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events): # # populate the coinc_event and coinc_event_map tables #
tstart = events[0].get_start() + self.time_slide_index[time_slide_id][events[0].ifo] coinc_ringdown.set_start(tstart + sum(event.snr * float(event.get_start() + self.time_slide_index[time_slide_id][event.ifo] - tstart) for event in events) / sum(event.snr for event in events))
tstart = coinc_ringdown_start(events, node.offset_vector) coinc_ringdown.set_start(tstart)
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events): # # populate the coinc_event and coinc_event_map tables #
tstart = coinc_ringdown.get_start()
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events): # # populate the coinc_event and coinc_event_map tables #
coinc_tables.append_coinc(process_id, node.time_slide_id, coinc_def_id, ntuple)
coinc_tables.append_coinc(process_id, node, coinc_def_id, ntuple)
def ligolw_rinca( xmldoc, process_id, EventListType, CoincTables, coinc_definer_row, event_comparefunc, thresholds, ntuple_comparefunc = lambda events, offset_vector: False, small_coincs = False, veto_segments = None, verbose = False
def __init__(self, config=None):
def __init__(self, configfile=None):
def __init__(self, config=None): cp = ConfigParser.ConfigParser() self.cp = cp self.time_now = "_".join([str(i) for i in time_method.gmtime()[0:6]]) self.ini_file=self.time_now + ".ini" home_base = home_dirs() # CONDOR SECTION NEEDED BY THINGS IN INSPIRAL.PY cp.add_section("condor") cp.set("condor","datafind",self.whi...
if config:
if configfile:
def __init__(self, config=None): cp = ConfigParser.ConfigParser() self.cp = cp self.time_now = "_".join([str(i) for i in time_method.gmtime()[0:6]]) self.ini_file=self.time_now + ".ini" home_base = home_dirs() # CONDOR SECTION NEEDED BY THINGS IN INSPIRAL.PY cp.add_section("condor") cp.set("condor","datafind",self.whi...
user_cp.read(config)
user_cp.read(configfile)
def __init__(self, config=None): cp = ConfigParser.ConfigParser() self.cp = cp self.time_now = "_".join([str(i) for i in time_method.gmtime()[0:6]]) self.ini_file=self.time_now + ".ini" home_base = home_dirs() # CONDOR SECTION NEEDED BY THINGS IN INSPIRAL.PY cp.add_section("condor") cp.set("condor","datafind",self.whi...
if user_cp: self.overwrite_config(user_cp)
if user_cp: self.overwrite_config(user_cp,cp)
def __init__(self, config=None): cp = ConfigParser.ConfigParser() self.cp = cp self.time_now = "_".join([str(i) for i in time_method.gmtime()[0:6]]) self.ini_file=self.time_now + ".ini" home_base = home_dirs() # CONDOR SECTION NEEDED BY THINGS IN INSPIRAL.PY cp.add_section("condor") cp.set("condor","datafind",self.whi...
def overwrite_config(self,config):
def overwrite_config(self,config,cp):
def overwrite_config(self,config): for section in config.sections(): if not cp.has_section(section): cp.add_section(section) for option in config.options(section): cp.set(section,option,config.get(section,option))
if dY>=0 and dX>=0:
if dY>=0 and dX>0:
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
elif dY>=0 and dX<0:
elif dY>0 and dX<0:
def scatterPointer(A=None,B=None): """ Expects two ordered pairs as tuples (x1,y1) and (x2,y2)... Then this defines an angle. From this angle we orient a triangle point and return this as a tuple of requested size. This can be plotted by the scatter plot to point in a particular orientation. The direction right(0,0)->...
qscanList = stfu_pipe.getParamsFromCache(eval("opts.qscan_cache_" + type_string),type)
qscanList = getParamsFromCache(eval("opts.qscan_cache_" + type_string),type)
def getQscanTable(opts,type): summary = readSummaryFiles() if "FG" in type: type_string = "foreground" elif "BG" in type: type_string = "background" if eval("opts.qscan_cache_" + type_string): qscanList = stfu_pipe.getParamsFromCache(eval("opts.qscan_cache_" + type_string),type) else: try: inputPath = eval("opts." +...
candidates_path = stfu_pipe.getParamsFromCache(opts.qscan_cache_foreground,type,ifo,time_string)
candidates_path = getParamsFromCache(opts.qscan_cache_foreground,type,ifo,time_string)
def plotHistogram(chan,opts,distribution,histoList,binList,percentiles=None,candidate=None,candidateRank=None): parameter = distribution.split('-')[0] step = binList[1] - binList[0] counter = sum(histoList) xlimInf = min(binList) if candidate and not parameter == 'dt': xlimSup = max(max(binList),candidate + 2.0) els...
(home_dirs()+"/romain/followupbackgrounds/omega/VSR1b/background/background_937800015_947260815.cache",935798415,999999999,"V1")
(home_dirs()+"/romain/followupbackgrounds/omega/VSR2b/background/background_937800015_947260815.cache",935798415,999999999,"V1")
def figure_out_cache(time,ifo): cacheList=( (home_dirs()+"/romain/followupbackgrounds/omega/S5/background/background_815155213_875232014.cache",815155213,875232014,"H1H2L1"), (home_dirs()+"/romain/followupbackgrounds/omega/S6a/background/background_931035296_935798415.cache",931035296,935798415,"H1L1"), (home_dirs()+"...
if not "PEM" in myFile.upper() or not "SEI" in myFile.upper():
if not "PEM" in myFile.upper() and not "SEI" in myFile.upper():
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # Check to see if wiki file with name already exists maxCount=0 while os.path.ex...
if not "PEM" in chan[0] or not "SEI" in chan[0]:
if not "PEM" in chan[0] and not "SEI" in chan[0]:
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # Check to see if wiki file with name already exists maxCount=0 while os.path.ex...
if param == 'channel-name': self.inputIfo = value[0:2]
def __init__(self, dag, job, cp, opts, sngl, frame_cache, chia, tag, p_nodes=[]):
y.segment_def_cdb = x.creator_db AND \ NOT (y.start_time > %s OR %s > y.end_time) ) \
y.segment_def_cdb = x.creator_db) AND \ NOT (segment.start_time > %s OR %s > segment.end_time) \ ORDER BY segment.start_time,segment_definer.segment_def_id,segment_definer.version \
def getSciSegs(ifo=None, gpsStart=None, gpsStop=None, cut=bool(False), serverURL=None, segName="DMT-SCIENCE", seglenmin=None, segpading=0
def figure_out_site(ifo): siteDico = {"H1":"LHO","H2":"LHO","L1":"LLO","V1":"Virgo"} if ifo in siteDico: return siteDico[ifo] else: print >> sys.stderr, "ifo " + ifo + "is not defined in siteDico dictionary" sys.exit(1)
def figure_out_site(ifo): siteDico = {"H1":"LHO","H2":"LHO","L1":"LLO","V1":"Virgo"} if ifo in siteDico: return siteDico[ifo] else: print >> sys.stderr, "ifo " + ifo + "is not defined in siteDico dictionary" sys.exit(1)
preString = "omega/" + science_run(time).upper() + "/background/" + figure_out_site(ifo)
preString = "omega/" + science_run(time).upper() + "/background"
def __init__(self, dag, job, cp, opts, time, ifo, frame_cache, p_nodes=[], type="ht", variety="fg"): """ """ pipeline.CondorDAGNode.__init__(self,job)
preString = "omega/" + science_run(time).upper() + "/background/" + figure_out_site(ifo)
preString = "omega/" + science_run(time).upper() + "/background"
def __init__(self, dag, job, cp, opts, time, ifo, p_nodes=[], type="ht", variety="fg"):
self.output_cache = lal.CacheEntry(ifo, job.name.replace("remoteScan_"+job.tag_base+".sh","wpipeline").upper(), segments.segment(float(time), float(time)), "file://localhost/"+self.output_path+"/"+str(time))
self.output_cache = lal.CacheEntry(ifo, job.name.replace("remoteScan_"+job.dir+"_"+job.tag_base+".sh","wpipeline").upper(), segments.segment(float(time), float(time)), "file://localhost/"+self.output_path+"/"+str(time))
def __init__(self, dag, job, cp, opts, time, ifo, p_nodes=[], type="ht", variety="fg"):
segment_definer AS x WHERE x.name = segment_definer.name )\
segment_definer AS x, segment AS y \ WHERE x.name = segment_definer.name AND \ x.segment_def_id = y.segment_def_id AND \ y.segment_def_cdb = x.creator_db AND \ NOT (y.start_time > %s OR %s > y.end_time) ) \
def getSciSegs(ifo=None, gpsStart=None, gpsStop=None, cut=bool(False), serverURL=None, segName="DMT-SCIENCE", seglenmin=None, segpading=0
sqlQuery=query01%(segName,ifo,gpsStop,gpsStart)
sqlQuery=query01%(segName,ifo,gpsStop,gpsStart,gpsStop,gpsStart)
def getSciSegs(ifo=None, gpsStart=None, gpsStop=None, cut=bool(False), serverURL=None, segName="DMT-SCIENCE", seglenmin=None, segpading=0
if not sngl.ifo in frametype: frametype = sngl.ifo + "_" + frametype
frametype=__patchFrameTypeDef__(frametype,sngl.ifo,sngl.time)
def get_RDS_R_L1(self): """ """ tmpList=list() for sngl in self.coinc.sngls: #Determine file type frametype,channelName=stfu_pipe.figure_out_type(sngl.time,sngl.ifo,'rds') if not sngl.ifo in frametype: frametype = sngl.ifo + "_" + frametype myMaskIndex="*/%s/*/%s/index.html"%(frametype,sngl.time) myMaskPNG="*/%s/*/%s/*...
if not sngl.ifo in frametype: frametype = sngl.ifo + "_" + frametype
frametype=__patchFrameTypeDef__(frametype,sngl.ifo,sngl.time)
def get_RDS_R_L1_SEIS(self): """ """ tmpList=list() for sngl in self.coinc.sngls: #Determine file type frametype,channelName=stfu_pipe.figure_out_type(sngl.time,sngl.ifo,'rds') if not sngl.ifo in frametype: frametype = sngl.ifo + "_" + frametype frametype = frametype + "_SEIS" myMaskIndex="*/%s*/%s/*.html"%(frametype,s...
if not sngl.ifo in frametype: frametype = sngl.ifo + "_" + frametype
frametype=__patchFrameTypeDef__(frametype,sngl.ifo,sngl.time)
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # Check to see if wiki file with name already exists maxCount=0 while os.path.ex...
sys.stdout.write("Omega scan summary file not or empty for %s. ...continuing...\n"%sngl.ifo)
sys.stdout.write("Omega scan summary file not found or seen empty for %s. ...continuing...\n"%sngl.ifo)
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # Check to see if wiki file with name already exists maxCount=0 while os.path.ex...
pud=os.path.abspath(publication_directory) minFileCount=1 for key,fileList in allSources.items(): if len(fileList) > minFileCount: commonPath=os.path.commonprefix(fileList) for singleFile in fileList: if not singleFile.__contains__(pud): myDestFile=singleFile.replace(commonPath,myDestPath+"/") if not os.path.exists(os....
def __init__(self,type=None,ifo=None,time=None,snr=None,chisqr=None,mass1=None,mass2=None,mchirp=None): """ """ self.type=str(type) self.ifo=str(ifo) self.time=float(time) self.snr=float(snr) self.chisqr=float(chisqr) self.mass1=float(mass1) self.mass2=float(mass2) self.mchirp=float(mchirp)
self.output_cache = lal.CacheEntry(ifonames, job.name.upper(), segments.segment(p_nodes[0].start_time,p_nodes[0].end_time), "file://localhost/"+job.output_path+"/"+self.id)
self.output_cache = lal.CacheEntry(ifonames, job.name.upper(), segments.segment(p_nodes[0].start_time,p_nodes[0].end_time), "file://localhost/"+job.outputPath+"/"+self.id)
def __init__(self,job,coinc,cp,opts,dag,ifo,ifonames,p_nodes): pipeline.CondorDAGNode.__init__(self,job)
self.add_var_opt("findVetoes",cp.get('findVetoes','blind'))
self.add_var_opt("blind",cp.get('findVetoes','blind'))
def __init__(self, dag, job, cp, opts, coincEvent=None): """ """ self.__conditionalLoadDefaults__(findVetosNode.defaults,cp) pipeline.CondorDAGNode.__init__(self,job) self.add_var_opt("trigger-time",coincEvent.time) #Output filename oFilename="%s-findVetos_%s_%s.wiki"%(coincEvent.instruments, coincEvent.ifos, coincEven...
a list of files or an empty list if nothing found
a list of files or an empty list if nothing found. It uses the pathing information from the files passed via cacheListing to aid in our filesystem search.
def __readCache__(self,cacheListing=list()): """ Simple mehtod to read in a cache or list of cache files and return a list of files or an empty list if nothing found """ #Open the cache entry and search for those entrys fileListing=list() for entry in cacheListing: #Cache files listed themselves comment out following l...
fileListing=list()
finalList=list()
def __readCache__(self,cacheListing=list()): """ Simple mehtod to read in a cache or list of cache files and return a list of files or an empty list if nothing found """ #Open the cache entry and search for those entrys fileListing=list() for entry in cacheListing: #Cache files listed themselves comment out following l...
finalList=list() for thisFile in fileListing: finalList.extend(fnmatch.filter(self.fsys,"*%s"%thisFile)) if thisFile.endswith(".png"): finalList.extend(fnmatch.filter(self.fsys,"*%s"%thisFile.replace(".png","?thumb?png"))) if len(finalList) < 1: return list() else: return finalList
pathingInfo=os.path.dirname(entry) for thisFile in fileListing: finalList.extend(fnmatch.filter(self.fsys,"*%s*%s"%(pathingInfo,thisFile))) if thisFile.endswith(".png"): finalList.extend(fnmatch.filter(self.fsys,"*%s"%thisFile.replace(".png","?thumb?png"))) return finalList
def __readCache__(self,cacheListing=list()): """ Simple mehtod to read in a cache or list of cache files and return a list of files or an empty list if nothing found """ #Open the cache entry and search for those entrys fileListing=list() for entry in cacheListing: #Cache files listed themselves comment out following l...
myCacheMask="*/%s-analyseQscan_%s_%s*_seis_rds*.cache"%(sngl.ifo,sngl.ifo,timeString)
myCacheMask="*%s*/%s-analyseQscan_%s_%s*_seis_rds*.cache"%\ (self.coinc.type,sngl.ifo,sngl.ifo,timeString)
def get_analyzeQscan_SEIS(self): """ This seeks out the html and png files associated with SEIS result of an analyzeQscan job. """ cacheList=list() cacheFiles=list() for sngl in self.coinc.sngls: timeString=str(float(sngl.time)).replace(".","_") myCacheMask="*/%s-analyseQscan_%s_%s*_seis_rds*.cache"%(sngl.ifo,sngl.ifo,...
myCacheMask="*/%s-analyseQscan_%s_%s_rds*.cache"%(sngl.ifo,sngl.ifo,timeString)
myCacheMask="*%s*/%s-analyseQscan_%s_%s_rds*.cache"%\ (self.coint.type,sngl.ifo,sngl.ifo,timeString)
def get_analyzeQscan_RDS(self): """ """ #analyseQscan.py_FG_RDS_full_data/H1-analyseQscan_H1_931176926_116_rds-unspecified-gpstime.cache cacheList=list() cacheFiles=list() for sngl in self.coinc.sngls: timeString=str(float(sngl.time)).replace(".","_") myCacheMask="*/%s-analyseQscan_%s_%s_rds*.cache"%(sngl.ifo,sngl.ifo,...
myCacheMask="*/%s-analyseQscan_%s_%s*_ht*.cache"%(sngl.ifo,sngl.ifo,timeString)
myCacheMask="*%s*/%s-analyseQscan_%s_%s*_ht*.cache"\ %(self.coinc.type,sngl.ifo,sngl.ifo,timeString)
def get_analyzeQscan_HT(self): """ """ #analyseQscan.py_FG_HT_full_data/H1-analyseQscan_H1_931176926_116_ht-unspecified-gpstime.cache cacheList=list() cacheFiles=list() for sngl in self.coinc.sngls: timeString=str(float(sngl.time)).replace(".","_") myCacheMask="*/%s-analyseQscan_%s_%s*_ht*.cache"%(sngl.ifo,sngl.ifo,tim...
if injection:
if injection is not None and injectionconfidence is not None and injection_area is not None:
def cbcBayesPostProc(outdir,data,oneDMenu,twoDGreedyMenu,GreedyRes,confidence_levels,twoDplots,injfile=None,eventnum=None,skyres=None,bayesfactornoise=None,bayesfactorcoherent=None): """ This is a demonstration script for using the functionality/data structures contained in pylal.bayespputils . It will produce a webpag...
np.savetxt('ranked_sky_pixels',np.column_stack([np.asarray(toppoints)[:,0:1],np.asarray(toppoints)[:,1],np.asarray(toppoints)[:,3]]))
np.savetxt(os.path.join(outdir,'ranked_sky_pixels.dat'),np.column_stack([np.asarray(toppoints)[:,0:1],np.asarray(toppoints)[:,1],np.asarray(toppoints)[:,3]]))
def plotSkyMap(skypos,skyres,sky_injpoint,confidence_levels,outdir): from mpl_toolkits.basemap import Basemap from pylal import skylocutils np.seterr(under='ignore') skypoints=np.array(skylocutils.gridsky(float(skyres))) skycarts=map(lambda s: pol2cart(s[1],s[0]),skypoints) skyinjectionconfidence=None shist=skyhist...
self.add_var_arg(p_nodes[1].name_output_file)
self.add_var_arg(p_nodes[1].outputFileName)
def __init__(self, dag, job, cp, opts, ifo, time, p_nodes=[], type=""):
self.add_var_opt('server','ldr-bologna.phys.uwm.edu') if not(cp.has_option('fu-remote-jobs','remote-jobs') and job.name in cp.get('fu-remote-jobs','remote-jobs') and cp.has_option('fu-remote-jobs','remote-ifos') and ifo in cp.get('fu-remote-jobs','remote-ifos')) or if opts.do_remoteScans:
self.add_var_arg('--server ldr-bologna.phys.uwm.edu') if not(cp.has_option('fu-remote-jobs','remote-jobs') and job.name in cp.get('fu-remote-jobs','remote-jobs') and cp.has_option('fu-remote-jobs','remote-ifos') and ifo in cp.get('fu-remote-jobs','remote-ifos')) or opts.do_remoteScans:
def __init__(self, dag, job, cp, opts, ifo, sngl=None, qscan=False, trigger_time=None, data_type="hoft", p_nodes=[]):
return map(lambda (a,b,c): detector_threshold(min_threshold,ifos,a,b,c,sensitivities), zip(RA,dec,gps_time))
return map(lambda (a,b,c): detector_thresholds(min_threshold,ifos,a,b,c,sensitivities), zip(RA,dec,gps_time))
def detector_thresholds(min_threshold, ifos, RA, dec, gps_time, sensitivities=None): """ Return a dictionary of sensitivity thresholds for each detector, based on a minimum threshold of min_threshold in the least sensitive one, for a source at position (RA,dec) specified in radians at time gps_time. Specifying a dictio...
for n, (coinc_event_id, time_slide_id) in enumerate(database.connection.cursor().execute("SELECT coinc_event_id, time_slide_id FROM coinc_event WHERE coinc_def_id == ?", (database.bb_definer_id,))): if verbose and not n % 200: print >>sys.stderr, "\t%.1f%%\r" % (100.0 * n / n_coincs), events = map(database.sngl_burst...
def get_likelihood_ratio(coinc_event_id, time_slide_id, row_from_cols = database.sngl_burst_table.row_from_cols, cursor = cursor, time_slides = time_slides, params_func = params_func, params_func_extra_args = params_func_extra_args): events = map(row_from_cols, cursor.execute("""SELECT * FROM coinc_burst_map WHERE coin...
def ligolw_burca2(database, likelihood_ratio, params_func, verbose = False, params_func_extra_args = ()): """ Assigns likelihood ratio values to excess power coincidences. database is pylal.SnglBurstUtils.CoincDatabase instance, and likelihood_ratio is a LikelihoodRatio class instance. """ # # Find document parts. # t...
likelihood = ?
likelihood = likelihood_ratio(coinc_event_id, time_slide_id)
def ligolw_burca2(database, likelihood_ratio, params_func, verbose = False, params_func_extra_args = ()): """ Assigns likelihood ratio values to excess power coincidences. database is pylal.SnglBurstUtils.CoincDatabase instance, and likelihood_ratio is a LikelihoodRatio class instance. """ # # Find document parts. # t...
coinc_event_id == ? """, (likelihood_ratio(params_func, events, time_slides[time_slide_id], *params_func_extra_args), coinc_event_id))
coinc_def_id == ? """, (database.bb_definer_id,))
def ligolw_burca2(database, likelihood_ratio, params_func, verbose = False, params_func_extra_args = ()): """ Assigns likelihood ratio values to excess power coincidences. database is pylal.SnglBurstUtils.CoincDatabase instance, and likelihood_ratio is a LikelihoodRatio class instance. """ # # Find document parts. # t...
os.path.join("bin", "checkPerformedInjections.py")
os.path.join("bin", "pylal_cbc_select_hardware_injections")
def run(self): # remove the automatically generated user env scripts for script in ["pylal-user-env.sh", "pylal-user-env.csh"]: log.info("removing " + script ) try: os.unlink(os.path.join("etc", script)) except: pass
if not os.path.isdir(os.path.join(margdir,'/')): os.mkdir(margdir)
if not os.path.isdir(margdir): os.makedirs(margdir)
def cbcBayesSkyRes(outdir,data,oneDMenu,twoDGreedyMenu,GreedyRes,confidence_levels,twoDplots,injfile=None,eventnum=None,skyres=None): if eventnum is not None and injfile is None: print "You specified an event number but no injection file. Ignoring!" if data is None: print 'You must specify an input data file' exit(1)...
extent = off_segs.extent()
extent = (off_segs | on_segs).extent()
def get_exttrig_trials(on_segs, off_segs, veto_files): """ Return a tuple of (off-source time bins, off-source veto mask, index of trial that is on source). The off-source veto mask is a one-dimensional boolean array where True means vetoed. @param on_segs: On-source segments @param off_segs: Off-source segments @param...
htmlfile.write('<img src="'+paramnames[i]+'.png"><img src="'+paramnames[i]+'_samps.png><br>')
htmlfile.write('<img src="'+paramnames[i]+'.png"><img src="'+paramnames[i]+'_samps.png"><br>')
def plot2Dkernel(xdat,ydat,Nx,Ny): xax=linspace(min(xdat),max(xdat),Nx) yax=linspace(min(ydat),max(ydat),Ny) x,y=numpy.meshgrid(xax,yax) samp=array([xdat,ydat]) kde=stats.kde.gaussian_kde(samp) grid_coords = numpy.append(x.reshape(-1,1),y.reshape(-1,1),axis=1) z = kde(grid_coords.T) z = z.reshape(Nx,Ny) asp=xax.ptp()/y...
def append_process(xmldoc, comment = None, force = None, e_thinca_parameter = None, effective_snr_factor = None, vetoes_name = None, trigger_program = None, effective_snr = None, verbose = None):
def append_process(xmldoc, comment = None, force = None, e_thinca_parameter = None, effective_snr_factor = None, vetoes_name = None, trigger_program = None, effective_snr = None, coinc_end_time_segment = None, verbose = None):
def append_process(xmldoc, comment = None, force = None, e_thinca_parameter = None, effective_snr_factor = None, vetoes_name = None, trigger_program = None, effective_snr = None, verbose = None): process = llwapp.append_process(xmldoc, program = process_program_name, version = __version__, cvs_repository = u"lscsoft", ...
coinc_inspiral.set_end(events[0].get_end() + self.time_slide_index[time_slide_id][events[0].ifo])
coinc_inspiral.set_end(coinc_inspiral_end_time(events, self.time_slide_index[time_slide_id]))
def append_coinc(self, process_id, time_slide_id, coinc_def_id, events, effective_snr_factor): # # populate the coinc_event and coinc_event_map tables #
ntuple_comparefunc = lambda events, offset_vector: False,
ntuple_comparefunc = default_ntuple_comparefunc,
def ligolw_thinca( xmldoc, process_id, EventListType, CoincTables, coinc_definer_row, event_comparefunc, thresholds, ntuple_comparefunc = lambda events, offset_vector: False, effective_snr_factor = 250.0, veto_segments = None, trigger_program = u"inspiral", verbose = False
self.name_output_file = job.tag_base + "-" + str(time) + ".tgz"
self.name_output_file = job.tag_base + "-" + repr(time) + ".tgz"
def __init__(self, dag, job, cp, opts, time, ifo, p_nodes=[], type="ht", variety="fg"):
return np.fmin(c, 2 * LAL_PI - c)
return np.where(c < LAL_PI, c, 2 * LAL_PI - c)
def _abs_diff(c): """ For some angular difference c = |a - b| in radians, find the magnitude of the difference, taking into account the wrap-around at 2*pi. """ c = abs(c) % (2 * LAL_PI) return np.fmin(c, 2 * LAL_PI - c)
pol PDF: kappa / (2 * np.sinh(kappa)) * np.exp(kappa * np.cos(theta)) * np.sin(theta)) az PDF: uniform(0, 2*pi)
References: * http://en.wikipedia.org/wiki/Von_Mises–Fisher_distribution * http://arxiv.org/pdf/0902.0737v1 (states the Rayleigh limit)
def fisher_rvs(mu, sigma, size=1): """ Return a random (polar, azimuthal) angle drawn from the Fisher distribution. Assume that the concentration parameter (kappa) is large so that we can use a Rayleigh distribution about the north pole and rotate it to be centered at the (polar, azimuthal) coordinate mu. Assume kappa...
if len(indexList) > 1:
if len(indexList) >= 1:
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # # Check to see if wiki file with name already exists # maxCount=0 while os.pat...
cohSnrTimeTable.data[i+1][0]=wikiPage.linkedRemoteImaage(image,thumbList[i])
cohSnrTimeTable.data[i+1][0]=wikiPage.linkedRemoteImage(image,thumbList[i])
def prepareChecklist(wikiFilename=None,wikiCoinc=None,wikiTree=None,file2URL=None): """ Method to prepare a checklist where data products are isolated in directory. """ endOfS5=int(875232014) wikiFileFinder=findFileType(wikiTree,wikiCoinc) # # Check to see if wiki file with name already exists # maxCount=0 while os.pat...
os.path.join("bin", "search_upper_limit_by_s1_s2"),
os.path.join("bin", "search_upper_limit_by_s1z_s2z"), os.path.join("bin", "search_volume_by_s1z_s2z"),
def run(self): # remove the automatically generated user env scripts for script in ["pylal-user-env.sh", "pylal-user-env.csh"]: log.info("removing " + script ) try: os.unlink(os.path.join("etc", script)) except: pass
(home_dirs()+"/romain/followupbackgrounds/omega/VSR2a/background/background_931035296_935798415.cache",931035296,935798415,"V1")
(home_dirs()+"/romain/followupbackgrounds/omega/VSR2a/background/background_931035296_935798415.cache",931035296,935798415,"V1"),
def figure_out_cache(time,ifo): cacheList=( (home_dirs()+"/romain/followupbackgrounds/omega/S5/background/background_815155213_875232014.cache",815155213,875232014,"H1H2L1"), (home_dirs()+"/romain/followupbackgrounds/omega/S6a/background/background_931035296_935798415.cache",931035296,935798415,"H1L1"), (home_dirs()+"...
self.unused_coincs = reduce(lambda a, b: a | b, (set(component.get_coincs(eventlists, event_comparefunc, thresholds, verbose = verbose)) for component in self.components)) self.unused_coincs |= reduce(lambda a, b: a & b, (component.unused_coincs for component in self.components))
for component in self.components: self.unused_coincs |= set(component.get_coincs(eventlists, event_comparefunc, thresholds, verbose = verbose)) for componenta, componentb in iterutils.choices(self.components, 2): self.unused_coincs |= componenta.unused_coincs & componentb.unused_coincs
def get_coincs(self, eventlists, event_comparefunc, thresholds, verbose = False): # # has this node already been visited? if so, return the # answer we already know #