Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ __pycache__
*.pdf
*.txt
*.fits
build
dist
schnell.egg-info
30,276 changes: 30,276 additions & 0 deletions _test2.ipynb

Large diffs are not rendered by default.

60,360 changes: 60,360 additions & 0 deletions _tests.ipynb

Large diffs are not rendered by default.

118 changes: 63 additions & 55 deletions examples/Nell_example.ipynb

Large diffs are not rendered by default.

1,558 changes: 1,558 additions & 0 deletions mlisa_test.ipynb

Large diffs are not rendered by default.

Binary file added npy_saves/nell_angles.npy
Binary file not shown.
Binary file added npy_saves/nell_inv_TL_1.npy
Binary file not shown.
Binary file added npy_saves/nell_inv_TL_2.npy
Binary file not shown.
Binary file added npy_saves/nell_inv_TL_3.npy
Binary file not shown.
Binary file added npy_saves/nell_inv_TL_L.npy
Binary file not shown.
Binary file added npy_saves/nlL.npy
Binary file not shown.
Binary file added npy_saves/nlML_2.npy
Binary file not shown.
Binary file added npy_saves/nlML_5.npy
Binary file not shown.
Binary file added npy_saves/nlTL.npy
Binary file not shown.
Binary file added npy_saves/nlTL_opposite.npy
Binary file not shown.
Binary file added npy_saves/nl_ML3.npy
Binary file not shown.
Binary file added npy_saves/nl_ML4.npy
Binary file not shown.
Binary file added npy_saves/nl_ML5.npy
Binary file not shown.
Binary file added npy_saves/nl_ML6.npy
Binary file not shown.
Binary file added npy_saves/nl_ML7.npy
Binary file not shown.
Binary file added npy_saves/nl_ML8.npy
Binary file not shown.
Binary file added npy_saves/nl_ML9.npy
Binary file not shown.
Binary file added npy_saves/nl_dist_pi.npy
Binary file not shown.
Binary file added npy_saves/nl_dist_zero.npy
Binary file not shown.
Binary file added npy_saves/tl_dist_pi.npy
Binary file not shown.
12 changes: 10 additions & 2 deletions schnell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
NoiseCorrelationConstantIdentity,
NoiseCorrelationConstantR,
NoiseCorrelationFromFunctions,
NoiseCorrelationLISA)
NoiseCorrelationLISA,
NoiseCorrelationLISAlike,
NoiseCorrelationLISALIA,
NoiseCorrelationTwoLISA,
NoiseCorrelationMultipleLISA)
from .detector import ( # noqa
Detector, GroundDetectorTriangle,
GroundDetector, LISADetector)
GroundDetector, LISADetector, ALIADetector,
BBOStarDetector, BBODetector)
from .space_detector import ( # noqa
LISAlikeDetector, LISADetector2, ALIADetector2, LISAandALIADetector,
TwoLISADetector, MultipleLISADetector)
__version__ = '0.2.0'
145 changes: 143 additions & 2 deletions schnell/correlation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from .detector import LISADetector
from .detector import LISADetector, LISAlikeDetector
from .space_detector import LISADetector2, ALIADetector2, LISAandALIADetector


class NoiseCorrelationBase(object):
Expand Down Expand Up @@ -125,7 +126,147 @@ class NoiseCorrelationLISA(NoiseCorrelationFromFunctions):
"""
def __init__(self, det):
self.ndet = 3
if not isinstance(det, LISADetector):
if not (isinstance(det, LISADetector) or isinstance(det, LISADetector2)):
raise ValueError("`det` must be of type LISADetector")
self.psda = det.psd_A
self.psdx = det.psd_X


class NoiseCorrelationLISAlike(NoiseCorrelationFromFunctions):
""" This implements the noise correlation
matrix for LISA-like detectors.

Args:
det: :class:`~schnell.LISAlikeDetector` object.
"""
def __init__(self, det):
self.ndet = 3
if not (isinstance(det, LISAlikeDetector)):
raise ValueError("`det` must be of type LISAlikeDetector")
self.psda = det.psd_A
self.psdx = det.psd_X


class NoiseCorrelationLISALIA(NoiseCorrelationBase):
""" This implements the correlation matrix for LISA and ALIA combined.

