@@ -141,6 +141,21 @@ def recense_dead_id_to_extend(self):
141
141
logging .debug ('%d death of real obs in this step' , nb_dead )
142
142
if not self .virtual :
143
143
return
144
+ #
145
+ if self .virtual_obs is not None :
146
+ virtual_dead_id = setdiff1d (self .virtual_obs ['track' ],
147
+ self [- 1 ]['id' ])
148
+ list_previous_virtual_id = self .virtual_obs ['track' ].tolist ()
149
+ i_virtual_dead_id = [
150
+ list_previous_virtual_id .index (i ) for i in virtual_dead_id ]
151
+ # Virtual obs which can be prolongate
152
+ alive_virtual_obs = self .virtual_obs ['segment_size' ][i_virtual_dead_id ] < self .nb_virtual
153
+ nb_virtual_extend = alive_virtual_obs .sum ()
154
+ logging .debug ('%d virtual obs will be prolongate on the '
155
+ 'next step' , nb_virtual_extend )
156
+
157
+ # Save previous state to count virtual obs
158
+ self .previous_virtual_obs = self .virtual_obs
144
159
# Creation of an virtual step for dead one
145
160
self .virtual_obs = VirtualEddiesObservations (size = nb_dead + nb_virtual_extend )
146
161
@@ -218,16 +233,19 @@ def track(self):
218
233
id_previous [self [- 1 ]['out' ]] = previous_id
219
234
correspondance ['id' ] = id_previous [correspondance ['in' ]]
220
235
236
+ # We set correspondance data for virtual obs : ID/LENGTH
221
237
if FLG_VIRTUAL :
222
238
nb_rebirth = correspondance ['virtual' ].sum ()
223
239
if nb_rebirth != 0 :
224
240
logging .debug ('%d re-birth due to prolongation with'
225
241
' virtual observations' , nb_rebirth )
226
242
# Set id for virtual
227
- i_virtual = correspondance ['in' ][correspondance ['virtual' ]] - nb_real_obs
228
- correspondance ['id' ][correspondance ['virtual' ]] = \
243
+ m_virtual = correspondance ['virtual' ]
244
+ # index of virtual in virtual obs
245
+ i_virtual = correspondance ['in' ][m_virtual ] - nb_real_obs
246
+ correspondance ['id' ][m_virtual ] = \
229
247
self .virtual_obs ['track' ][i_virtual ]
230
- correspondance ['virtual_length' ][correspondance [ 'virtual' ] ] = \
248
+ correspondance ['virtual_length' ][m_virtual ] = \
231
249
self .virtual_obs ['segment_size' ][i_virtual ]
232
250
233
251
# new_id is equal to UINT32_MAX we must add a new ones
@@ -240,22 +258,6 @@ def track(self):
240
258
241
259
self .append (correspondance )
242
260
243
- # SECTION for virtual observation
244
- nb_virtual_prolongate = 0
245
- if FLG_VIRTUAL :
246
- # Save previous state to count virtual obs
247
- self .previous_virtual_obs = self .virtual_obs
248
- virtual_dead_id = setdiff1d (self .virtual_obs ['track' ],
249
- correspondance ['id' ])
250
- list_previous_virtual_id = self .virtual_obs ['track' ].tolist ()
251
- i_virtual_dead_id = [
252
- list_previous_virtual_id .index (i ) for i in virtual_dead_id ]
253
- # Virtual obs which can be prolongate
254
- alive_virtual_obs = self .virtual_obs ['segment_size' ][i_virtual_dead_id ] < self .nb_virtual
255
- nb_virtual_prolongate = alive_virtual_obs .sum ()
256
- logging .debug ('%d virtual obs will be prolongate on the '
257
- 'next step' , nb_virtual_prolongate )
258
-
259
261
self .recense_dead_id_to_extend ()
260
262
261
263
if self .virtual :
0 commit comments