Skip to content

Commit f5cdc18

Browse files
committed
added snail_minutes: random 10 minutes for each ID
1 parent b5d7f88 commit f5cdc18

29 files changed

+2883
-2
lines changed

R/pdf_generation(changed_variables).R

+102-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,111 @@
11

22

3-
DATA_FILE <- "~/Documents/heart_021.csv" #####change file name here
3+
DATA_FILE <- "~/Documents/result9.csv" #####change file name here
44
SAMPLING_FREQUENCY <- 5 # in Hz
55

66

7+
heart_dt <- fread("~/Documents/heart_011.csv")
8+
temp_dt <- fread("~/Documents/temp_011_012.csv")
9+
710
#####interpolation
811
heterogeneous_df <- read.csv(DATA_FILE, head=F)
12+
colnames(heterogeneous_df) <- c("t", "y", "temp")
13+
df_y <- approx(x=heterogeneous_df$t, y=heterogeneous_df$y, xout=heterogeneous_df$t, method='linear')
14+
df_temp <- approx(x=heterogeneous_df$t, y=heterogeneous_df$temp, xout=heterogeneous_df$t, method='linear')
15+
16+
out_dt <- data.table(t=df_y$x, y=df_y$y, temp=df_temp$y)
17+
fin_dt <- na.omit(out_dt)
18+
df_v2 <- data.frame(fin_dt)
19+
20+
df <- na.omit(df_v2)
21+
22+
23+
######pdf generation
24+
df$min <- round(df$t /60)
25+
ldf <- split(df, df$min)
26+
pdf("heartsignal_11.pdf",w=16,h=9) #####change pdf name here
27+
par(mfrow=c(2,1))
28+
for(d in ldf){
29+
h <- round(d$t[1] / 3600,3)
30+
temp <- mean(d$temp)
31+
title <- paste0("Starts at h = ", h, " Temperature = ", temp)
32+
print(title)
33+
plot(y ~ t, d, type='l', main=title)
34+
35+
}
36+
dev.off()
37+
38+
39+
40+
#####interpolation
41+
942
colnames(heterogeneous_df) <- c("t", "y")
1043
df_v1 <- approx(x=heterogeneous_df$t, y=heterogeneous_df$y, xout=heterogeneous_df$t, method='linear')
1144
df_v2 <- data.frame(df_v1)
1245
colnames(df_v2) <- c("t", "y")
46+
ldf <- na.omit(df_v2)
47+
48+
49+
######pdf generation
50+
df$min <- round(df$t /60)
51+
ldf <- split(df, df$min)
52+
53+
heterogeneous_df <- read.csv(DATA_FILE, head=F)
54+
colnames(df_v2) <- c("ID", "t", "y", "y")
55+
ldf <- na.omit(df_v2)
56+
57+
pdf("heartsignal_21.pdf",w=16,h=9) #####change pdf name here
58+
par(mfrow=c(2,1))
59+
for(d in ldf){
60+
h <- round(d$t[1] / 3600,3)
61+
temp <- mean(dt$temp)
62+
title <- paste0("Starts at h = ", h, "Temperature = ", temp)
63+
print(title)
64+
plot(y ~ t, d, type='l', main=title)
65+
66+
}
67+
dev.off()
68+
69+
70+
71+
write.table(test_dt, file = "result9.csv",row.names=FALSE, na="",col.names=FALSE, sep=",")
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
heart_dt <- fread("~/Documents/heart_021.csv")
93+
temp_dt <- fread("~/Documents/temp_021_022.csv")
94+
95+
96+
out_t <- seq(from=floor(min(heart_dt$V1)), to=round(max(heart_dt$V1)), by= 1/fs)
97+
li_heart <- approx(x=heart_dt$V1, y=heart_dt$V2, xout=out_t, method='linear')
98+
li_temp <- approx(x=temp_dt$V1, y=temp_dt$V2, xout=out_t, method='linear')
99+
#map here
100+
out_dt <- data.table(t=li_heart$x, y=li_heart$y, temp=li_temp$y)
101+
fin_dt <- na.omit(out_dt)
102+
103+
fin_dt
104+
105+
106+
fin_dt <- na.omit(out_dt)
107+
df_v2 <- data.frame(fin_dt)
108+
13109
df <- na.omit(df_v2)
14110

