From f3a3b8f8f577ee09cdadcd0b2c0a76c1c565997d Mon Sep 17 00:00:00 2001 From: Aaron Viets <aaron.viets@ligo.org> Date: Fri, 22 Feb 2019 10:03:26 -0800 Subject: [PATCH] gstlal-calibration: Found some more print statements to re-format for Python 3. --- gstlal-calibration/bin/gstlal_compute_strain | 16 +++++++++------- .../tests/check_calibration/frame_manipulator.py | 6 +++--- .../check_calibration/pcal2darm_timeseries.py | 4 ++-- .../plot_filters_transfer_function.py | 4 ++-- .../check_calibration/plot_transfer_function.py | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gstlal-calibration/bin/gstlal_compute_strain b/gstlal-calibration/bin/gstlal_compute_strain index d446ecc69e..371ff27b06 100755 --- a/gstlal-calibration/bin/gstlal_compute_strain +++ b/gstlal-calibration/bin/gstlal_compute_strain @@ -49,6 +49,8 @@ For a full list of example command lines that were used to create the O2 h(t) fr Type gstlal_compute_strain --help to see the full list of command line options. """ +from __future__ import print_function + import os import sys import numpy @@ -382,7 +384,7 @@ if filters_name.count('/') > 0: else: # We need to search for the filters file filters_paths = [] - print "\nSearching for %s ..." % filters_name + 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: @@ -401,7 +403,7 @@ 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] + 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 @@ -2615,7 +2617,7 @@ if any(witness_channel_list): if key in witness_channel_list[i]: witnesses.append(calibration_parts.caps_and_progress(pipeline, head_dict[key], "audio/x-raw, format=F64LE, channels=1, channel-mask=(bitmask)0x0", key)) if len(witnesses) != len(witness_channel_list[i]): - print "WARNING: Not all requested witness channels are being used" + print("WARNING: Not all requested witness channels are being used") clean_strain = calibration_parts.clean_data(pipeline, clean_strain, hoft_sr, witnesses, witness_rates[i], witness_fft_samples, witness_fft_overlap, num_witness_ffts, min_witness_ffts, witness_tf_update_samples, witness_fir_samples, witness_frequency_resolution, witness_filter_taper_length, use_median = witness_tf_use_median, parallel_mode = witness_tf_parallel_mode, notch_frequencies = witness_notch_frequencies[i], high_pass = witness_highpasses[i], noisesub_gate_bit = noisesubgatetee, delay_time = witness_delay_time, critical_lock_loss_time = critical_lock_loss_time, filename = None if witness_tf_filename is None else "%s_%d.txt" % (witness_tf_filename, i)) witness_delay_time += witness_delay_increment @@ -2917,23 +2919,23 @@ if DebuggingConfigs["pipelinegraphfilename"] != "None": # Seek the pipeline when necessary if InputConfigs["datasource"] == "frames": if verbose: - print >>sys.stderr, "seeking GPS start and stop times ..." + print("seeking GPS start and stop times ...", file=sys.stderr) if pipeline.set_state(Gst.State.READY) != Gst.StateChangeReturn.SUCCESS: raise RuntimeError("pipeline failed to enter READY state") datasource.pipeline_seek_for_gps(pipeline, gps_start_time, gps_end_time) if verbose: - print >>sys.stderr, "setting pipeline state to playing ..." + print("setting pipeline state to playing ...", file=sys.stderr) if pipeline.set_state(Gst.State.PLAYING) != Gst.StateChangeReturn.SUCCESS: raise RuntimeError("pipeline failed to enter PLAYING state") else: if verbose: - print "set to playing successfully" + print("set to playing successfully") if DebuggingConfigs["pipelinegraphfilename"] != "None": pipeparts.write_dump_dot(pipeline, "%s.%s" %(DebuggingConfigs["pipelinegraphfilename"], "PLAYING"), verbose = verbose) if verbose: - print >>sys.stderr, "running pipeline ..." + print("running pipeline ...", file=sys.stderr) mainloop.run() diff --git a/gstlal-calibration/tests/check_calibration/frame_manipulator.py b/gstlal-calibration/tests/check_calibration/frame_manipulator.py index c8259e42b1..785902df93 100644 --- a/gstlal-calibration/tests/check_calibration/frame_manipulator.py +++ b/gstlal-calibration/tests/check_calibration/frame_manipulator.py @@ -95,9 +95,9 @@ try: f = open('frchannels.txt', 'r') available_channels = f.read() f.close() - print "Making channel list using available channels" + print("Making channel list using available channels") except: - print "Cannot find file frchannels.txt. Run FrChannels to check for available channels" + print("Cannot find file frchannels.txt. Run FrChannels to check for available channels") # These are (or may be) in the calibrated frames channel_list.append(chan_prefix + "CALIB_STRAIN" + chan_suffix) @@ -300,7 +300,7 @@ for chan in temp_list: if chan in available_channels: channel_list.append(chan) -print "Finished channel list" +print("Finished channel list") ifo_channel_list = [] for chan in channel_list: diff --git a/gstlal-calibration/tests/check_calibration/pcal2darm_timeseries.py b/gstlal-calibration/tests/check_calibration/pcal2darm_timeseries.py index 84d8dad671..a849090281 100644 --- a/gstlal-calibration/tests/check_calibration/pcal2darm_timeseries.py +++ b/gstlal-calibration/tests/check_calibration/pcal2darm_timeseries.py @@ -110,7 +110,7 @@ if filters_name.count('/') > 0: else: # We need to search for the filters file filters_paths = [] - print "\nSearching for %s ..." % filters_name + 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: @@ -129,7 +129,7 @@ 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] + print("Loading calibration filters from %s\n" % filters_paths[0]) filters = numpy.load(filters_paths[0]) ifo = options.ifo diff --git a/gstlal-calibration/tests/check_calibration/plot_filters_transfer_function.py b/gstlal-calibration/tests/check_calibration/plot_filters_transfer_function.py index 9a21ca31f6..97912d9e2c 100644 --- a/gstlal-calibration/tests/check_calibration/plot_filters_transfer_function.py +++ b/gstlal-calibration/tests/check_calibration/plot_filters_transfer_function.py @@ -74,7 +74,7 @@ for tf_file in tf_files: filters_name = tf_file.split('_npz')[0] + '.npz' # Search the directory tree for filters files with names matching the one we want. filters_paths = [] - print "\nSearching for %s ..." % filters_name + 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: @@ -93,7 +93,7 @@ for tf_file in tf_files: 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] + print("Loading calibration filters from %s\n" % filters_paths[0]) filters = numpy.load(filters_paths[0]) model_jump_delay = options.filters_model_jump_delay diff --git a/gstlal-calibration/tests/check_calibration/plot_transfer_function.py b/gstlal-calibration/tests/check_calibration/plot_transfer_function.py index aae66e9b37..91c40dba77 100644 --- a/gstlal-calibration/tests/check_calibration/plot_transfer_function.py +++ b/gstlal-calibration/tests/check_calibration/plot_transfer_function.py @@ -149,7 +149,7 @@ if options.config_file is not None: else: # We need to search for the filters file filters_paths = [] - print "\nSearching for %s ..." % filters_name + 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: @@ -168,7 +168,7 @@ if options.config_file is not None: 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] + print("Loading calibration filters from %s\n" % filters_paths[0]) filters = numpy.load(filters_paths[0]) # Get the corrections for numerators and denominator, and resample if necessary -- GitLab