1818import os
1919
2020import numpy as np
21- from pyspark .sql .functions import pandas_udf
21+ import pyspark .sql .functions as F
2222from pyspark .sql .types import ArrayType , FloatType
2323import pandas as pd
2424
3333CONFIGS .update (CONFIGS_BASE )
3434
3535
36- @pandas_udf (ArrayType (FloatType ()))
36+ @F . pandas_udf (ArrayType (FloatType ()))
3737@profile
3838def run_base_potential_hostless (
3939 cutoutScience : pd .Series ,
@@ -93,7 +93,7 @@ def run_base_potential_hostless(
9393 return pd .Series (kstest_results )
9494
9595
96- @pandas_udf (ArrayType (FloatType ()))
96+ @F . pandas_udf (ArrayType (FloatType ()))
9797@profile
9898def run_potential_hostless (
9999 magpsf : pd .Series ,
@@ -188,6 +188,8 @@ def run_potential_hostless(
188188 ... df["roid"]))
189189 >>> df.filter(df.kstest_static[0] >= 0).count()
190190 0
191+ >>> int(df.select(F.sum(F.col("kstest_static")[2])).collect()[0][0])
192+ 11
191193 """
192194 # load the configuration file
193195 hostless_science_class = HostLessExtragalactic (CONFIGS )
@@ -204,7 +206,8 @@ def run_potential_hostless(
204206 c1 = snn_sn_vs_all >= 0.5
205207 c2 = rf_snia_vs_nonia >= 0.5
206208 c3 = rf_kn_vs_nonkn >= 0.5
207-
209+ is_processed_true = 1
210+ is_processed_false = 0
208211 for index in range (cutoutScience .shape [0 ]):
209212 # xmatch conditions
210213 c4 = finkclass [index ] in CONFIGS ["finkclass" ]
@@ -226,11 +229,11 @@ def run_potential_hostless(
226229 science_stamp , template_stamp
227230 )
228231 )
229- kstest_results .append ([kstest_science , kstest_template ])
232+ kstest_results .append ([kstest_science , kstest_template , is_processed_true ])
230233 else :
231- kstest_results .append ([default_result , default_result ])
234+ kstest_results .append ([default_result , default_result , is_processed_false ])
232235 else :
233- kstest_results .append ([default_result , default_result ])
236+ kstest_results .append ([default_result , default_result , is_processed_false ])
234237 return pd .Series (kstest_results )
235238
236239
0 commit comments