15111

@@ -20,9 +116,13 @@ pdf("heartsignal_21.pdf",w=16,h=9) #####change pdf name here
20116
par(mfrow=c(2,1))
21117
for(d in ldf){
22118
h <- round(d$t[1] / 3600,3)
23-
title <- paste0("Starts at h = ", h)
119+
temp <- mean(d$temp)
120+
title <- paste0("Starts at h = ", h, ", Temperature = ", temp)
24121
print(title)
25122
plot(y ~ t, d, type='l', main=title)
26123

27124
}
28125
dev.off()
126+
127+
128+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
page,h,temp,freq/min
2+
7,397507.608,13.6731899213,6
3+
10,397507.708,15.1486337674,5
4+
16,397507.925,18.9635744995,5
5+
21,397508.092,20.70199374,6
6+
47,397508.942,24.7168495962,5
7+
62,397509.458,26.2365899931,6
8+
92,397510.458,29.0389402841,7
9+
136,397511.925,28.7843299792,8
10+
483,397523.508,33.5640068095,14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
5,397529.892,8.6972878586,13
3+
11,397530.092,10.7646900828,10
4+
23,397530.508,14.8618271305,8
5+
57,397531.642,23.0033952573,14
6+
94,397532.842,27.2526143607,19
7+
228,397537.325,29.6691335787,31
8+
304,397539.875,30.4484327175,23
9+
460,397545.058,30.4157931793,18
10+
500,397546.408,30.33729464,18
11+
649,397551.358,30.5096389639,18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
10,397530.092,10.7646900828,7
3+
30,397530.742,17.0265425855,9
4+
51,397531.458,21.9907284405,12
5+
65,397531.925,24.3469314658,13
6+
150,397534.742,24.6072303359,12
7+
173,397535.525,26.8485406208,16
8+
207,397536.642,28.8013828809,13
9+
229,397537.392,29.62390309,13
10+
271,397538.792,30.354724933,21
11+
511,397546.775,30.3558591538,16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
page,h,temp,freq/min
2+
74,397604.625,18.6434874713,12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
page,h,temp,freq/min
2+
5,397602.308,7.6182630129,7
3+
63,397604.242,17.4478751364,5
4+
82,397604.875,19.0790359414,6
5+
94,397605.292,20.2471023665,6
6+
119,397606.108,21.770887211,7
7+
146,397607.008,22.4775399471,6
8+
180,397608.158,27.9807758149,7
9+
219,397609.458,30.6805606581,6
10+
254,397610.608,32.118216576,8
11+
317,397612.708,32.6698537537,10
12+
364,397614.275,32.9591905897,21
13+
502,397618.875,32.0015287011,19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min,
2+
9,397625.825,11.4009327266,11,
3+
17,397626.092,14.6533650239,9,
4+
50,397627.208,21.9157850199,16,?
5+
60,397627.525,23.131726401,11,
6+
73,397627.975,25.0066131291,11,
7+
90,397628.525,27.1522361227,13,
8+
100,397628.875,28.4237992674,17,
9+
114,397629.342,31.0633301996,18,
10+
146,397630.392,36.5722264909,29,
11+
578,397644.808,37.9789156329,26,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
1,397625.575,9.1317102128,10
3+
12,397625.925,12.783424935,5
4+
25,397626.358,16.9971046318,6
5+
32,397626.592,18.6551470093,10
6+
48,397627.125,21.4907434579,6
7+
74,397627.992,25.4499602562,6
8+
86,397628.392,27.0531461976,7
9+
105,397629.025,29.2102373608,7
10+
119,397629.492,33.7279980329,8
11+
552,397643.925,37.961672012,21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
2,397648.392,3.4840416525,10
3+
12,397648.708,6.4915379872,8
4+
28,397649.258,9.3943403663,5
5+
68,397650.592,14.2713326046,5
6+
95,397651.475,17.6631606525,7
7+
135,397652.808,18.8200845454,14
8+
154,397653.442,23.1460794762,23
9+
192,397654.725,27.6705855216,26
10+
274,397657.442,30.3846603001,20
11+
670,397670.642,31.3378257361,22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
5,397648.475,4.3796787357,15
3+
24,397649.108,8.3637996094,8
4+
51,397650.008,12.1447080235,8
5+
90,397651.325,17.0717374157,11
6+
105,397651.808,20.0385988669,12
7+
159,397653.592,23.7329766488,13
8+
173,397654.092,25.7660843174,16
9+
330,397659.308,29.6288258074,19
10+
374,397660.775,29.6246764251,19
11+
515,397665.475,30.0268459966,17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
2,397675.058,−0.111389959444049,12
3+
14,397675.458,2.3494156056,5
4+
31,397676.008,5.3423613891,6
5+
67,397677.208,11.1833872565,7
6+
90,397677.992,15.5055315081,10
7+
112,397678.725,16.6646569983,17
8+
143,397679.775,19.8488049588,22
9+
166,397680.508,23.8178723416,33
10+
306,397685.175,30.6218892945,33
11+
429,397689.275,30.3620871156,29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
5,397675.158,0.5546470221,9
3+
12,397675.375,1.6742975654,6
4+
42,397676.375,7.3050869141,6
5+
70,397677.308,11.5212742875,7
6+
88,397677.908,15.4279367499,7
7+
107,397678.542,19.0328654026,7
8+
129,397679.292,16.3312115562,7
9+
163,397680.408,23.0056112788,8
10+
193,397681.408,26.4244576389,11
11+
281,397684.358,30.3282563561,25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,t,temp,freq/min
2+
8,397696.858,4.0925024162,12
3+
14,397697.058,4.949517906,8
4+
26,397697.458,5.7822953969,5
5+
58,397698.525,8.6653620738,6
6+
90,397699.608,11.7020972821,6
7+
138,397701.208,16.2373881586,9
8+
183,397702.708,14.7691723233,10
9+
225,397704.108,22.400792559,19
10+
259,397705.225,26.1111644381,27
11+
389,397709.575,32.1010153005,29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
page,h,temp,freq/min
2+
3,397696.708,3.4633049035,18
3+
19,397697.225,5.1258487938,6
4+
36,397697.808,6.9743815873,7
5+
72,397698.992,9.9840917804,7
6+
112,397700.325,13.2038981273,10
7+
140,397701.258,16.5769166577,10
8+
228,397704.208,22.742482708,24
9+
259,397705.225,26.1111644381,32
10+
417,397710.492,32.5796778934,21
11+
604,397716.725,32.8829749419,25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
page,h,temp,freq/min
2+
5,397507.542,15.0696742168,7
3+
7,397507.608,13.6731899213,6
4+
15,397507.875,18.2385191387,6
5+
34,397508.508,23.6208998577,6
6+
47,397508.942,24.7168495962,8
7+
100,397510.708,25.6024703811,14
8+
123,397511.475,27.6098323625,22
9+
138,397511.975,28.9007453683,24
10+
196,397513.908,32.0075367652,24
11+
323,397518.208,33.4590685274,21
12+
535,397525.208,34.2001525618,23

heartsignal_10.pdf

2.61 MB
Binary file not shown.

heartsignal_11.pdf

3.39 MB
Binary file not shown.

heartsignal_12.pdf

3.39 MB
Binary file not shown.

heartsignal_13.pdf

3.01 MB
Binary file not shown.

heartsignal_14.pdf

3.01 MB
Binary file not shown.

heartsignal_15.pdf

3.21 MB
Binary file not shown.

heartsignal_16.pdf

3.15 MB
Binary file not shown.

heartsignal_17.pdf

3.83 MB
Binary file not shown.

heartsignal_18.pdf

3.87 MB
Binary file not shown.

heartsignal_19.pdf

3.12 MB
Binary file not shown.

heartsignal_20.pdf

3.12 MB
Binary file not shown.

heartsignal_21.pdf

3.35 MB
Binary file not shown.

heartsignal_22.pdf

3.35 MB
Binary file not shown.

0 commit comments

Comments
 (0)