From 77b8170216d7463ff86deba8d06fbf265f20a8f7 Mon Sep 17 00:00:00 2001 From: Aaron Viets <aaron.viets@ligo.org> Date: Tue, 18 Sep 2018 13:37:41 -0700 Subject: [PATCH] gstlal_compute_strain: added --frame-cache and --output-path as command-line options. --- gstlal-calibration/bin/gstlal_compute_strain | 63 ++++++++++--------- .../H1DCS_AllCorrections_Cleaning.ini | 4 +- .../H1DCS_SplitPU_AllCorrections_Cleaning.ini | 4 +- ...GDS_LowLatency_AllCorrections_Cleaning.ini | 4 +- ...DS_TestLatency_AllCorrections_Cleaning.ini | 4 +- .../gstlal_compute_strain_config_example.ini | 4 +- .../tests/check_calibration/Makefile | 10 +-- 7 files changed, 50 insertions(+), 43 deletions(-) diff --git a/gstlal-calibration/bin/gstlal_compute_strain b/gstlal-calibration/bin/gstlal_compute_strain index eec125e3a4..37facaa350 100755 --- a/gstlal-calibration/bin/gstlal_compute_strain +++ b/gstlal-calibration/bin/gstlal_compute_strain @@ -126,9 +126,11 @@ parser = OptionParser(description = __doc__) # Append program specific options # These options should be used whether the pipeline runs in full calibration mode or partial calibration mode -parser.add_option("--gps-start-time", metavar = "seconds", help = "Set the start time of the segment to analyze in GPS seconds. This is required iff --data-source=frames") -parser.add_option("--gps-end-time", metavar = "seconds", help = "Set the end time of the segment to analyze in GPS seconds. This is required iff --data-source=frames") -parser.add_option("--wings", metavar = "seconds", default = 0, type = "int", help = "Number of seconds to trim off of the beginning and end of the output. Should only be used if --data-source=frames.") +parser.add_option("--gps-start-time", metavar = "seconds", help = "Set the start time of the segment to analyze in GPS seconds. This is required iff DataSource is frames") +parser.add_option("--gps-end-time", metavar = "seconds", help = "Set the end time of the segment to analyze in GPS seconds. This is required iff DataSource is =frames") +parser.add_option("--frame-cache", metavar = "filename", help = "Set the name of the LAL cache listing the LIGO .gwf frame files (optional). This is required iff DataSource is frames") +parser.add_option("--output-path", metavar = "name", default = ".", help = "Set the output path for writing frame files. (Default=Current)") +parser.add_option("--wings", metavar = "seconds", default = 0, type = "int", help = "Number of seconds to trim off of the beginning and end of the output. Should only be used if DataSource is frames.") parser.add_option("--frame-duration", metavar = "seconds", type = "int", default = 4, help = "Set the number of seconds for each frame. (Default = 4)") parser.add_option("--frames-per-file", metavar = "count", type = "int", default = 1, help = "Set the number of frames per frame file. (Default = 1)") parser.add_option("--config-file", metavar = "name", help = "Full path to configuration file for running.") @@ -177,7 +179,7 @@ data_sources = set(("frames", "lvshm")) if InputConfigs["datasource"] not in data_sources: raise ValueError("DataSource must be one of %s" % ",".join(data_sources)) -if InputConfigs["datasource"] == "frames" and InputConfigs["framecache"] is None: +if InputConfigs["datasource"] == "frames" and options.frame_cache is None: raise ValueError("FrameCache must be specified when using DataSource: frames") if int(options.wings != 0) and InputConfigs["datasource"] != "frames": @@ -359,28 +361,33 @@ skip_bad_files = Config.getboolean("InputConfigurations", "skipbadfiles") # Search the directory tree for files with names matching the one we want. filters_name = InputConfigs["filtersfilename"] -filters_paths = [] -print "\nSearching for %s ..." % filters_name -# Check the user's home directory -for dirpath, dirs, files in os.walk(os.environ['HOME']): - if filters_name in files: - # We prefer filters that came directly from a GDSFilters directory of the calibration SVN - if dirpath.count("GDSFilters") > 0: - filters_paths.insert(0, os.path.join(dirpath, filters_name)) - else: - filters_paths.append(os.path.join(dirpath, filters_name)) -# Check if there is a checkout of the entire calibration SVN -for dirpath, dirs, files in os.walk('/ligo/svncommon/CalSVN/aligocalibration/trunk/Runs/'): - if filters_name in files: - # We prefer filters that came directly from a GDSFilters directory of the calibration SVN - if dirpath.count("GDSFilters") > 0: - filters_paths.insert(0, os.path.join(dirpath, filters_name)) - else: - filters_paths.append(os.path.join(dirpath, filters_name)) -if not len(filters_paths): - raise ValueError("Cannot find filters file %s in home directory %s or in /ligo/svncommon/CalSVN/aligocalibration/trunk/Runs/*/GDSFilters", (filters_name, os.environ['HOME'])) -print "Loading calibration filters from %s\n" % filters_paths[0] -filters = numpy.load(filters_paths[0]) +if filters_name.count('/') > 0: + # Then the path to the filters file was given + filters = numpy.load(filters_name) +else: + # We need to search for the filters file + filters_paths = [] + print "\nSearching for %s ..." % filters_name + # Check the user's home directory + for dirpath, dirs, files in os.walk(os.environ['HOME']): + if filters_name in files: + # We prefer filters that came directly from a GDSFilters directory of the calibration SVN + if dirpath.count("GDSFilters") > 0: + filters_paths.insert(0, os.path.join(dirpath, filters_name)) + else: + filters_paths.append(os.path.join(dirpath, filters_name)) + # Check if there is a checkout of the entire calibration SVN + for dirpath, dirs, files in os.walk('/ligo/svncommon/CalSVN/aligocalibration/trunk/Runs/'): + if filters_name in files: + # We prefer filters that came directly from a GDSFilters directory of the calibration SVN + if dirpath.count("GDSFilters") > 0: + filters_paths.insert(0, os.path.join(dirpath, filters_name)) + else: + filters_paths.append(os.path.join(dirpath, filters_name)) + if not len(filters_paths): + raise ValueError("Cannot find filters file %s in home directory %s or in /ligo/svncommon/CalSVN/aligocalibration/trunk/Runs/*/GDSFilters", (filters_name, os.environ['HOME'])) + print "Loading calibration filters from %s\n" % filters_paths[0] + filters = numpy.load(filters_paths[0]) # In case we want to remove calibration lines, we will fill these dictionaries pcal_line_removal_dict = {} @@ -803,7 +810,7 @@ if not verbose: if InputConfigs["datasource"] == "lvshm": # Data is to be read from shared memory; "low-latency" mode src = pipeparts.mklvshmsrc(pipeline, shm_name = InputConfigs["shmpartition"], assumed_duration = int(InputConfigs["inputframeduration"])) elif InputConfigs["datasource"] == "frames": # Data is to be read from frame files; "offline" mode - src = pipeparts.mklalcachesrc(pipeline, location = InputConfigs["framecache"], cache_dsc_regex = instrument) + src = pipeparts.mklalcachesrc(pipeline, location = options.frame_cache, cache_dsc_regex = instrument) if Config.getboolean("DebuggingConfigurations", "testlatency"): src = pipeparts.mkgeneric(pipeline, src, "splitcounter", filename = "gstlal_compute_strain_timestamps_in.txt") @@ -2457,7 +2464,7 @@ if Config.getboolean("DebuggingConfigurations", "testlatency"): if OutputConfigs["datasink"] == "lvshm": pipeparts.mkgeneric(pipeline, mux, "gds_lvshmsink", sync=False, async=False, shm_name = OutputConfigs["outputshmpartition"], num_buffers = int(OutputConfigs["numbuffers"]), blocksize = int(OutputConfigs["framesize"])*options.frame_duration*options.frames_per_file, buffer_mode = int(OutputConfigs["buffermode"])) elif OutputConfigs["datasink"] == "frames": - pipeparts.mkframecppfilesink(pipeline, mux, frame_type = OutputConfigs["frametype"], path = OutputConfigs["outputpath"], instrument = instrument) + pipeparts.mkframecppfilesink(pipeline, mux, frame_type = OutputConfigs["frametype"], path = options.output_path, instrument = instrument) # Run pipeline diff --git a/gstlal-calibration/config_files/H1DCS_AllCorrections_Cleaning.ini b/gstlal-calibration/config_files/H1DCS_AllCorrections_Cleaning.ini index 5d88f32c33..03166b7a89 100644 --- a/gstlal-calibration/config_files/H1DCS_AllCorrections_Cleaning.ini +++ b/gstlal-calibration/config_files/H1DCS_AllCorrections_Cleaning.ini @@ -11,7 +11,8 @@ SkipBadFiles: No ############################################ # If reading from frames use these options # ############################################ -FrameCache: H1_raw_frames.cache +# None + ################################################### # If reading from shared memory use these options # ################################################### @@ -39,7 +40,6 @@ NumBuffers: 10 # If writing to frame files use these options # ############################################### FrameType: H1DCS_TEST -OutputPath: Frames/O2/H1/DCS [CalibrationConfigurations] IFO: H1 diff --git a/gstlal-calibration/config_files/H1DCS_SplitPU_AllCorrections_Cleaning.ini b/gstlal-calibration/config_files/H1DCS_SplitPU_AllCorrections_Cleaning.ini index 0d1fec22c1..5ccc4945c0 100644 --- a/gstlal-calibration/config_files/H1DCS_SplitPU_AllCorrections_Cleaning.ini +++ b/gstlal-calibration/config_files/H1DCS_SplitPU_AllCorrections_Cleaning.ini @@ -11,7 +11,8 @@ SkipBadFiles: No ############################################ # If reading from frames use these options # ############################################ -FrameCache: H1_raw_frames.cache +# None + ################################################### # If reading from shared memory use these options # ################################################### @@ -39,7 +40,6 @@ NumBuffers: 10 # If writing to frame files use these options # ############################################### FrameType: H1DCS_TEST -OutputPath: Frames/O2/H1/DCS [CalibrationConfigurations] IFO: H1 diff --git a/gstlal-calibration/config_files/H1GDS_LowLatency_AllCorrections_Cleaning.ini b/gstlal-calibration/config_files/H1GDS_LowLatency_AllCorrections_Cleaning.ini index ddb2e3f7df..da4db61618 100644 --- a/gstlal-calibration/config_files/H1GDS_LowLatency_AllCorrections_Cleaning.ini +++ b/gstlal-calibration/config_files/H1GDS_LowLatency_AllCorrections_Cleaning.ini @@ -11,7 +11,8 @@ SkipBadFiles: No ############################################ # If reading from frames use these options # ############################################ -FrameCache: H1_raw_frames.cache +# None + ################################################### # If reading from shared memory use these options # ################################################### @@ -39,7 +40,6 @@ NumBuffers: 10 # If writing to frame files use these options # ############################################### FrameType: H1GDS_TEST -OutputPath: Frames/O2/H1/GDS [CalibrationConfigurations] IFO: H1 diff --git a/gstlal-calibration/config_files/H1GDS_TestLatency_AllCorrections_Cleaning.ini b/gstlal-calibration/config_files/H1GDS_TestLatency_AllCorrections_Cleaning.ini index 23e2d043c8..6ebb9bce8e 100644 --- a/gstlal-calibration/config_files/H1GDS_TestLatency_AllCorrections_Cleaning.ini +++ b/gstlal-calibration/config_files/H1GDS_TestLatency_AllCorrections_Cleaning.ini @@ -11,7 +11,8 @@ SkipBadFiles: No ############################################ # If reading from frames use these options # ############################################ -FrameCache: H1_raw_frames.cache +# None + ################################################### # If reading from shared memory use these options # ################################################### @@ -39,7 +40,6 @@ NumBuffers: 10 # If writing to frame files use these options # ############################################### FrameType: H1GDS_SHM -OutputPath: Frames/O2/H1/GDS [CalibrationConfigurations] IFO: H1 diff --git a/gstlal-calibration/config_files/gstlal_compute_strain_config_example.ini b/gstlal-calibration/config_files/gstlal_compute_strain_config_example.ini index 678ff98634..96b57233ab 100644 --- a/gstlal-calibration/config_files/gstlal_compute_strain_config_example.ini +++ b/gstlal-calibration/config_files/gstlal_compute_strain_config_example.ini @@ -11,7 +11,8 @@ SkipBadFiles: No ############################################ # If reading from frames use these options # ############################################ -FrameCache: L1_raw_frames.cache +# None + ################################################### # If reading from shared memory use these options # ################################################### @@ -39,7 +40,6 @@ NumBuffers: 10 # If writing to frame files use these options # ############################################### FrameType: TEST -OutputPath: . [CalibrationConfigurations] IFO: L1 diff --git a/gstlal-calibration/tests/check_calibration/Makefile b/gstlal-calibration/tests/check_calibration/Makefile index 58557bc5bb..5f5a1e0f41 100644 --- a/gstlal-calibration/tests/check_calibration/Makefile +++ b/gstlal-calibration/tests/check_calibration/Makefile @@ -43,24 +43,24 @@ $(IFO)1_C02_frames.cache: gw_data_find -o $(IFO) -t $(IFO)1_HOFT_C02 -s $(START) -e $(END) -l --url-type file > $@ $(IFO)1_hoft_GDS_frames.cache: $(IFO)1_raw_frames.cache filters framesdir - GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(GDSCONFIGS) + GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-cache $(IFO)1_raw_frames.cache --output-path Frames/$(OBSRUN)/$(IFO)1/GDS/ --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(GDSCONFIGS) ls Frames/$(OBSRUN)/$(IFO)1/GDS/$(IFO)-$(IFO)1GDS_TEST*.gwf | lalapps_path2cache > $@ $(IFO)1_hoft_DCS_frames.cache: $(IFO)1_raw_frames.cache filters framesdir - GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(DCSCONFIGS) + GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-cache $(IFO)1_raw_frames.cache --output-path Frames/$(OBSRUN)/$(IFO)1/DCS/ --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(DCSCONFIGS) ls Frames/$(OBSRUN)/$(IFO)1/DCS/$(IFO)-$(IFO)1DCS_TEST*.gwf | lalapps_path2cache > $@ # In case we want to compare one calibration to another... $(IFO)1_hoft_GDS_TEST_frames.cache: $(IFO)1_raw_frames.cache filters framesdir - GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(GDSTESTCONFIGS) + GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-cache $(IFO)1_raw_frames.cache --output-path Frames/$(OBSRUN)/$(IFO)1/GDS/ --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(GDSTESTCONFIGS) ls Frames/$(OBSRUN)/$(IFO)1/GDS/$(IFO)-$(IFO)1GDS_TEST*.gwf | lalapps_path2cache > $@ $(IFO)1_hoft_DCS_TEST_frames.cache: $(IFO)1_raw_frames.cache filters framesdir - GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(DCSTESTCONFIGS) + GST_DEBUG=3 gstlal_compute_strain --gps-start-time $(START) --gps-end-time $(END) --frame-cache $(IFO)1_raw_frames.cache --output-path Frames/$(OBSRUN)/$(IFO)1/DCS/ --frame-duration=64 --frames-per-file=1 --wings=0 --config-file $(DCSTESTCONFIGS) ls Frames/$(OBSRUN)/$(IFO)1/DCS/$(IFO)-$(IFO)1DCS_TEST*.gwf | lalapps_path2cache > $@ $(IFO)1_hoft_GDS_SHM_frames.cache: filters framesdir - -GST_DEBUG=3 timeout $(SHMRUNTIME) gstlal_compute_strain --frame-duration=1 --frames-per-file=1 --wings=0 --config-file $(GDSSHMCONFIGS) + -GST_DEBUG=3 timeout $(SHMRUNTIME) gstlal_compute_strain --output-path Frames/$(OBSRUN)/$(IFO)1/GDS/ --frame-duration=1 --frames-per-file=1 --wings=0 --config-file $(GDSSHMCONFIGS) ls Frames/$(OBSRUN)/$(IFO)1/GDS/$(IFO)-$(IFO)1GDS_SHM*.gwf | lalapps_path2cache > $@ GDS_pcal2darm_plots: $(IFO)1_raw_frames.cache $(IFO)1_hoft_GDS_frames.cache -- GitLab