Skip to content

Commit

Permalink
Option to search for a single source in bfr5 files.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielczech committed Apr 2, 2024
1 parent 7fa0f16 commit 12e1156
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions scripts/obs-stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,38 @@ def cli(args = sys.argv[0]):
default = False,
help = "Plot the sky map.")


parser.add_argument("-f",
type = str,
default = None,
help = "Find the specified source.")

if len(sys.argv[1:]) == 0:
parser.print_help()
parser.exit()
args = parser.parse_args()

if args.d:
aggregate(directory = args.d, output = args.o)

if args.p:
plot_coverage(args.i)

elif args.f:
if not args.d:
print("Please specify directory.")
else:
find(args.f, args.d)

elif args.d:
aggregate(directory = args.d, output = args.o)


def find(source, directory):
"""Find the particular source in existing bfr5 files.
"""
file_list = list_bfr5_files(directory)
for f in file_list:
srcs, primary = read_bfr5(f)
if any(source in src for src in srcs):
print(f"{source} appears in {f}")

def aggregate(directory, output):
"""Aggregate recordings by looking at bfr5 files.
Expand Down

0 comments on commit 12e1156

Please sign in to comment.