diff --git a/pyfstat/core.py b/pyfstat/core.py index 9249248caeb106b13df9fa91d90e534c3578078f..23652e098730448948bcb74bddeba02049e0b4bb 100755 --- a/pyfstat/core.py +++ b/pyfstat/core.py @@ -869,12 +869,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat): self.whatToCompute = lalpulsar.FSTATQ_2F+lalpulsar.FSTATQ_ATOMS_PER_DET self.tboundaries = np.linspace(self.minStartTime, self.maxStartTime, self.nsegs+1) - - def run_semi_coherent_computefstatistic_single_point( - self, F0, F1, F2, Alpha, Delta, asini=None, - period=None, ecc=None, tp=None, argp=None, - record_segments=False): - """ Returns twoF or ln(BSGL) semi-coherently at a single point """ + self.Tcoh = self.tboundaries[1] - self.tboundaries[0] if hasattr(self, 'SFT_timestamps'): if self.tboundaries[0] < self.SFT_timestamps[0]: @@ -886,6 +881,12 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat): 'Semi-coherent end time {} after last SFT timestamp {}' .format(self.tboundaries[-1], self.SFT_timestamps[-1])) + def run_semi_coherent_computefstatistic_single_point( + self, F0, F1, F2, Alpha, Delta, asini=None, + period=None, ecc=None, tp=None, argp=None, + record_segments=False): + """ Returns twoF or ln(BSGL) semi-coherently at a single point """ + self.PulsarDopplerParams.fkdot = np.array([F0, F1, F2, 0, 0, 0, 0]) self.PulsarDopplerParams.Alpha = Alpha self.PulsarDopplerParams.Delta = Delta diff --git a/pyfstat/helper_functions.py b/pyfstat/helper_functions.py index f462bc992d07283763ccb90c45c61452d3561fdf..6d3db14e403b6c36dd8d577cac5b06f061418d7a 100644 --- a/pyfstat/helper_functions.py +++ b/pyfstat/helper_functions.py @@ -35,15 +35,12 @@ def set_up_matplotlib_defaults(): def set_up_command_line_arguments(): parser = argparse.ArgumentParser() - parser.add_argument("-q", "--quite", help="Decrease output verbosity", - action="store_true") - parser.add_argument("-v", "--verbose", help="Increase output verbosity", - action="store_true") - parser.add_argument("-l", "--set-log-level", default=None, - choices=['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', - 'CRITICAL'], - help=("Set log level, see https://docs.python.org/2/" - "library/logging.html#levels, overides -q/v")) + parser.add_argument("-v", "--verbose", action="store_true", + help="Increase output verbosity [logging.DEBUG]") + parser.add_argument("-q", "--quite", action="store_true", + help="Decrease output verbosity [logging.WARNGING]") + parser.add_argument("-vq", "--very_quite", action="store_true", + help="Increase output verbosity [logging.ERROR]") parser.add_argument("--no-interactive", help="Don't use interactive", action="store_true") parser.add_argument("-c", "--clean", help="Don't use cached data", @@ -57,24 +54,28 @@ def set_up_command_line_arguments(): parser.add_argument('unittest_args', nargs='*') args, unknown = parser.parse_known_args() sys.argv[1:] = args.unittest_args + if args.quite or args.no_interactive: def tqdm(x, *args, **kwargs): return x else: tqdm = set_up_optional_tqdm() + logger = logging.getLogger() - logger.setLevel(logging.INFO) stream_handler = logging.StreamHandler() + stream_handler.setFormatter(logging.Formatter( + '%(asctime)s %(levelname)-8s: %(message)s', datefmt='%H:%M')) + if args.quite: + logger.setLevel(logging.WARNING) stream_handler.setLevel(logging.WARNING) elif args.verbose: + logger.setLevel(logging.DEBUG) stream_handler.setLevel(logging.DEBUG) else: + logger.setLevel(logging.INFO) stream_handler.setLevel(logging.INFO) - if args.set_log_level: - stream_handler.setLevel(getattr(logging, args.set_log_level)) - stream_handler.setFormatter(logging.Formatter( - '%(asctime)s %(levelname)-8s: %(message)s', datefmt='%H:%M')) + logger.addHandler(stream_handler) return args, tqdm