-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_deSitterRadii.py
52 lines (44 loc) · 1.57 KB
/
test_deSitterRadii.py
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
#!/usr/bin/env python
'''
Created on 16 Aug 2021
@author: Christoph Minz
@license: BSD 3-Clause
'''
from __future__ import annotations
import unittest
import numpy as np
from causets.spacetimes import Spacetime # @UnresolvedImport @UnusedImport
from causets.spacetimes import deSitterSpacetime # @UnresolvedImport
import causets.shapes as shp # @UnresolvedImport @UnusedImport
from causets.shapes import CircleEdge # @UnresolvedImport
from matplotlib import pyplot as plt, axes
class TestDeSitterSpacetime(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_RadiiFit(self):
# plot parameters:
a: float = 1.50
spacetime: Spacetime = deSitterSpacetime(3, a)
spacetime
dims: List[int] = [1, 2]
pr: float = 1.1 * a
# plot cone origin and set axes limits:
startpoint: np.ndarray = np.array([0.0, 0 * a, 0 * a])
plt.figure(figsize=(8.0, 8.0))
A: axes
p: shp.patches.Patch
A = plt.gca()
p = shp.patches.Polygon(CircleEdge(np.array([0.0, 0.0, 0.0]), a),
color='gray', alpha=0.1)
A.add_patch(p)
plt.plot([0.0], [0.0], 'xk')
plt.plot([startpoint[dims[0]]], [startpoint[dims[1]]], 'ok')
A.set(xlim=[-pr, pr], ylim=[-pr, pr])
XY = spacetime._XY_slice(0.7 * a, startpoint, dims)
p = shp.patches.Polygon(XY, color='green', alpha=0.3)
A.add_patch(p)
plt.show()
if __name__ == '__main__':
unittest.main()