Skip to content

Commit 104a507

Browse files
Fix return type for cutouts (#134)
* Fix return type * Use array instead of list
1 parent a607f54 commit 104a507

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

fink_utils/slack_bot/bot_test.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,12 @@ def request(kind):
6262
"output-format": "array",
6363
},
6464
)
65-
return r
66-
67-
def decode_array(content):
68-
pdf = pd.read_json(io.BytesIO(content))
69-
return np.array(pdf[pdf.columns[0]].values[0])
65+
return r.json()["b:cutout{}_stampData".format(kind)]
7066

7167
return (
72-
decode_array(request("Science").content),
73-
decode_array(request("Template").content),
74-
decode_array(request("Difference").content),
68+
np.array(request("Science")),
69+
np.array(request("Template")),
70+
np.array(request("Difference")),
7571
)
7672

7773

fink_utils/tg_bot/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def get_cutout(cutout=None, ztf_id=None, kind="Difference", origin="alert"):
219219
)
220220
if not status_check(r, header=ztf_id):
221221
return io.BytesIO()
222-
data = np.log(np.array(r.json()[0]["b:cutoutScience_stampData"], dtype=float))
222+
data = np.log(np.array(r.json()["b:cutoutScience_stampData"], dtype=float))
223223
plt.axis("off")
224224
plt.imshow(data, cmap="PuBu_r")
225225
buf = io.BytesIO()

0 commit comments

Comments
 (0)