<jupyter_start><jupyter_text>Gravitational wave Astrometry estimates for an isolated CW sourceThis notebook build on the `MetricsNotebook` to compute an estimate for the precision with which the sky location of an isolated monochromatic gravitatioal wave source can be measured with a specific space-based GW mission concept. To run this on Google Colab:markdown[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnGBaker/GWI-metrics/blob/main/Notebooks/CWSNRNotebook.ipynb)  Some basic setup<jupyter_code>if 'google.colab' in str(get_ipython()):
    !git clone https://github.com/JohnGBaker/GWI-metrics.git
    src='GWI-metrics/src/'
else:
    src='../src/'
!mkdir -p '../plots/'
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append(src)
import constants
import metrics
import sources
import concepts
import subsystems
import background<jupyter_output><empty_output><jupyter_text>Define the sourceHere we load in one of our pre-defined sources<jupyter_code>sourceName = 'AmCV'
source = eval('sources.%s' % sourceName).copy()
source<jupyter_output><empty_output><jupyter_text>Define the mission conceptHere we load in one or more mission concepts from our pre-defined list. You could also define your own<jupyter_code># list of concepts by name
conceptNames = (
    'LISACBE',
    'LISASciRDv1',
    'TwinLISA',
    'LISAGrande',
    'LISAU',
    'GoBIGLISA')

models = list()
for c in conceptNames:
    model = eval('concepts.%s' % c)         # load the concept
    model = background.add2model(model)     # add galactic background model
    models.append(model)                    # add model to list<jupyter_output><empty_output><jupyter_text>Perform the observationsFirst we do the SNR calculaiton, then the angular resolution<jupyter_code>obs = list()
for m in models:
    ob = metrics.getSourceSnr(source,m,4.0*constants.year)
    ob = metrics.getResolution(ob)
    obs.append(ob)<jupyter_output>QE: 0.8156855160078964
P_Rx: 8.444165217362159e-10
sqSn_shot: 2.764880922798791e-12
QE: 0.8156855160078964
P_Rx: 8.444165217362159e-10
sqSn_shot: 2.764880922798791e-12
QE: 0.8156855160078964
P_Rx: 1.3031119162595927e-10
sqSn_shot: 7.038237778863639e-12
QE: 0.5599286380854205
P_Rx: 9.083534705280001e-12
sqSn_shot: 3.883447365388777e-11
QE: 0.5599286380854205
P_Rx: 9.947560526446235e-11
sqSn_shot: 1.1735093873706993e-11<jupyter_text>Plots Sensitivity curves<jupyter_code># sensitivity plot
fig = plt.figure(figsize=(8,6),dpi=200)
ax = fig.add_subplot(1,1,1)
f = np.logspace(-5,0,1000)
for ob in obs:
    ax.plot(f,metrics.makeSensitivity(f,ob.get('model')),linestyle='--',label=ob.get('model').get('label'))
    
hc = 10*((2./5.*ob.get('h'))**2)*ob.get('t')[-1]    
ax.scatter(ob.get('f'),hc,color='black',label=ob.get('source').get('label'))

ax.set_xscale('log')
ax.set_yscale('log')
plt.xlabel(r'Frequency [Hz]')
plt.ylabel(r'Strain PSD [Hz$^{-1}$]')
plt.legend()
ax.grid(True)
plt.savefig('../plots/%s_sensitivities.png' % sourceName)<jupyter_output>QE: 0.8156855160078964
P_Rx: 8.444165217362159e-10
sqSn_shot: 2.764880922798791e-12
QE: 0.8156855160078964
P_Rx: 8.444165217362159e-10
sqSn_shot: 2.764880922798791e-12
QE: 0.8156855160078964
P_Rx: 1.3031119162595927e-10
sqSn_shot: 7.038237778863639e-12
QE: 0.5599286380854205
P_Rx: 9.083534705280001e-12
sqSn_shot: 3.883447365388777e-11
QE: 0.5599286380854205
P_Rx: 9.947560526446235e-11
sqSn_shot: 1.1735093873706993e-11<jupyter_text>SNR as a funciton of time plot<jupyter_code># SNR of time plot
fig = plt.figure(figsize=(8,6),dpi=200)
ax = fig.add_subplot(1,1,1)
for ob in obs:
    ax.plot(ob.get('t')*12/constants.year,ob.get('SNR of t'),linestyle='-',label=ob.get('model').get('label'))

plt.title(ob.get('source').get('label'))
ax.set_xscale('linear')
ax.set_yscale('linear')
plt.xlabel('Observation Time [mo]')
plt.ylabel(r'SNR')
plt.legend()
ax.grid(True)
plt.savefig('../plots/%s_snr_v_t.png' % sourceName)<jupyter_output><empty_output><jupyter_text>Angular resolutionFirst we estimate the diffraction-liied angular resolution as a function of observation time from$\delta\theta \approx \lambda_{GW}/B$where $\lambda_{GW} = c/f_{GW}$ is the GW frequency and B is the observation baselinefor a ciruclar orbit:$B=R_{orbit}\sqrt{2(1-cos[2\pi t/T_{orbit}])}$<jupyter_code># Angular resolution
fig = plt.figure(figsize=[8,6],dpi=200)
ax = fig.add_subplot(1,1,1)
for ob in obs:
    ax.plot(ob.get('t')*12/constants.year,ob.get('Angular Resolution')*1e3,label= ob.get('model').get('label'))

plt.legend()
plt.yscale('log')
plt.grid(True)
plt.xlabel('Observation Time [mo]')
plt.ylabel('Astrometric Precision [mrad]')
plt.title(ob.get('source').get('label'))
plt.savefig('../plots/%s_res_v_t.png' % sourceName)<jupyter_output><empty_output><jupyter_text>Make a table of the results<jupyter_code>import pandas as pd
t_table = 2.0*constants.year
t = obs[0].get('t')
i_table = np.clip(np.argmin(np.abs(t-t_table)),0,np.size(t)-1)
names = list()
SNRs = list()
res = list()
obtimes = list()
for ob in obs:
    names.append(ob.get('model').get('label'))
    SNRs.append(ob.get('SNR of t')[i_table])
    res.append(ob.get('Angular Resolution')[i_table]/1e-3)

df = pd.DataFrame(index = names, data = {
    'SNR' : SNRs,
    'Angular Resolution [mrad]' : res,
})

df['Angular Resolution [arcsec]']= df['Angular Resolution [mrad]']*1e-3*180/np.pi*3600
df[['SNR', 'Angular Resolution [mrad]', 'Angular Resolution [arcsec]']]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15135528470074586, 'fraction_numerical': 0.10915044569765327, 'mean_word_length': 5.713064713064713, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '225665', 'license': 'MIT', 'n_tokens_mistral': 2576, 'n_tokens_neox': 2172, 'n_words': 412, 'path': 'Notebooks/CWSNRNotebook.ipynb', 'repo_name': 'tventers/GWI-metrics', 'size': '5497'}