@@ -1542,52 +1542,10 @@ def _pyse(
15421542 det = extract .Detection (param , self , chunk = chunk )
15431543 results .append (det )
15441544
1545- def is_usable (det ):
1546- """Check that both ends of each axis are usable.
1547-
1548- I.e., they fall within an unmasked part of the image. The
1549- axis will not likely fall exactly on a pixel number, so
1550- check all the surroundings.
1551-
1552- """
1553-
1554- def check_point (x , y ):
1555- x = (int (x ), int (np .ceil (x )))
1556- y = (int (y ), int (np .ceil (y )))
1557- for position in itertools .product (x , y ):
1558- try :
1559- if self .data .mask [position [0 ], position [1 ]]:
1560- # Point falls in mask
1561- return False
1562- except IndexError :
1563- # Point falls completely outside image
1564- return False
1565- # Point is ok
1566- return True
1567-
1568- for point in (
1569- (det .start_smaj_x , det .start_smaj_y ),
1570- (det .start_smin_x , det .start_smin_y ),
1571- (det .end_smaj_x , det .end_smaj_y ),
1572- (det .end_smin_x , det .end_smin_y ),
1573- ):
1574- if not check_point (* point ):
1575- logger .debug (
1576- "Unphysical source at pixel %f, %f"
1577- % (det .x .value , det .y .value )
1578- )
1579- return False
1580- return True
1581-
1582- filtered_results = containers .ExtractionResults (
1583- list (filter (is_usable , results ))
1584- )
15851545 if self .conf .export .pandas_df :
1586- serialized_filtered_results = [
1587- r .serialize (self .conf , every_parm = True )
1588- for r in filtered_results
1546+ serialized_results = [
1547+ r .serialize (self .conf , every_parm = True ) for r in results
15891548 ]
15901549 return pd .DataFrame (serialized_filtered_results )
15911550 else :
1592- # Filter will return a list; ensure we return an ExtractionResults.
1593- return filtered_results
1551+ return results
0 commit comments