Repository: gwastro/pycbc

Issue:
#2551 broke PyCBC Live with standard options
After #2551, it is no longer possible to use `--single-newsnr-threshold 10` because of this error:
```
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tito/projects/pycbc/live/multidetector/env/lib/python2.7/site-packages/mpi4py/__main__.py", line 7, in <module>
    main()
  File "/home/tito/projects/pycbc/live/multidetector/env/lib/python2.7/site-packages/mpi4py/run.py", line 196, in main
    run_command_line(args)
  File "/home/tito/projects/pycbc/live/multidetector/env/lib/python2.7/site-packages/mpi4py/run.py", line 47, in run_command_line
    run_path(sys.argv[0], run_name='__main__')
  File "/usr/lib64/python2.7/runpy.py", line 240, in run_path
    return _run_module_code(code, init_globals, run_name, path_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tito/projects/pycbc/live/multidetector/env/bin/pycbc_live", line 401, in <module>
    args = parser.parse_args()
  File "/usr/lib64/python2.7/argparse.py", line 1688, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib64/python2.7/argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib64/python2.7/argparse.py", line 1926, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib64/python2.7/argparse.py", line 1866, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib64/python2.7/argparse.py", line 1794, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/tito/projects/pycbc/live/multidetector/env/lib/python2.7/site-packages/pycbc/types/optparse.py", line 102, in __call__
    raise ValueError(err_msg)
ValueError: Issue with option: single_newsnr_threshold
Received value: 1 0
If you are supplying a value for all ifos, you must only supply one value.
```
@spxiwh I think this is for you. Looks like the `10` string is interpreted as a list, or something like that.


Discussion:

Resolving patch:
diff --git a/pycbc/events/single.py b/pycbc/events/single.py
--- a/pycbc/events/single.py
+++ b/pycbc/events/single.py
@@ -17,13 +17,13 @@ def __init__(self, ifo,
 
     @staticmethod
     def insert_args(parser):
-        parser.add_argument('--single-newsnr-threshold',
+        parser.add_argument('--single-newsnr-threshold', nargs='+',
                             type=float, action=MultiDetOptionAction)
-        parser.add_argument('--single-reduced-chisq-threshold',
+        parser.add_argument('--single-reduced-chisq-threshold', nargs='+',
                             type=float, action=MultiDetOptionAction)
-        parser.add_argument('--single-fixed-ifar',
+        parser.add_argument('--single-fixed-ifar', nargs='+',
                             type=float, action=MultiDetOptionAction)
-        parser.add_argument('--single-duration-threshold',
+        parser.add_argument('--single-duration-threshold', nargs='+',
                             type=float, action=MultiDetOptionAction)
 
     @classmethod
diff --git a/pycbc/types/timeseries.py b/pycbc/types/timeseries.py
--- a/pycbc/types/timeseries.py
+++ b/pycbc/types/timeseries.py
@@ -198,9 +198,11 @@ def get_sample_times(self):
     sample_times = property(get_sample_times,
                             doc="Array containing the sample times.")
 
-    def at_time(self, time):
+    def at_time(self, time, nearest_sample=False):
         """ Return the value at the specified gps time
         """
+        if nearest_sample:
+            time += self.delta_t / 2.0
         return self[int((time-self.start_time)*self.sample_rate)]
 
     def __eq__(self,other):


Test patch: