Commit e787c004 authored by Simran Dave's avatar Simran Dave
Browse files

Delete training_script.ipynb

parent 78564707
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[11.71494203]\n",
"[24.12391095]\n",
"[10.38877496]\n",
"[7.09610681]\n"
]
}
],
"source": [
"import pylab\n",
"import pycbc\n",
"from pycbc.waveform import get_td_waveform\n",
"from pycbc.waveform import get_fd_waveform\n",
"from pycbc.waveform import fd_approximants\n",
"import pycbc.noise\n",
"import pycbc.psd\n",
"from pycbc.types import TimeSeries\n",
"from pycbc import distributions\n",
"import numpy as np\n",
"for i in range(10):\n",
" mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))\n",
" mass1_value=mass1_distribution.rvs(size=1)\n",
" mass2_distribution = distributions.uniform_log.UniformLog10(mass2=(5, 95))\n",
" mass2_value=mass2_distribution.rvs(size=1)\n",
" print(mass1_value['mass1'])\n",
" print(mass2_value['mass2'])\n",
" hp, hc = get_td_waveform(approximant='SEOBNRv4',\n",
" mass1=mass1_value['mass1'],\n",
" mass2=mass2_value['mass2'],\n",
" delta_t=1.0/4096,\n",
" f_lower=40)\n",
" for j in range(10):\n",
" seed_value=np.random.randint(1, 200)\n",
" flow = 30.0\n",
" delta_f = 1.0 / 16\n",
" flen = int(2048 / delta_f) + 1\n",
" psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow)\n",
" delta_t = 1.0 / 4096\n",
" tsamples = int(5 / delta_t)\n",
" ts = pycbc.noise.noise_from_psd(tsamples, delta_t, psd, seed=seed_value)\n",
" tlen = 5 / delta_t\n",
" hp.resize(tlen)\n",
" ts.resize(tlen)\n",
" hp_new = TimeSeries(hp.data.data, dtype=hp.dtype,delta_t=delta_t, epoch=0)\n",
" final = hp_new + ts\n",
" \n",
" np.savetxt(str(i) + str(j) + '.txt',np.transpose([final.sample_times,final])) \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pycbc in /opt/anaconda3/lib/python3.8/site-packages (1.18.1)\n",
"Requirement already satisfied: ligo-common in /opt/anaconda3/lib/python3.8/site-packages (1.0.3)\n",
"Requirement already satisfied: jinja2 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.11.2)\n",
"Requirement already satisfied: lalsuite in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (6.82)\n",
"Requirement already satisfied: scipy>=0.16.0; python_version >= \"3.5\" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.5.0)\n",
"Requirement already satisfied: mpld3>=0.3 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (0.5.5)\n",
"Requirement already satisfied: decorator>=3.4.2 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.4.2)\n",
"Requirement already satisfied: gwdatafind in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.0.4)\n",
"Requirement already satisfied: matplotlib>=1.5.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (3.2.2)\n",
"Requirement already satisfied: numpy>=1.16.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.18.5)\n",
"Requirement already satisfied: requests>=1.2.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.24.0)\n",
"Requirement already satisfied: lscsoft-glue>=1.59.3 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.0.0)\n",
"Requirement already satisfied: ligo-segments in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.3.0)\n",
"Requirement already satisfied: six>=1.10.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.15.0)\n",
"Requirement already satisfied: tqdm in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.47.0)\n",
"Requirement already satisfied: cython>=0.29 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (0.29.21)\n",
"Requirement already satisfied: beautifulsoup4>=4.6.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.9.1)\n",
"Requirement already satisfied: astropy!=4.0.5,!=4.2.1,>=2.0.3; python_version > \"3.0\" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.0.1.post1)\n",
"Requirement already satisfied: Mako>=1.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.1.4)\n",
"Requirement already satisfied: h5py>=2.5; python_version > \"3.6\" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.10.0)\n",
"Requirement already satisfied: pillow in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (7.2.0)\n",
"Requirement already satisfied: MarkupSafe>=0.23 in /opt/anaconda3/lib/python3.8/site-packages (from jinja2->pycbc) (1.1.1)\n",
"Requirement already satisfied: python-dateutil in /opt/anaconda3/lib/python3.8/site-packages (from lalsuite->pycbc) (2.8.1)\n",
"Requirement already satisfied: pyOpenSSL in /opt/anaconda3/lib/python3.8/site-packages (from gwdatafind->pycbc) (19.1.0)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (2.4.7)\n",
"Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (0.10.0)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (1.2.0)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (1.25.9)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (2020.6.20)\n",
"Requirement already satisfied: idna<3,>=2.5 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (2.10)\n",
"Requirement already satisfied: chardet<4,>=3.0.2 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (3.0.4)\n",
"Requirement already satisfied: soupsieve>1.2 in /opt/anaconda3/lib/python3.8/site-packages (from beautifulsoup4>=4.6.0->pycbc) (2.0.1)\n",
"Requirement already satisfied: cryptography>=2.8 in /opt/anaconda3/lib/python3.8/site-packages (from pyOpenSSL->gwdatafind->pycbc) (2.9.2)\n",
"Requirement already satisfied: cffi!=1.11.3,>=1.8 in /opt/anaconda3/lib/python3.8/site-packages (from cryptography>=2.8->pyOpenSSL->gwdatafind->pycbc) (1.14.0)\n",
"Requirement already satisfied: pycparser in /opt/anaconda3/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.8->pyOpenSSL->gwdatafind->pycbc) (2.20)\n"
]
}
],
"source": [
"import sys\n",
"!{sys.executable} -m pip install pycbc ligo-common --no-cache-dir"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/simrandave\n"
]
}
],
"source": [
"cd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/simrandave/OneDrive\n"
]
}
],
"source": [
"cd OneDrive"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Errno 2] No such file or directory: 'aei_research'\n",
"/Users/simrandave/OneDrive\n"
]
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/simrandave/OneDrive/Documents\n"
]
}
],
"source": [
"cd Documents"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/simrandave/OneDrive/Documents/aei_research\n"
]
}
],
"source": [
"cd aei_research"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[9.76986447]\n"
]
}
],
"source": [
"from pycbc import distributions\n",
"mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))\n",
"mass1_value=mass1_distribution.rvs(size=1)\n",
"print(mass1_value['mass1'])"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[73.69821286]\n",
"[5.24642144]\n"
]
}
],
"source": [
"mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))\n",
"mass1_value=mass1_distribution.rvs(size=1)\n",
"mass2_distribution = distributions.uniform_log.UniformLog10(mass2=(5, 95))\n",
"mass2_value=mass2_distribution.rvs(size=1)\n",
"print(mass1_value['mass1'])\n",
"print(mass2_value['mass2'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:code id: tags:
``` python
import pylab
import pycbc
from pycbc.waveform import get_td_waveform
from pycbc.waveform import get_fd_waveform
from pycbc.waveform import fd_approximants
import pycbc.noise
import pycbc.psd
from pycbc.types import TimeSeries
from pycbc import distributions
import numpy as np
for i in range(10):
mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))
mass1_value=mass1_distribution.rvs(size=1)
mass2_distribution = distributions.uniform_log.UniformLog10(mass2=(5, 95))
mass2_value=mass2_distribution.rvs(size=1)
print(mass1_value['mass1'])
print(mass2_value['mass2'])
hp, hc = get_td_waveform(approximant='SEOBNRv4',
mass1=mass1_value['mass1'],
mass2=mass2_value['mass2'],
delta_t=1.0/4096,
f_lower=40)
for j in range(10):
seed_value=np.random.randint(1, 200)
flow = 30.0
delta_f = 1.0 / 16
flen = int(2048 / delta_f) + 1
psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow)
delta_t = 1.0 / 4096
tsamples = int(5 / delta_t)
ts = pycbc.noise.noise_from_psd(tsamples, delta_t, psd, seed=seed_value)
tlen = 5 / delta_t
hp.resize(tlen)
ts.resize(tlen)
hp_new = TimeSeries(hp.data.data, dtype=hp.dtype,delta_t=delta_t, epoch=0)
final = hp_new + ts
np.savetxt(str(i) + str(j) + '.txt',np.transpose([final.sample_times,final]))
```
%%%% Output: stream
[11.71494203]
[24.12391095]
[10.38877496]
[7.09610681]
%% Cell type:code id: tags:
``` python
import sys
!{sys.executable} -m pip install pycbc ligo-common --no-cache-dir
```
%%%% Output: stream
Requirement already satisfied: pycbc in /opt/anaconda3/lib/python3.8/site-packages (1.18.1)
Requirement already satisfied: ligo-common in /opt/anaconda3/lib/python3.8/site-packages (1.0.3)
Requirement already satisfied: jinja2 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.11.2)
Requirement already satisfied: lalsuite in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (6.82)
Requirement already satisfied: scipy>=0.16.0; python_version >= "3.5" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.5.0)
Requirement already satisfied: mpld3>=0.3 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (0.5.5)
Requirement already satisfied: decorator>=3.4.2 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.4.2)
Requirement already satisfied: gwdatafind in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.0.4)
Requirement already satisfied: matplotlib>=1.5.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (3.2.2)
Requirement already satisfied: numpy>=1.16.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.18.5)
Requirement already satisfied: requests>=1.2.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.24.0)
Requirement already satisfied: lscsoft-glue>=1.59.3 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.0.0)
Requirement already satisfied: ligo-segments in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.3.0)
Requirement already satisfied: six>=1.10.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.15.0)
Requirement already satisfied: tqdm in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.47.0)
Requirement already satisfied: cython>=0.29 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (0.29.21)
Requirement already satisfied: beautifulsoup4>=4.6.0 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.9.1)
Requirement already satisfied: astropy!=4.0.5,!=4.2.1,>=2.0.3; python_version > "3.0" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (4.0.1.post1)
Requirement already satisfied: Mako>=1.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (1.1.4)
Requirement already satisfied: h5py>=2.5; python_version > "3.6" in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (2.10.0)
Requirement already satisfied: pillow in /opt/anaconda3/lib/python3.8/site-packages (from pycbc) (7.2.0)
Requirement already satisfied: MarkupSafe>=0.23 in /opt/anaconda3/lib/python3.8/site-packages (from jinja2->pycbc) (1.1.1)
Requirement already satisfied: python-dateutil in /opt/anaconda3/lib/python3.8/site-packages (from lalsuite->pycbc) (2.8.1)
Requirement already satisfied: pyOpenSSL in /opt/anaconda3/lib/python3.8/site-packages (from gwdatafind->pycbc) (19.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (2.4.7)
Requirement already satisfied: cycler>=0.10 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=1.5.1->pycbc) (1.2.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (1.25.9)
Requirement already satisfied: certifi>=2017.4.17 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/anaconda3/lib/python3.8/site-packages (from requests>=1.2.1->pycbc) (3.0.4)
Requirement already satisfied: soupsieve>1.2 in /opt/anaconda3/lib/python3.8/site-packages (from beautifulsoup4>=4.6.0->pycbc) (2.0.1)
Requirement already satisfied: cryptography>=2.8 in /opt/anaconda3/lib/python3.8/site-packages (from pyOpenSSL->gwdatafind->pycbc) (2.9.2)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /opt/anaconda3/lib/python3.8/site-packages (from cryptography>=2.8->pyOpenSSL->gwdatafind->pycbc) (1.14.0)
Requirement already satisfied: pycparser in /opt/anaconda3/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.8->pyOpenSSL->gwdatafind->pycbc) (2.20)
%% Cell type:code id: tags:
``` python
cd
```
%%%% Output: stream
/Users/simrandave
%% Cell type:code id: tags:
``` python
cd OneDrive
```
%%%% Output: stream
/Users/simrandave/OneDrive
%% Cell type:code id: tags:
``` python
```
%%%% Output: stream
[Errno 2] No such file or directory: 'aei_research'
/Users/simrandave/OneDrive
%% Cell type:code id: tags:
``` python
cd Documents
```
%%%% Output: stream
/Users/simrandave/OneDrive/Documents
%% Cell type:code id: tags:
``` python
cd aei_research
```
%%%% Output: stream
/Users/simrandave/OneDrive/Documents/aei_research
%% Cell type:code id: tags:
``` python
from pycbc import distributions
mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))
mass1_value=mass1_distribution.rvs(size=1)
print(mass1_value['mass1'])
```
%%%% Output: stream
[9.76986447]
%% Cell type:code id: tags:
``` python
mass1_distribution = distributions.uniform_log.UniformLog10(mass1=(5, 95))
mass1_value=mass1_distribution.rvs(size=1)
mass2_distribution = distributions.uniform_log.UniformLog10(mass2=(5, 95))
mass2_value=mass2_distribution.rvs(size=1)
print(mass1_value['mass1'])
print(mass2_value['mass2'])
```
%%%% Output: stream
[73.69821286]
[5.24642144]
%% Cell type:code id: tags:
``` python
```
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