Beispiel #1
0
def _choose_connection(**datafind_kw):
    if os.getenv('LIGO_DATAFIND_SERVER') or datafind_kw.get('host'):
        from gwdatafind import connect
        return connect(**datafind_kw)
    if os.getenv('VIRGODATA'):
        return FflConnection()
    raise RuntimeError("unknown datafind configuration, cannot discover data")
Beispiel #2
0
def datafind_connection(server=None):
    """ Return a connection to the datafind server

    Parameters
    -----------
    server : {SERVER:PORT, string}, optional
       A string representation of the server and port.
       The port may be ommitted.

    Returns
    --------
    connection
        The open connection to the datafind server.
    """
    return gwdatafind.connect(host=server)
def initGWDataFind(enforce=False):
    global GWDataFindInitialized
    if not GWDataFindInitialized or enforce:
        fastlog(INFO,"Initializing GWDataFind connection.")
        if shouldRenew():
                fastlog(INFO, "Creating new VOMS proxy or VO=virgo:virgo/virgo and 48h validity.")
                generateVomsProxy("virgo:virgo/virgo", 48)
        
        global GWDataFindConn
        GWDataFindConn = connect(GWDataFindServer)
        
        global GWDataFindObservatories
        GWDataFindObservatories = GWDataFindConn.find_observatories()
        
        global GWDataFindTypes
        GWDataFindTypes = {}
        for obs in GWDataFindObservatories:
            GWDataFindTypes[obs] = GWDataFindConn.find_types(obs)
        
        GWDataFindInitialized = True
Beispiel #4
0
# Reads the save channels for L1_o3b | file found here: https://dcc.ligo.org/T2000277
safe_channels = pd.read_csv("L1_o3b_safe.csv", usecols=['Channel']).Channel.to_list()
safe_ISI_list = [chan for chan in safe_channels if 'L1:ISI' in chan] # only ISI channels (seismic)


for start, end, filetag in data_times:
    # create output file for the segments | will override existing files
    with h5py.File(f'./segments/aux_{filetag}.hdf5', 'w') as f:
        meta = f.create_group('meta')
        meta.create_dataset('Start GPS', data=int(start))
        # End GPS will be saved at the end of the script

    # uses gwdatafind to find the locations of the frame files (CVMFS) | https://gwdatafind.readthedocs.io/en/stable/index.html
    # extra info : https://gwpy.github.io/docs/v0.1/timeseries/gwf.html
    #              https://computing.docs.ligo.org/guide/data/#cvmfs-data-discovery
    conn = gwdatafind.connect()
    urls = conn.find_urls("L", "L1_R", start, end) # L1_R : All 'raw' data channels, stored at the native sampling rate
    conn.close() # not sure if needed
    
    prev_file_data = None # will hold left over data from previous file that did not fit into a segment
    for url in tqdm(urls):
        frame_start = int(url.split('-')[4])
        frame_size = int(url.split('-')[5].split('.')[0])
        # read data of all channeles in 'safe_ISI_list' from frame file located at 'url'
        data_dict = gwpy.timeseries.TimeSeriesDict.read(url, safe_ISI_list , start=frame_start, end=frame_start+frame_size) # start, end possibly not needed?
        
        # 2d lists to store data and channel names (tags) sorted by their sampling rates | sort is necessary for calculation of fractal dimension 
        data_all = [[], [], [], [], []]
        tags = [[], [], [], [], []]
        for key in data_dict.keys(): # loop over all aux channels and fill 2d lists
            idx = int(math.log(data_dict[key].sample_rate.value, 2))-8 # convert sampling rate to index for 2d lists
Beispiel #5
0
def _choose_connection(**datafind_kw):
    if os.getenv('LIGO_DATAFIND_SERVER') or datafind_kw.get('host'):
        return connect(**datafind_kw)
    if os.getenv('VIRGODATA'):
        return FflConnection()
    raise RuntimeError("unknown datafind configuration, cannot discover data")