@@ -1074,6 +1074,11 @@ def wcs_pix2world(self, *args, **kwargs):
10741074
10751075 {1}
10761076
1077+ tolerance : float, optional
1078+ Tolerance of solution. Iteration terminates when the iterative
1079+ solver estimates that the true solution is within this many pixels
1080+ current estimate. Default value is 1e-6 (pixels).
1081+
10771082 Returns
10781083 -------
10791084
@@ -1122,7 +1127,7 @@ def wcs_pix2world(self, *args, **kwargs):
11221127 def wcs_pix2sky (self , * args , ** kwargs ):
11231128 return self .wcs_pix2world (* args , ** kwargs )
11241129
1125- def _all_world2pix (self , world , origin , ** kwargs ):
1130+ def _all_world2pix (self , world , origin , tolerance , ** kwargs ):
11261131 try :
11271132 import scipy .optimize
11281133 except ImportError :
@@ -1139,13 +1144,16 @@ def _all_world2pix(self, world, origin, **kwargs):
11391144 # Scipy version, (b) provides an option for the absolute tolerance,
11401145 # and (c) is suitable for small-scale problems (i.e., a few
11411146 # variables, rather than hundreds of variables).
1142- soln = scipy .optimize .broyden1 (func , x0 , x_tol = 1e-6 )
1147+ soln = scipy .optimize .broyden1 (func , x0 , x_tol = tolerance )
11431148 pixes .append (soln .flatten ())
11441149 return np .asarray (pixes )
11451150 def all_world2pix (self , * args , ** kwargs ):
11461151 if self .wcs is None :
11471152 raise ValueError ("No basic WCS settings were created." )
1148- return self ._array_converter (self ._all_world2pix , 'input' , * args ,
1153+ tolerance = kwargs .pop ('tolerance' , 1e-6 )
1154+ return self ._array_converter (lambda * args , ** kwargs :
1155+ self ._all_world2pix (* args , tolerance = tolerance , ** kwargs ),
1156+ 'input' , * args ,
11491157 ** kwargs )
11501158 all_world2pix .__doc__ = """
11511159 Transforms world coordinates to pixel coordinates, using numerical
0 commit comments