-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_tune.R
More file actions
190 lines (158 loc) · 6.02 KB
/
plot_tune.R
File metadata and controls
190 lines (158 loc) · 6.02 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# ./plot_tune.R
#
# (c) 2010 Konstantin Sering, Nora Umbach, Dominik Wabersich
# <colorlab[at]psycho.uni-tuebingen.de>
#
# GPL 3.0+ or (cc) by-sa (http://creativecommons.org/licenses/by-sa/3.0/)
#
# content:
#
# input: color_table_20110118_1134.csv
# xyyToRgb.R TODO: This file does not exist anymore! Make script
# independent of it!
# output: --
#
# created
# last mod 2011-01-18, KS
##########################################################################
### READ DATA ############################################################
##########################################################################
#path="C:/Dokumente und Einstellungen/user1/Desktop/achrolabutils/"
path="/home/kfs-studium/Dokumente/arbeit/PI/achrolabutils/"
setwd(paste(path, "achrolab/data/", sep=""))
dat <- read.csv("color_table_20110118_1134.csv", na.strings="NA", colClasses=c("character", rep("numeric", 16)))
#dat2 <- dat[175:177,]
#datTuned <- read.csv("color_table_20110115_1306.csv", na.strings="NA", colClasses=c("character", rep("numeric", 16)))
#datTuned2 <- datTuned[175:177,]
setwd(paste(path, "achrolab/tune/", sep=""))
files <- dir()
it <- NULL
for (file in files) {
tmp <- unlist(strsplit(file, "_"))
tmp2 <- read.csv(file, header=T)
tmp2$target <- tmp[2]
tmp2$iteration <- unlist(strsplit(tmp[3], "n"))[2]
tmp2$channel <- substr(tmp[4], 3, 3)
it <- rbind(it, tmp2)
}
it$target <- as.factor(it$target)
it$iteration <- as.factor(it$iteration)
it$channel <- as.factor(it$channel)
setwd(path)
source("xyyToRgb.R")
it <- cbind(it, xyyToRgb(it[,4:6]))
rm(tmp, tmp2, files, file)
##########################################################################
### select COLOR #########################################################
##########################################################################
color_num = 161
it2 <- it[it$target=="x0.2967y0.3186Y15.3511",]
##########################################################################
### xyY ##################################################################
##########################################################################
# x vs y
X11()
plot(dat$monitor_xyY_x[color_num], dat$monitor_xyY_y[color_num], pch="x",
xlim=c(0.26,0.33), ylim=c(0.25,0.35), cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(xyY_x, xyY_y, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$xyY_x[1],
it2[it2$iteration==iter,]$xyY_y[1], iter)
}
# x vs Y
X11()
plot(dat$monitor_xyY_x[color_num], dat$monitor_xyY_Y[color_num], pch="x",
xlim=c(0.26,0.31), ylim=c(10,20), cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(xyY_x, xyY_Y, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$xyY_x[1],
it2[it2$iteration==iter,]$xyY_Y[1], iter)
}
##########################################################################
### VOLTAGES #############################################################
##########################################################################
# r vs g
X11()
plot(dat$voltages_r[color_num], dat$voltages_g[color_num], pch="s",
xlim=c(0x400,0xFFF), ylim=c(0x400,0xFFF), cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(voltage_r, voltage_g, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$voltage_r[1],
it2[it2$iteration==iter,]$voltage_g[1], iter)
}
# r vs b
X11()
plot(dat$voltages_r[color_num], dat$voltages_b[color_num], pch="s",
xlim=c(1000,3000), ylim=c(1000,3000), cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(voltage_r, voltage_b, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$voltage_r[1],
it2[it2$iteration==iter,]$voltage_b[1], iter)
}
##########################################################################
### RGB ##################################################################
##########################################################################
# r vs g
X11()
tmp <- xyyToRgb(dat[color_num, 12:14])
plot(tmp[1], tmp[2], pch="x", xlim=c(7,14), ylim=c(10,20), xlab="red",
ylab="green", cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(R, G, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$R[1],
it2[it2$iteration==iter,]$G[1], iter)
}
# r vs b
X11()
tmp <- xyyToRgb(dat[color_num, 12:14])
plot(tmp[1], tmp[3], pch="x", xlim=c(7,14), ylim=c(15,28), xlab="red",
ylab="blue", cex=3)
for (iter in levels(it2$iteration)) {
for (ch in levels(it2$channel)) {
rgb <- NULL
if( ch == "R" ) {rgb="red"}
if( ch == "G" ) {rgb="green"}
if( ch == "B" ) {rgb="blue"}
with(it2[it2$iteration==iter & it2$channel==ch,],
points(R, B, type="l", col=rgb))
}
text(it2[it2$iteration==iter,]$R[1],
it2[it2$iteration==iter,]$B[1], iter)
}