Commit fa5c17c6 authored by Karsten Wiesner's avatar Karsten Wiesner 💬
Browse files

first version up an running reviewed by sweta

parent 9dc61dfe
......@@ -16,7 +16,6 @@ __status__ = "Preliminary"
from abc import ABCMeta, abstractmethod
import unittest
import math
import inspect
import FastBinary
......@@ -27,7 +26,7 @@ class signal:
__metaclass__ = ABCMeta
def __init__(self,
arm_length = 2.9e9,
arm_length = 2.5e9,
freq = None,
fdot = None,
elat = None,
......@@ -50,16 +49,9 @@ class signal:
:param phi0:
"""
print
print arm_length
print
FastBinary.setL(arm_length)
self.fastbin = FastBinary.FastGalacticBinary()
# probably OK to just use locals instead of self.__ member vars ... lets see
# if we might need them later in methods or derived classes
self.fastbin.Frequency = freq
self.fastbin.FrequencyDerivative = fdot
self.fastbin.EclipticLatitude = elat
......@@ -69,21 +61,13 @@ class signal:
self.fastbin.Polarization = psi
self.fastbin.InitialPhase = phi0
# self.generate_signal()
#@abstractmethod
#def generate_signal(self):
# pass
@abstractmethod
def __call__(self, time = None, sample_period = None):
pass
def AET_xyz(X, Y, Z):
def AET_xyz(self, X, Y, Z):
"""
Sweta: AET calculation seems to be needed only here so we give it a nice and cosy home and protect it from misuse ;-)
Converts TDI observables XYZ, to AET
AET are mathematical quantities built out of doppler observables
Each A, E and T are a set of three optimal TDI observables which have noises
......@@ -96,7 +80,6 @@ class signal:
"""
return (Z - X) / math.sqrt(2.0), (X - 2.0 * Y + Z) / math.sqrt(6.0), (X + Y + Z) / math.sqrt(3.0)
# Time domain signal generators ---
class td_signal(signal):
......@@ -211,43 +194,30 @@ class fd_aet_signal(signal):
Af, Ef, Tf = self.AET_xyz(hf,Yf,Zf)
return [Af, Ef]
######################## Unittest Section ################################
class TestSignal(unittest.TestCase):
def test_td_signal(self):
my_td_binary = td_signal(freq = 1.0, fdot = 2.0, elat = 3.0, elon = 4.0, ampl = 5.0, inc = 6.0, psi = 7.0, phi0 = 8.0)
# time needs to be int for fastbinary ?
outcome = my_td_binary(time = int(16342456), sample_period = 0.123)
my_binary = td_signal(freq = 1e-3, fdot = 1e-17, elat = 1.0, elon = 4.0, ampl = 1e-23, inc = 3.14, psi = 3.14, phi0 = 3.14)
outcome = my_binary(time = int(2**25), sample_period = 15)
print(outcome)
print
print(inspect.getargspec(signal.__init__))
print(inspect.getargspec(my_td_binary.__call__))
print
#self.assertEqual('foo'.upper(), 'FOO')
def test_td_aet_signal(self):
pass
#self.assertTrue('FOO'.isupper())
#self.assertFalse('Foo'.isupper())
my_binary = td_aet_signal(freq = 1e-3, fdot = 1e-17, elat = 1.0, elon = 4.0, ampl = 1e-23, inc = 3.14, psi = 3.14, phi0 = 3.14)
outcome = my_binary(time = int(2**25), sample_period = 15)
print(outcome)
def test_fd_signal(self):
pass
my_binary = fd_signal(freq = 1e-3, fdot = 1e-17, elat = 1.0, elon = 4.0, ampl = 1e-23, inc = 3.14, psi = 3.14, phi0 = 3.14)
outcome = my_binary(time = int(2**25), sample_period = 15)
print(outcome)
def test_fd_aet_signal(self):
pass
#s = 'hello world'
#self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
#with self.assertRaises(TypeError):
# s.split(2)
my_binary = fd_aet_signal(freq = 1e-3, fdot = 1e-17, elat = 1.0, elon = 4.0, ampl = 1e-23, inc = 3.14, psi = 3.14, phi0 = 3.14)
outcome = my_binary(time = int(2**25), sample_period = 15)
print(outcome)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSignal)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment