@@ -115,31 +115,31 @@ def run():
115115
116116 return "" , HTTP_204
117117
118- def y_to_Y (band ):
118+ def _y_to_Y (band ):
119119 if band == 'y' :
120120 return 'Y'
121121 return band
122122
123123# this could use improvement
124- def get_photflag (flux , flux_err ):
124+ def _get_photflag (flux , flux_err ):
125125 if flux_err > 5 * abs (flux ):
126126 return 1024
127127 elif abs (flux ) < max (100 , flux_err ):
128128 return 0
129129 else :
130130 return 4096
131131
132- def _format_for_classifier (alert : pittgoogle .Alert ) -> pd .DataFrame :
132+ def _format_for_classifier (alert_lite : pittgoogle .Alert ) -> pd .DataFrame :
133133 """Create a DataFrame for input to ORACLE."""
134- alert_dict = alert .dict ['alert_lite' ]
135- source_dicts = [alert_dict ['diaSource' ]] + alert_dict ['prvDiaSources' ] + alert_dict ['prvDiaForcedSources' ]
134+ alert_lite_dict = alert_lite .dict ['alert_lite' ]
135+ source_dicts = [alert_lite_dict ['diaSource' ]] + alert_lite_dict ['prvDiaSources' ] + alert_lite_dict ['prvDiaForcedSources' ]
136136
137137 MJD_min = min ([source_dict ['midpointMjdTai' ] for source_dict in source_dicts ])
138138 df = pd .DataFrame ({'MJD' : [source_dict ['midpointMjdTai' ] - MJD_min for source_dict in source_dicts ], # start dates at 0
139- 'BAND' : [y_to_Y (source_dict ['band' ]) for source_dict in source_dicts ], # ORACLE wants Y band to be capital
139+ 'BAND' : [_y_to_Y (source_dict ['band' ]) for source_dict in source_dicts ], # ORACLE wants Y band to be capital
140140 'FLUXCAL' : [source_dict ['psfFlux' ] for source_dict in source_dicts ],
141141 'FLUXCALERR' : [source_dict ['psfFluxErr' ] for source_dict in source_dicts ],
142- 'PHOTFLAG' : [get_photflag (source_dict ['psfFlux' ], source_dict ['psfFluxErr' ]) for source_dict in source_dicts ]})
142+ 'PHOTFLAG' : [_get_photflag (source_dict ['psfFlux' ], source_dict ['psfFluxErr' ]) for source_dict in source_dicts ]})
143143 return df .sort_values (by = ['MJD' ])
144144
145145def _most_likely_class (probability_dict : dict , keys : list ) -> tuple [str , float ]:
0 commit comments