Revisão | d93d2d4c5a8dc3b9544bbf0cbaf4ebdf93db0457 (tree) |
---|---|
Hora | 2010-01-12 08:02:47 |
Autor | lorenzo |
Commiter | lorenzo |
Some minor modifications, mainly taking into account the need to use
weights=NA in the diameter calculation.
@@ -138,13 +138,22 @@ | ||
138 | 138 | |
139 | 139 | return [visit_arr,visit_flux,visit_arr_extended, my_black_overall] |
140 | 140 | |
141 | - | |
141 | +#here boot_time is simply the dummy argument of a function, but I deal | |
142 | +#only with contact protocols | |
142 | 143 | |
143 | 144 | def generate_iteration_grid(boot_time_non_unique,\ |
144 | - number_intervals,interval_duration,ini_gap): | |
145 | + number_intervals,interval_duration,t_ini,t_end): | |
145 | 146 | time_unique=s.unique1d(boot_time_non_unique) |
146 | 147 | |
147 | - time_ini=time_unique[0]+ini_gap | |
148 | + # time_ini=time_unique[0]+ini_gap | |
149 | + | |
150 | + | |
151 | + if (t_ini>0): | |
152 | + time_ini=t_ini | |
153 | + else: | |
154 | + time_ini=time_unique[0] | |
155 | + | |
156 | + | |
148 | 157 | print "time_ini is, ", time_ini |
149 | 158 | |
150 | 159 | if (number_intervals<=0 and interval_duration<=0): |
@@ -155,10 +164,18 @@ | ||
155 | 164 | print "Error in calling the function" |
156 | 165 | #break |
157 | 166 | if (number_intervals>0 and interval_duration<=0): |
158 | - time_grid=s.linspace(time_ini,time_unique[-1],number_intervals) | |
167 | + if (t_end<=0): | |
168 | + time_grid=s.linspace(time_ini,time_unique[-1],number_intervals) | |
169 | + elif (t_end>0): | |
170 | + time_grid=s.linspace(time_ini,t_end,number_intervals) | |
171 | + | |
159 | 172 | |
160 | 173 | if (number_intervals<=0 and interval_duration>0): |
161 | - time_grid=s.arange(time_ini,time_unique[-1],interval_duration) | |
174 | + if (t_end<=0): | |
175 | + time_grid=s.arange(time_ini,time_unique[-1],interval_duration) | |
176 | + if (t_end>0): | |
177 | + time_grid=s.arange(time_ini,t_end,interval_duration) | |
178 | + | |
162 | 179 | |
163 | 180 | return (time_grid.astype("int64")) |
164 | 181 |
@@ -201,13 +218,13 @@ | ||
201 | 218 | |
202 | 219 | boot_time_non_unique=data_arr[:,0] |
203 | 220 | |
204 | -ini_gap=1240876800-1240092599 # 86400 #i.e. one day in seconds | |
205 | - | |
221 | +t_ini=1246233600 | |
222 | +t_end=t_ini+86400*3+1 | |
206 | 223 | number_intervals=-12 |
207 | 224 | interval_duration= 86400 #i.e. 1 day #604800 #i.e. one week in seconds |
208 | 225 | |
209 | 226 | time_grid=generate_iteration_grid(boot_time_non_unique,\ |
210 | - (number_intervals+1),interval_duration,ini_gap) | |
227 | + (number_intervals+1),interval_duration,t_ini,t_end) | |
211 | 228 | |
212 | 229 | print "len(time_grid) is, ", len(time_grid) |
213 | 230 | print "time_grid[0] and time_grid[-1] are, ", time_grid[0], time_grid[-1] |
@@ -43,7 +43,7 @@ | ||
43 | 43 | |
44 | 44 | number_networks <- length(visitor_list) |
45 | 45 | |
46 | -time_period <- 31 #selected time_period I want to look at | |
46 | +time_period <- 2 #selected time_period I want to look at | |
47 | 47 | |
48 | 48 | infected_diam <- seq(length(time_period)) |
49 | 49 | infected_mean_degree<- seq(length(time_period)) |
@@ -71,7 +71,7 @@ | ||
71 | 71 | |
72 | 72 | g_infected <- simplify(g_infected) |
73 | 73 | |
74 | -infected_diam[i+1] <- length(get.diameter(g_infected))-1 | |
74 | +infected_diam[i+1] <- length(get.diameter(g_infected,weights=NA))-1 | |
75 | 75 | infected_mean_degree[i+1] <- mean(degree(g_infected)) |
76 | 76 | |
77 | 77 |
@@ -83,7 +83,7 @@ | ||
83 | 83 | |
84 | 84 | g_after_infection <- simplify(g_after_infection) |
85 | 85 | |
86 | -diam_after_infection[i+1] <- length(get.diameter(g_after_infection))-1 | |
86 | +diam_after_infection[i+1] <- length(get.diameter(g_after_infection,weights=NA))-1 | |
87 | 87 | |
88 | 88 | mean_degree_after_infection[i+1] <- mean(degree(g_after_infection)) |
89 | 89 |