@@ -563,7 +563,7 @@ def _convertImage(image):
563
563
def EstimateShear (gal_image , PSF_image , weight = None , badpix = None , sky_var = 0.0 ,
564
564
shear_est = "REGAUSS" , recompute_flux = "FIT" , guess_sig_gal = 5.0 ,
565
565
guess_sig_PSF = 3.0 , precision = 1.0e-6 , guess_centroid = None ,
566
- strict = True , hsmparams = None ):
566
+ strict = True , check = True , hsmparams = None ):
567
567
"""Carry out moments-based PSF correction routines.
568
568
569
569
Carry out PSF correction using one of the methods of the HSM package (see references in
@@ -667,6 +667,9 @@ def EstimateShear(gal_image, PSF_image, weight=None, badpix=None, sky_var=0.0,
667
667
``False``, then information about failures will be silently stored in
668
668
the output ShapeData object. [default: True]
669
669
670
+ check: Check if the object_image, weight are in the correct format and valid.
671
+ [default: True]
672
+
670
673
hsmparams: The hsmparams keyword can be used to change the settings used by
671
674
`EstimateShear` when estimating shears; see `HSMParams` documentation
672
675
for more information. [default: None]
@@ -677,11 +680,11 @@ def EstimateShear(gal_image, PSF_image, weight=None, badpix=None, sky_var=0.0,
677
680
# prepare inputs to C++ routines: ImageF or ImageD for galaxy, PSF, and ImageI for weight map
678
681
gal_image = _convertImage (gal_image )
679
682
PSF_image = _convertImage (PSF_image )
680
- _checkWeightAndBadpix (gal_image , weight = weight , badpix = badpix )
681
683
hsmparams = HSMParams .check (hsmparams )
684
+ if check :
685
+ _checkWeightAndBadpix (gal_image , weight = weight , badpix = badpix )
682
686
weight = _convertMask (gal_image , weight = weight , badpix = badpix )
683
687
684
-
685
688
if guess_centroid is None :
686
689
guess_centroid = gal_image .true_center
687
690
try :
@@ -699,7 +702,7 @@ def EstimateShear(gal_image, PSF_image, weight=None, badpix=None, sky_var=0.0,
699
702
return ShapeData (error_message = str (err ))
700
703
701
704
def FindAdaptiveMom (object_image , weight = None , badpix = None , guess_sig = 5.0 , precision = 1.0e-6 ,
702
- guess_centroid = None , strict = True , round_moments = False , hsmparams = None ,
705
+ guess_centroid = None , strict = True , check = True , round_moments = False , hsmparams = None ,
703
706
use_sky_coords = False ):
704
707
"""Measure adaptive moments of an object.
705
708
@@ -797,6 +800,8 @@ def FindAdaptiveMom(object_image, weight=None, badpix=None, guess_sig=5.0, preci
797
800
``GalSimHSMError`` exception if shear estimation fails. If set to
798
801
``False``, then information about failures will be silently stored in
799
802
the output ShapeData object. [default: True]
803
+ check: Check if the object_image, weight are in the correct format and valid.
804
+ [default: True]
800
805
round_moments: Use a circular weight function instead of elliptical.
801
806
[default: False]
802
807
hsmparams: The hsmparams keyword can be used to change the settings used by
@@ -812,9 +817,10 @@ def FindAdaptiveMom(object_image, weight=None, badpix=None, guess_sig=5.0, preci
812
817
"""
813
818
# prepare inputs to C++ routines: ImageF or ImageD for galaxy, PSF, and ImageI for weight map
814
819
object_image = _convertImage (object_image )
815
-
816
- _checkWeightAndBadpix (object_image , weight = weight , badpix = badpix )
817
820
hsmparams = HSMParams .check (hsmparams )
821
+ if check :
822
+ _checkWeightAndBadpix (object_image , weight = weight , badpix = badpix )
823
+
818
824
weight = _convertMask (object_image , weight = weight , badpix = badpix )
819
825
820
826
if guess_centroid is None :
0 commit comments