File: Fix_root_equation-in-shadow.patch

package info (click to toggle)
einsteinpy 0.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,712 kB
  • sloc: python: 8,196; makefile: 146
file content (72 lines) | stat: -rw-r--r-- 2,665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
commit 48a1a4aefe7257459c23d75731029a3fa295f829
Author: Jyotirmaya Shivottam <31299799+JeS24@users.noreply.github.com>
Date:   Fri Sep 22 19:06:13 2023 +0530

    Fixes #636, #637 | Changes to mpl anim in ipynb

diff --git a/src/einsteinpy/hypersurface/schwarzschildembedding.py b/src/einsteinpy/hypersurface/schwarzschildembedding.py
index a226411..164be8a 100644
--- a/src/einsteinpy/hypersurface/schwarzschildembedding.py
+++ b/src/einsteinpy/hypersurface/schwarzschildembedding.py
@@ -22,7 +22,6 @@ class SchwarzschildEmbedding:
     """
 
     def __init__(self, M):
-
         """
         Constructor
         Initialize mass and embedding initial radial coordinate in appropiate units
@@ -45,7 +44,6 @@ class SchwarzschildEmbedding:
         )
 
     def gradient(self, r):
-
         """
         Calculate gradient of Z coordinate w.r.t r to update the value of r and
         thereby get value of spherical radial coordinate R.
@@ -72,7 +70,6 @@ class SchwarzschildEmbedding:
         return num_one * num_two / deno
 
     def radial_coord(self, r):
-
         """
         Returns spherical radial coordinate (of the embedding) from given schwarzschild
         coordinate.
@@ -90,7 +87,6 @@ class SchwarzschildEmbedding:
         return r / np.sqrt(1 - (2 * self.M.value / r))
 
     def get_values(self, alpha):
-
         """
         Obtain the Z coordinate values and corrosponding R values for range of
         r as 9m/4 < r < 9m.
@@ -130,7 +126,6 @@ class SchwarzschildEmbedding:
         return x_axis, y_axis
 
     def get_values_surface(self, alpha):
-
         """
         Obtain the same values as of the get_values function but reshapes them to obtain
         values for all points on the solid of revolution about Z axis (as the
diff --git a/src/einsteinpy/rays/shadow.py b/src/einsteinpy/rays/shadow.py
index 5fea7b9..f09adab 100644
--- a/src/einsteinpy/rays/shadow.py
+++ b/src/einsteinpy/rays/shadow.py
@@ -24,7 +24,6 @@ class Shadow:
         self.b = self._compute_B()
         self.z = list()
         self.bfin = list()
-        warnings.filterwarnings("ignore")
         for i in self.b:
             root = newton(self._root_equation, 0.1, args=(i,))
             if np.isreal(root):
@@ -48,7 +47,8 @@ class Shadow:
         """
         Returns the root of the equation for ``r_tp`` (turning points) for some impact parameter
         """
-        return r_tp / ((1 - (2 * int(self.mass.value) / r_tp))) ** 0.5 - i
+        # emath.sqrt is domain-agnostic and this is a complex equation
+        return r_tp / np.emath.sqrt(1 - (2 * int(self.mass.value) / r_tp)) - i
 
     def _intensity_blue_sch(self, r, b):
         """