From 69926e839154a8af8a811d13b42a82592f20f38f Mon Sep 17 00:00:00 2001 From: astrofle Date: Thu, 19 Sep 2024 14:49:38 -0400 Subject: [PATCH 1/2] Add: version flag for dysh cli --- src/dysh/shell/shell.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dysh/shell/shell.py b/src/dysh/shell/shell.py index 49bfa7d6..738e7b14 100644 --- a/src/dysh/shell/shell.py +++ b/src/dysh/shell/shell.py @@ -1,5 +1,6 @@ import argparse import logging +import sys from pathlib import Path from typing import List, Union @@ -53,6 +54,7 @@ def parse_args(): parser.add_argument("-v", "--verbosity", help="Set logging verbosity", type=int, default=2, choices=[0, 1, 2, 3]) parser.add_argument("--log", help="Specify log path", type=Path) parser.add_argument("-q", "--quiet", help="Silence DEBUG- and INFO-level logs to stderr", action="store_true") + parser.add_argument("--version", help="Print version and exit", action="store_true") return parser.parse_known_args() @@ -91,6 +93,9 @@ def open_sdfits_files(paths: List[Path], loader_class_name="GBTFITSLoad") -> Lis def main(): args, remaining_args = parse_args() + if args.version: + print(__version__) + sys.exit(0) init_logging(verbosity=args.verbosity, path=args.log, quiet=args.quiet) sdfits_files = open_sdfits_files(args.paths, args.fits_loader) init_shell(*remaining_args, colors=args.colors, profile=args.profile, sdfits_files=sdfits_files) From 188506104b0a55b114cd2f3f2a14d770935ca040 Mon Sep 17 00:00:00 2001 From: astrofle Date: Thu, 19 Sep 2024 14:32:22 -0400 Subject: [PATCH 2/2] Fix: removes leftover print statements --- src/dysh/spectra/scan.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/dysh/spectra/scan.py b/src/dysh/spectra/scan.py index cdebc926..94a75925 100644 --- a/src/dysh/spectra/scan.py +++ b/src/dysh/spectra/scan.py @@ -866,7 +866,6 @@ def delta_freq(self): def tpmeta(self, i): ser = self._sdfits.index(bintable=self._bintable_index).iloc[self._scanrows[i]] - # meta = self._sdfits.index(bintable=self._bintable_index).iloc[self._scanrows[i]].dropna().to_dict() meta = ser.dropna().to_dict() meta["TSYS"] = self._tsys[i] meta["EXPOSURE"] = self.exposure[i] @@ -896,7 +895,6 @@ def total_power(self, i): if not self._calibrate: raise Exception("You must calibrate first to get a total power spectrum") ser = self._sdfits.index(bintable=self._bintable_index).iloc[self._scanrows[i]] - # meta = self._sdfits.index(bintable=self._bintable_index).iloc[self._scanrows[i]].dropna().to_dict() meta = ser.dropna().to_dict() meta["TSYS"] = self._tsys[i] meta["EXPOSURE"] = self.exposure[i] @@ -910,8 +908,6 @@ def total_power(self, i): restfreq = rfq.to("Hz").value meta["RESTFRQ"] = restfreq # WCS wants no E s = Spectrum.make_spectrum(self._data[i] * u.ct, meta, observer_location=self._observer_location) - print(f"TP {self._history =} {self._comments = }") - print(f"Spectrum history after make_spectrum {type(s._history)} : {s._history}") s.merge_commentary(self) return s @@ -948,7 +944,6 @@ def timeaverage(self, weights="tsys"): return self._timeaveraged -# @todo 'scans' should become 'scan' class PSScan(ScanBase): """GBT specific version of Position Switch Scan. A position switch scan object has one IF, one feed, and one or more polarizations.