diff --git a/bilby/gw/detector.py b/bilby/gw/detector.py index 2d68559921f0c696e386c92be7a5b29af2ccf7d3..30bf744352d3d5a97e94f2c7e4e784f479caba8a 100644 --- a/bilby/gw/detector.py +++ b/bilby/gw/detector.py @@ -757,7 +757,7 @@ class InterferometerStrainData(object): sampling_frequency=sampling_frequency, start_time=start_time) - logger.info('Reading data from frame') + logger.info('Reading data from frame file {}'.format(frame_file)) strain = gwutils.read_frame_file( frame_file, start_time=start_time, end_time=start_time + duration, buffer_time=buffer_time, channel=channel, @@ -1591,7 +1591,7 @@ class Interferometer(object): df=(self.frequency_array[1] - self.frequency_array[0])), color='C2', label='Signal') - ax.grid('on') + ax.grid(True) ax.set_ylabel(r'strain [strain/$\sqrt{\rm Hz}$]') ax.set_xlabel(r'frequency [Hz]') ax.set_xlim(20, 2000) diff --git a/bilby/gw/utils.py b/bilby/gw/utils.py index 82d6c57b58fd29ef27e800909caf4e67b8e6f448..d52a1a43f2893a6d342d8e9c31859c548b8d75c8 100644 --- a/bilby/gw/utils.py +++ b/bilby/gw/utils.py @@ -416,22 +416,23 @@ def read_frame_file(file_name, start_time, end_time, channel=None, buffer_time=0 except RuntimeError: logger.warning('Channel {} not found. Trying preset channel names'.format(channel)) - ligo_channel_types = ['GDS-CALIB_STRAIN', 'DCS-CALIB_STRAIN_C01', 'DCS-CALIB_STRAIN_C02', - 'DCH-CLEAN_STRAIN_C02'] - virgo_channel_types = ['Hrec_hoft_V1O2Repro2A_16384Hz', 'FAKE_h_16384Hz_4R'] - channel_types = dict(H1=ligo_channel_types, L1=ligo_channel_types, V1=virgo_channel_types) - for detector in channel_types.keys(): - for channel_type in channel_types[detector]: - if loaded: - break - channel = '{}:{}'.format(detector, channel_type) - try: - strain = TimeSeries.read(source=file_name, channel=channel, start=start_time, end=end_time, - **kwargs) - loaded = True - logger.info('Successfully read strain data for channel {}.'.format(channel)) - except RuntimeError: - pass + if loaded is False: + ligo_channel_types = ['GDS-CALIB_STRAIN', 'DCS-CALIB_STRAIN_C01', 'DCS-CALIB_STRAIN_C02', + 'DCH-CLEAN_STRAIN_C02'] + virgo_channel_types = ['Hrec_hoft_V1O2Repro2A_16384Hz', 'FAKE_h_16384Hz_4R'] + channel_types = dict(H1=ligo_channel_types, L1=ligo_channel_types, V1=virgo_channel_types) + for detector in channel_types.keys(): + for channel_type in channel_types[detector]: + if loaded: + break + channel = '{}:{}'.format(detector, channel_type) + try: + strain = TimeSeries.read(source=file_name, channel=channel, start=start_time, end=end_time, + **kwargs) + loaded = True + logger.info('Successfully read strain data for channel {}.'.format(channel)) + except RuntimeError: + pass if loaded: return strain @@ -542,8 +543,8 @@ def gw_data_find(observatory, gps_start_time, duration, calibration, cl_list = ['gw_data_find'] cl_list.append('--observatory {}'.format(observatory_code)) - cl_list.append('--gps-start-time {}'.format(gps_start_time)) - cl_list.append('--gps-end-time {}'.format(gps_end_time)) + cl_list.append('--gps-start-time {}'.format(int(np.floor(gps_start_time)))) + cl_list.append('--gps-end-time {}'.format(int(np.ceil(gps_end_time)))) cl_list.append('--type {}'.format(query_type)) cl_list.append('--output {}'.format(output_cache_file)) cl_list.append('--url-type file')