Commit fc43603f authored by Yifan Wang's avatar Yifan Wang
Browse files

update training process

parent b059bb8b
......@@ -4,37 +4,35 @@
import csv
import numpy as np
import pandas as pd
from tqdm import tqdm
import utils.samplefiles
```
%% Cell type:code id: tags:
``` python
train_wnum = 50
train_nnum = 50
test_wnum = 50
test_nnum = 50
import h5py
```
%% Cell type:code id: tags:
``` python
data = utils.samplefiles.SampleFile()
data.read_hdf('./output/train.hdf')
```
%% Cell type:code id: tags:
``` python
wave, noise = data.as_dataframe(injection_parameters=True,
static_arguments=False,
command_line_arguments=False,
split_injections_noise=True)
```
%% Cell type:code id: tags:
``` python
wave['h1_strain'][0].size
```
%%%% Output: execute_result
4096
%% Cell type:markdown id: tags:
Turn strain into multi-dimension array
%% Cell type:code id: tags:
......@@ -44,23 +42,48 @@
h1n = noise['h1_strain'].tolist()
wary = np.array(h1w)
nary = np.array(h1n)
```
%% Cell type:code id: tags:
``` python
h1w[0].size
```
%%%% Output: execute_result
4096
%% Cell type:markdown id: tags:
Split train and test set
%% Cell type:code id: tags:
``` python
train_wnum = 50
train_nnum = 50
test_wnum = 50
test_nnum = 50
wtrain = wary[:train_wnum,:]
ntrain = nary[:train_nnum,:]
wtest = wary[train_wnum:,:]
ntest = nary[train_nnum:,:]
```
%% Cell type:code id: tags:
``` python
wtrain.shape
```
%%%% Output: execute_result
(50, 4096)
%% Cell type:markdown id: tags:
Insert label
%% Cell type:code id: tags:
......@@ -72,17 +95,17 @@
ntest = np.insert(ntest, 0, values=0, axis=1)
```
%% Cell type:markdown id: tags:
Training set name
# Training set
%% Cell type:code id: tags:
``` python
train_name = []
num = 50
num = wtrain.shape[1]-1 # 4096
train_name.append('label')
for i in tqdm(range(0,num)):
train_name.append('point{s1}'.format(s1=i))
```
......@@ -97,19 +120,35 @@
for i in tqdm(range(0,train_wnum)):
writer.writerow(wtrain[i])
writer.writerow(ntrain[i])
```
%% Cell type:code id: tags:
``` python
train_set = pd.read_csv("./output/train.csv", dtype=np.float32)
```
%% Cell type:code id: tags:
``` python
train_set.shape
```
%%%% Output: execute_result
(100, 4097)
%% Cell type:markdown id: tags:
testing set name
# Testing set
%% Cell type:code id: tags:
``` python
test_name = []
num = 50
num = wtrain.shape[1]-1 # 4096
test_name.append('label')
for i in tqdm(range(0,num)):
test_name.append('point{s1}'.format(s1=i))
```
......@@ -127,7 +166,23 @@
```
%% Cell type:code id: tags:
``` python
test_set = pd.read_csv("./output/test.csv", dtype=np.float32)
```
%% Cell type:code id: tags:
``` python
test_set.shape
```
%%%% Output: execute_result
(100, 4097)
%% Cell type:code id: tags:
``` python
```
......
This diff is collapsed.
......@@ -8,5 +8,5 @@
"n_injection_samples": 100,
"n_noise_samples": 100,
"n_processes": 4,
"output_file_name": "train.hdf"
"output_file_name": "test.hdf"
}
......@@ -13,7 +13,7 @@ injection_snr =
[static_args]
approximant = SEOBNRv4
domain = time
f_lower = 18
f_lower = 10
distance = 100
waveform_length = 128
......@@ -31,8 +31,8 @@ target_sampling_rate = 2048
; Define parameters for the whitening procedure. See documentation of the
; pycbc.types.TimeSeries.whiten() method for an explanation of what these
; values exactly mean.
whitening_segment_duration = 4
whitening_max_filter_duration = 4
whitening_segment_duration = 1
whitening_max_filter_duration = 1
; Define the lower and upper bound for the bandpass filter (in Hertz)
bandpass_lower = 20
......@@ -41,8 +41,8 @@ bandpass_upper = 2048
; Define how to align the sample around the event time. By convention, the
; event time is the H1 time!
; The sum of these values will be the the sample_length!
seconds_before_event = 5.5
seconds_after_event = 2.5
seconds_before_event = 1.5
seconds_after_event = 0.5
; alpha for the Tukey window that is used to "fade on" the waveforms
; It represents the fraction of the window inside the cosine tapered region.
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
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