Args:
det: :class:`~schnell.LISAandALIADetector` object.
"""
def __init__(self, det):
self.ndet = 6
LISAdet = LISADetector2(0, is_L5Gm=det.is_L5Gm,
static=det.detector.static,
include_GCN=det.detector.include_GCN,
mission_duration=det.detector.mission_duration)
ALIAdet = ALIADetector2(0, static=det.detector.static,
include_GCN=det.detector.include_GCN,
mission_duration=det.detector.mission_duration)
self.psdaL = LISAdet.psd_A
self.psdxL = LISAdet.psd_X
self.psdaA = ALIAdet.psd_A
self.psdxA = ALIAdet.psd_X

def _rhoL(self, f):
a = self.psdaL(f)
x = self.psdxL(f)
return x/a

def _rhoA(self, f):
a = self.psdaA(f)
x = self.psdxA(f)
return x/a

def _get_corrmat(self, f):
f_use = np.atleast_1d(f)
rL = self._rhoL(f_use)
rA = self._rhoA(f_use)
mat = np.zeros([len(f_use), 6, 6])
for i in range(3):
mat[:, i, i] = 1
for j in range(i+1, 3):
mat[:, i, j] = rL
mat[:, j, i] = rL
for i in range(3, 6):
mat[:, i, i] = 1
for j in range(i+1, 6):
mat[:, i, j] = rA
mat[:, j, i] = rA
return mat


class NoiseCorrelationTwoLISA(NoiseCorrelationBase):
""" This implements the correlation matrix for LISA and ALIA combined.

Args:
det: :class:`~schnell.LISAandALIADetector` object.
"""
def __init__(self, det):
self.ndet = 6
LISA1det = LISADetector2(0, is_L5Gm=det.is_L5Gm,
static=det.detector.static,
include_GCN=det.detector.include_GCN,
mission_duration=det.detector.mission_duration)
LISA2det = LISADetector2(0, is_L5Gm=det.is_L5Gm,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need two copies of this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all, I will change this

static=det.detector.static,
include_GCN=det.detector.include_GCN,
mission_duration=det.detector.mission_duration)
self.psdaL1 = LISA1det.psd_A
self.psdxL1 = LISA1det.psd_X
self.psdaL2 = LISA2det.psd_A
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

self.psdxL2 = LISA2det.psd_X

def _rhoL1(self, f):
a = self.psdaL1(f)
x = self.psdxL1(f)
return x/a

def _rhoL2(self, f):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or this? Is this notthe same as _rhoL1?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

a = self.psdaL2(f)
x = self.psdxL2(f)
return x/a

def _get_corrmat(self, f):
f_use = np.atleast_1d(f)
rL1 = self._rhoL1(f_use)
rL2 = self._rhoL2(f_use)
mat = np.zeros([len(f_use), 6, 6])
for i in range(3):
mat[:, i, i] = 1
for j in range(i+1, 3):
mat[:, i, j] = rL1
mat[:, j, i] = rL1
for i in range(3, 6):
mat[:, i, i] = 1
for j in range(i+1, 6):
mat[:, i, j] = rL2
mat[:, j, i] = rL2
return mat

class NoiseCorrelationMultipleLISA(NoiseCorrelationBase):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the TwoLISA case if you have this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no, indeed

def __init__(self, det):
self.ndet = det.nb_detectors * 3
LISAdet = LISADetector2(0, is_L5Gm=det.is_L5Gm,
static=det.detector.static,
include_GCN=det.detector.include_GCN,
mission_duration=det.detector.mission_duration)
self.psdaL = LISAdet.psd_A
self.psdxL = LISAdet.psd_X

def _rhoL(self, f):
a = self.psdaL(f)
x = self.psdxL(f)
return x/a

def _get_corrmat(self, f):
f_use = np.atleast_1d(f)
rL = self._rhoL(f_use)
mat = np.zeros((len(f_use), self.ndet, self.ndet))
for detnb in range(self.ndet // 3):
offset = 3 * detnb
for i in range(3):
mat[:, offset+i, offset+i] = 1
for j in range(i+1, 3):
mat[:, offset+i, offset+j] = rL
mat[:, offset+j, offset+i] = rL
return mat
Loading