Created
November 3, 2022 00:21
-
-
Save avivajpeyi/b2691d830103b2218657e3f2fcdbf52d to your computer and use it in GitHub Desktop.
GW Data downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
from gwpy.timeseries import TimeSeries | |
TRIGGER_TIME = 1126259462.4 | |
GPS_START_TIME = TRIGGER_TIME - 2 | |
DATA_DURATION = 4 | |
EXTRA_DATA = 10 | |
DATA_START_TIME = int(GPS_START_TIME) - EXTRA_DATA | |
DATA_END_TIME = int(GPS_START_TIME + DATA_DURATION) + EXTRA_DATA | |
CHANNELS = dict( | |
L1='L1:DCS-CALIB_STRAIN_C02', | |
H1='H1:DCS-CALIB_STRAIN_C02' | |
) | |
DATA_FOLDER = "." | |
DATA_FILE_NAME = os.path.join(DATA_FOLDER, "{ifo}_data.gwf") | |
def download_data(): | |
for ifo, channel in CHANNELS.items(): | |
logging.info(f"Downloading {channel} data...") | |
data = TimeSeries.get(channel, DATA_START_TIME, DATA_END_TIME) | |
TimeSeries.write(data, target=DATA_FILE_NAME.format(ifo=ifo), format='gwf') | |
logging.info("Data downloading complete") | |
def main(): | |
download_data() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment