@@ -141,6 +141,21 @@ def recense_dead_id_to_extend(self):
141141 logging .debug ('%d death of real obs in this step' , nb_dead )
142142 if not self .virtual :
143143 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
144159 # Creation of an virtual step for dead one
145160 self .virtual_obs = VirtualEddiesObservations (size = nb_dead + nb_virtual_extend )
146161
@@ -218,16 +233,19 @@ def track(self):
218233 id_previous [self [- 1 ]['out' ]] = previous_id
219234 correspondance ['id' ] = id_previous [correspondance ['in' ]]
220235
236+ # We set correspondance data for virtual obs : ID/LENGTH
221237 if FLG_VIRTUAL :
222238 nb_rebirth = correspondance ['virtual' ].sum ()
223239 if nb_rebirth != 0 :
224240 logging .debug ('%d re-birth due to prolongation with'
225241 ' virtual observations' , nb_rebirth )
226242 # 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 ] = \
229247 self .virtual_obs ['track' ][i_virtual ]
230- correspondance ['virtual_length' ][correspondance [ 'virtual' ] ] = \
248+ correspondance ['virtual_length' ][m_virtual ] = \
231249 self .virtual_obs ['segment_size' ][i_virtual ]
232250
233251 # new_id is equal to UINT32_MAX we must add a new ones
@@ -240,22 +258,6 @@ def track(self):
240258
241259 self .append (correspondance )
242260
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-
259261 self .recense_dead_id_to_extend ()
260262
261263 if self .virtual :
0 commit comments