-
Notifications
You must be signed in to change notification settings - Fork 0
/
period_mdd_plot.R
136 lines (116 loc) · 7.02 KB
/
period_mdd_plot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
getAveragedMDD <- function(
vector
) {
return (
c(
mean(unlist(lapply(vector, `[[`, 1))), mean(unlist(lapply(vector, `[[`, 2)))
)
)
}
gfperiod05 <- readRDS('GAUSSIAN_ONLY_FAP_MDD_period/result05_fap_gaussian.rds')
gfperiod1 <- readRDS('GAUSSIAN_ONLY_FAP_MDD_period/result1_fap_gaussian.rds')
gfperiod4 <- readRDS('GAUSSIAN_ONLY_FAP_MDD_period/result4_fap_gaussian.rds')
gfperiod7 <- readRDS('GAUSSIAN_ONLY_FAP_MDD_period/result7_fap_gaussian.rds')
afperiod05 <- readRDS('AR_ONLY_FAP_MDD_period/result05_fap_ar.rds')
afperiod1 <- readRDS('AR_ONLY_FAP_MDD_period/result1_fap_ar.rds')
afperiod4 <- readRDS('AR_ONLY_FAP_MDD_period/result4_fap_ar.rds')
afperiod7 <- readRDS('AR_ONLY_FAP_MDD_period/result7_fap_ar.rds')
gsperiod05 <- readRDS('GAUSSIAN_ONLY_SNR_MDD_period/result05_gaussian_SNR.rds')
gsperiod1 <- readRDS('GAUSSIAN_ONLY_SNR_MDD_period/result1_gaussian_SNR.rds')
gsperiod4 <- readRDS('GAUSSIAN_ONLY_SNR_MDD_period/result4_gaussian_SNR.rds')
gsperiod7 <- readRDS('GAUSSIAN_ONLY_SNR_MDD_period/result7_gaussian_SNR.rds')
asperiod05 <- readRDS('AR_ONLY_SNR_MDD_period/result05_ar_SNR.rds')
asperiod1 <- readRDS('AR_ONLY_SNR_MDD_period/result1_ar_SNR.rds')
asperiod4 <- readRDS('AR_ONLY_SNR_MDD_period/result4_ar_SNR.rds')
asperiod7 <- readRDS('AR_ONLY_SNR_MDD_period/result7_ar_SNR.rds')
gfperiod05_MDD <- getAveragedMDD(gfperiod05)
gfperiod1_MDD <- getAveragedMDD(gfperiod1)
gfperiod4_MDD <- getAveragedMDD(gfperiod4)
gfperiod7_MDD <- getAveragedMDD(gfperiod7)
afperiod05_MDD <- getAveragedMDD(afperiod05)
afperiod1_MDD <- getAveragedMDD(afperiod1)
afperiod4_MDD <- getAveragedMDD(afperiod4)
afperiod7_MDD <- getAveragedMDD(afperiod7)
gsperiod05_MDD <- getAveragedMDD(gsperiod05)
gsperiod1_MDD <- getAveragedMDD(gsperiod1)
gsperiod4_MDD <- getAveragedMDD(gsperiod4)
gsperiod7_MDD <- getAveragedMDD(gsperiod7)
asperiod05_MDD <- getAveragedMDD(asperiod05)
asperiod1_MDD <- getAveragedMDD(asperiod1)
asperiod4_MDD <- getAveragedMDD(asperiod4)
asperiod7_MDD <- getAveragedMDD(asperiod7)
########################################################
tcfColor <- '#FC9272' #'#225ea8' # '#fd8d3c' # '#fdae6b'
blsColor <- '#1C9099' #'#d95f0e'
titleColor <- 'black'
ablineColor <- 'black'
# Gaussian
glimitingDepthBLSArr_FAPSNR_mode_0 <- c(gfperiod05_MDD[1], gfperiod1_MDD[1], gfperiod4_MDD[1], gfperiod7_MDD[1])
glimitingDepthTCFArr_FAPSNR_mode_0 <- c(gfperiod05_MDD[2], gfperiod1_MDD[2], gfperiod4_MDD[2], gfperiod7_MDD[2])
glimitingDepthBLSArr_FAPSNR_mode_1 <- c(gsperiod05_MDD[1], gsperiod1_MDD[1], gsperiod4_MDD[1], gsperiod7_MDD[1])
glimitingDepthTCFArr_FAPSNR_mode_1 <- c(gsperiod05_MDD[2], gsperiod1_MDD[2], gsperiod4_MDD[2], gsperiod7_MDD[2])
# AR
alimitingDepthBLSArr_FAPSNR_mode_0 <- c(afperiod05_MDD[1], afperiod1_MDD[1], afperiod4_MDD[1], afperiod7_MDD[1])
alimitingDepthTCFArr_FAPSNR_mode_0 <- c(afperiod05_MDD[2], afperiod1_MDD[2], afperiod4_MDD[2], afperiod7_MDD[2])
alimitingDepthBLSArr_FAPSNR_mode_1 <- c(asperiod05_MDD[1], asperiod1_MDD[1], asperiod4_MDD[1], asperiod7_MDD[1])
alimitingDepthTCFArr_FAPSNR_mode_1 <- c(asperiod05_MDD[2], asperiod1_MDD[2], asperiod4_MDD[2], asperiod7_MDD[2])
cex <- 1.3
png(filename="period_BLS_TCF.png", width = 250, height = 140, units='mm', res = 300)
par("mar" = c(5, 5, 2, 2))
mat1 <- matrix(c(
1, 3,
1, 3,
2, 4,
2, 4), nrow = 4, ncol = 2, byrow = TRUE
)
layout(mat = mat1,
heights = c(1), # Heights of the two rows
widths = c(1)
) # Widths of the two columns
plot(glimitingDepthBLSArr_FAPSNR_mode_0, type='o', xaxt='n', col=blsColor, ylab='Minimum detectable depth (%)', ylim=c(0.0, 0.055), main='Gaussian - FAP', xlab='Period (days)', col.main=titleColor, col.lab=titleColor, col.axis=titleColor, bty='l', lwd=2.0,, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
lines(glimitingDepthTCFArr_FAPSNR_mode_0, type='o', col=tcfColor, col.lab=titleColor, col.axis=titleColor, col.axis=titleColor, lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex)
legend(
x = "topright", lty = 1, text.font = 6,
col= c(blsColor, tcfColor),
legend=c("BLS", "TCF"), text.col=titleColor, bty = "n", lwd=2.0, cex=cex
)
axis(1, at=1:4, labels=c(0.5, 1, 4, 7), col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
axis(2, col.lab='white', col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
abline(h=0.005, lty='dashed', col=ablineColor)
text(1.1, 0.0025, "0.005%", col=ablineColor, cex=cex)
plot(glimitingDepthBLSArr_FAPSNR_mode_1, type='o', xaxt='n', col=blsColor, ylab='Minimum detectable depth (%)', ylim=c(0.0, 0.055), main='Gaussian - SNR', xlab='Period (days)', col.main=titleColor, col.lab=titleColor, col.axis=titleColor, bty='l', lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
lines(glimitingDepthTCFArr_FAPSNR_mode_1, type='o', col=tcfColor, col.lab=titleColor, col.axis=titleColor, col.axis=titleColor, lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
legend(
x = "topright", lty = 1, text.font = 6,
col= c(blsColor, tcfColor),
legend=c("BLS", "TCF"), text.col=titleColor, bty = "n", lwd=2.0, cex=cex
)
axis(1, at=1:4, labels=c(0.5, 1, 4, 7), col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
axis(2, col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
abline(h=0.005, lty='dashed', col=ablineColor)
#text(1.1, 0.007, "0.005")
plot(alimitingDepthBLSArr_FAPSNR_mode_0, type='o', xaxt='n', col=blsColor, ylab='Minimum detectable depth (%)', ylim=c(0.0, 0.055), main='Autoregressive - FAP', xlab='Period (days)', col.main=titleColor, col.lab=titleColor, col.axis=titleColor, bty='l', lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
lines(alimitingDepthTCFArr_FAPSNR_mode_0, type='o', col=tcfColor, col.lab=titleColor, col.axis=titleColor, col.axis=titleColor, lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
legend(
x = "topright", lty = 1, text.font = 6,
col= c(blsColor, tcfColor),
legend=c("BLS", "TCF"), text.col=titleColor, bty = "n", lwd=2.0, cex=cex
)
axis(1, at=1:4, labels=c(0.5, 1, 4, 7), col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
axis(2, col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
#abline(h=0, lty='dashed')
abline(h=0.005, lty='dashed', col=ablineColor)
#text(1.1, 0.007, "0.005")
plot(alimitingDepthBLSArr_FAPSNR_mode_1, type='o', xaxt='n', col=blsColor, ylab='Minimum detectable depth (%)', ylim=c(0.0, 0.055), main='Autoregressive - SNR', xlab='Period (days)', col.main=titleColor, col.lab=titleColor, col.axis=titleColor, bty='l', lwd=2.0, cex.axis=cex, cex.lab=cex, cex=cex, cex.main=cex)
lines(alimitingDepthTCFArr_FAPSNR_mode_1, type='o', col=tcfColor, col.lab=titleColor, col.axis=titleColor, col.axis=titleColor, lwd=2.0)
legend(
x = "topright", lty = 1, text.font = 6,
col= c(blsColor, tcfColor),
legend=c("BLS", "TCF"), text.col=titleColor, bty = "n", lwd=2.0, cex=cex
)
axis(1, at=1:4, labels=c(0.5, 1, 4, 7), col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
axis(2, col.lab=titleColor, col.axis=titleColor, col.ticks=titleColor, cex.axis=cex)
#abline(h=0, lty='dashed')
abline(h=0.005, lty='dashed', col=ablineColor)
#text(1.1, 0.007, "0.005")
dev.off()