|
1 | | -from __future__ import division |
2 | | - |
3 | 1 | import hashlib |
4 | 2 |
|
5 | 3 | import astropy.units as u |
6 | 4 | import numpy as np |
7 | 5 | from astropy import wcs |
8 | 6 | from astropy.coordinates import ICRS, BaseCoordinateFrame, SkyCoord |
9 | 7 | from astropy.io import fits |
10 | | -from past.utils import old_div |
11 | 8 |
|
12 | 9 | from astromodels.functions.function import Function2D, FunctionMeta |
13 | 10 | from astromodels.utils.angular_distance import angular_distance |
@@ -83,7 +80,7 @@ def evaluate(self, x, y, K, sigma_b, l_min, l_max): |
83 | 80 |
|
84 | 81 | return ( |
85 | 82 | K |
86 | | - * np.exp(old_div(-(b**2), (2 * sigma_b**2))) |
| 83 | + * np.exp(-(b**2) / (2 * sigma_b**2)) |
87 | 84 | * np.logical_or( |
88 | 85 | np.logical_and(l > l_min, l < l_max), |
89 | 86 | np.logical_and(l_min > l_max, np.logical_or(l > l_min, l < l_max)), |
@@ -193,10 +190,7 @@ def evaluate(self, x, y, lon0, lat0, sigma): |
193 | 190 | s2 = sigma**2 |
194 | 191 |
|
195 | 192 | return ( |
196 | | - (old_div(180, np.pi)) ** 2 |
197 | | - * 1 |
198 | | - / (2.0 * np.pi * s2) |
199 | | - * np.exp(-0.5 * angsep**2 / s2) |
| 193 | + (180 / np.pi) ** 2 * 1 / (2.0 * np.pi * s2) * np.exp(-0.5 * angsep**2 / s2) |
200 | 194 | ) |
201 | 195 |
|
202 | 196 | def get_boundaries(self): |
@@ -340,15 +334,15 @@ def evaluate(self, x, y, lon0, lat0, a, e, theta): |
340 | 334 |
|
341 | 335 | sin_2phi = np.sin(2.0 * phi * np.pi / 180.0) |
342 | 336 |
|
343 | | - A = old_div(cos2_phi, (2.0 * b**2)) + old_div(sin2_phi, (2.0 * a**2)) |
| 337 | + A = cos2_phi / (2.0 * b**2) + sin2_phi / (2.0 * a**2) |
344 | 338 |
|
345 | | - B = old_div(-sin_2phi, (4.0 * b**2)) + old_div(sin_2phi, (4.0 * a**2)) |
| 339 | + B = -sin_2phi / (4.0 * b**2) + sin_2phi / (4.0 * a**2) |
346 | 340 |
|
347 | | - C = old_div(sin2_phi, (2.0 * b**2)) + old_div(cos2_phi, (2.0 * a**2)) |
| 341 | + C = sin2_phi / (2.0 * b**2) + cos2_phi / (2.0 * a**2) |
348 | 342 |
|
349 | 343 | E = -A * np.power(dX, 2) + 2.0 * B * dX * dY - C * np.power(dY, 2) |
350 | 344 |
|
351 | | - return np.power(old_div(180, np.pi), 2) * 1.0 / (2 * np.pi * a * b) * np.exp(E) |
| 345 | + return np.power(180 / np.pi, 2) * 1.0 / (2 * np.pi * a * b) * np.exp(E) |
352 | 346 |
|
353 | 347 | def get_boundaries(self): |
354 | 348 |
|
@@ -452,12 +446,7 @@ def evaluate(self, x, y, lon0, lat0, radius): |
452 | 446 |
|
453 | 447 | angsep = angular_distance(lon0, lat0, lon, lat) |
454 | 448 |
|
455 | | - return ( |
456 | | - np.power(old_div(180, np.pi), 2) |
457 | | - * 1.0 |
458 | | - / (np.pi * radius**2) |
459 | | - * (angsep <= radius) |
460 | | - ) |
| 449 | + return np.power(180 / np.pi, 2) * 1.0 / (np.pi * radius**2) * (angsep <= radius) |
461 | 450 |
|
462 | 451 | def get_boundaries(self): |
463 | 452 |
|
@@ -614,9 +603,7 @@ def evaluate(self, x, y, lon0, lat0, a, e, theta): |
614 | 603 | angsep2 = angular_distance(self.lon2, self.lat2, lon, lat) |
615 | 604 | angsep = angsep1 + angsep2 |
616 | 605 |
|
617 | | - return ( |
618 | | - np.power(old_div(180, np.pi), 2) * 1.0 / (np.pi * a * b) * (angsep <= 2 * a) |
619 | | - ) |
| 606 | + return np.power(180 / np.pi, 2) * 1.0 / (np.pi * a * b) * (angsep <= 2 * a) |
620 | 607 |
|
621 | 608 | def get_boundaries(self): |
622 | 609 |
|
|
0 commit comments