Skip to content

Commit

Permalink
Slackbot paths (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonreusch authored May 23, 2023
1 parent 3fd13e6 commit 27623a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions nuztf/base_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
import pandas
import pandas as pd
import requests
from ampel.ztf.alert.ZiAlertSupplier import ZiAlertSupplier
Expand Down Expand Up @@ -548,12 +547,12 @@ def create_candidate_summary(self):
self.logger.info("No candidates found, skipping pdf creation")
return

pdf_path = self.get_output_dir().joinpath("candidates.pdf")
pdf_path = self.get_output_dir() / "candidates.pdf"

self.logger.info(
f"Creating overview pdf at: {pdf_path}\n"
f"(this might take a moment as it involves catalog matching)"
f"Creating overview pdf\n(this might take a moment as it involves catalog matching)"
)
self.logger.debug(f"Overview pdf path: {pdf_path}")

with PdfPages(pdf_path) as pdf:
for name, alert in tqdm(sorted(self.cache.items())):
Expand All @@ -577,9 +576,10 @@ def create_overview_table(self):
self.logger.info("No candidates found, skipping csv creation")
return

csv_path = self.get_output_dir().joinpath("candidate_table.csv")
csv_path = self.get_output_dir() / "candidate_table.csv"

self.logger.info(f"Creating overview csv at {csv_path}")
self.logger.info("Creating overview csv")
self.logger.debug(f"Overview csv path: {csv_path}")

data = {
"ztf_id": [],
Expand All @@ -601,7 +601,7 @@ def create_overview_table(self):
else:
data["kilonova_score"].append(None)

df = pandas.DataFrame.from_dict(data)
df = pd.DataFrame.from_dict(data)

df.to_csv(csv_path)

Expand Down
4 changes: 2 additions & 2 deletions slackbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def __init__(

if len(self.scanner.cache) > 0:
self.scanner.create_candidate_summary()
pdf_overview_path = self.scanner.summary_path + ".pdf"
pdf_overview_path = self.scanner.get_output_dir() / "candidates.pdf"
self.post_file(pdf_overview_path, f"{self.name}_candidates.pdf")

self.scanner.create_overview_table()
csv_path = self.scanner.summary_path + ".csv"
csv_path = self.scanner.get_output_dir() / "candidate_table.csv"
self.post_file(csv_path, f"{self.name}_candidates.csv")

if do_gcn and len(self.scanner.cache) > 0:
Expand Down

0 comments on commit 27623a6

Please sign in to comment.