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
|
import numpy
import unittest
import gyoto.core
import gyoto.std
import inspect
try:
import gyoto.lorene
class TestNeutronStar(unittest.TestCase):
def test_NeutronStar(self):
ao=gyoto.core.Astrobj("NeutronStar")
ao=gyoto.lorene.NeutronStar()
gg=gyoto.std.KerrBL()
with self.assertRaises(gyoto.Error):
ao.metric(gg)
self.assertIsNone(ao.metric())
gg=gyoto.lorene.NumericalMetricLorene()
ao.metric(gg)
self.assertIsNotNone(ao.metric())
ao.metric(None)
self.assertIsNone(ao.metric())
def test_NeutronStarAnalyticEmission(self):
ao=gyoto.core.Astrobj("NeutronStarAnalyticEmission")
ao=gyoto.lorene.NeutronStarAnalyticEmission()
gg=gyoto.std.KerrBL()
with self.assertRaises(gyoto.Error):
ao.metric(gg)
self.assertIsNone(ao.metric())
gg=gyoto.lorene.NumericalMetricLorene()
ao.metric(gg)
self.assertIsNotNone(ao.metric())
ao.metric(None)
self.assertIsNone(ao.metric())
self.assertIsNone(ao.spectrum())
sp=gyoto.std.BlackBody()
ao.spectrum(sp)
self.assertIsNotNone(ao.spectrum())
def test_NeutronStarModelAtmosphere(self):
ao=gyoto.core.Astrobj("NeutronStarModelAtmosphere")
ao=gyoto.lorene.NeutronStarModelAtmosphere()
gg=gyoto.std.KerrBL()
with self.assertRaises(gyoto.Error):
ao.metric(gg)
self.assertIsNone(ao.metric())
gg=gyoto.lorene.NumericalMetricLorene()
ao.metric(gg)
self.assertIsNotNone(ao.metric())
ao.metric(None)
self.assertIsNone(ao.metric())
class TestRotStar3_1(unittest.TestCase):
def test_christoffel(self):
metric=gyoto.lorene.RotStar3_1()
try:
metric.file('../bin/.check-lorene/resu.d')
except gyoto.core.Error as e:
self.skipTest('RotStar3_1::christoffel (metric needs to be precomputed)')
try:
gyoto.metric.check_christoffel(metric)
except AssertionError as e:
self.fail(e.__str__())
except ImportError:
import warnings
warnings.warn('Could not load plug-in "lorene"')
|