-
Notifications
You must be signed in to change notification settings - Fork 3
Multi-constellation #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 13 commits
2221dc0
5f6e85c
cc21fb6
a91745e
d9c4fbc
8322671
af2fe93
7eece80
24fc2dc
54b08f7
ca7c54b
8d25832
8f3edd6
a70bf93
5eb1d93
a0d12bd
7cf4a69
42e9bcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,6 @@ __pycache__ | |
| *.txt | ||
| *.fits | ||
| build | ||
| dist | ||
| schnell.egg-info | ||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| 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): | ||
|
|
@@ -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, | ||
| 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 | ||
|
||
| self.psdxL2 = LISA2det.psd_X | ||
|
|
||
| def _rhoL1(self, f): | ||
| a = self.psdaL1(f) | ||
| x = self.psdxL1(f) | ||
| return x/a | ||
|
|
||
| def _rhoL2(self, f): | ||
|
||
| 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): | ||
|
||
| 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 | ||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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